How to call a "mymodule" function outside drupal

Events happening in the community are now at Drupal community events on www.drupal.org.
spideep's picture

I have my drupal directory here: www/ext/drupal/
I have made a index.php in : www/ext/index.php

I've made my module with these instructions:
http://www.bobbymods.com/faq/drupal-modules/how-do-i-add-my-own-php-func...

After that my ext/index.php looks like these:

<?php
$path = $_SERVER['DOCUMENT_ROOT'];
chdir($path."/drupal");
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

/call mymodule function/

myfunctionlibtwo("block");

After that I see:
Fatal error: Call to undefined function myfunctionlibtwo() in my index.php

Thanks for help.

Comments

Algo más...

spideep's picture

Es DRUPAL 6


Alexis Rengifo

I think php not installed or

abhishek.kumar's picture

I think php not installed or may be directory www is not your root directory.

Hmmm

spideep's picture

I think yes,
I test module_list() and works ok, that means bootstrapping is ok right?

But this module list is uncomplete, there is no my module and other modules I have like JS Agregator, this is strange.


Alexis Rengifo

Did you enable the module in

berliner's picture

Did you enable the module in the drupal installation?

Yes

spideep's picture

Yes, double checked


Alexis Rengifo

He leído esto:

spideep's picture

http://lima2011.drupal.lat/sites/default/files/Drupal%20BootStrapping.pdf

Y ciertamente estoy haciendo buen uso del bootstrapping porque cuando hago
<?php module_list()

me aparece la lista de módulos sin embargo no todos, por ejemplo tengo el modulo JS Agregator habilitado pero tampoco aparece en esta lista.

Extraño...


Alexis Rengifo

<?php $path =

diegodalr's picture

<?php
$path = $_SERVER['DOCUMENT_ROOT'];
chdir($path."/ext/drupal");

...

Right, just an example

spideep's picture

Actually /ext/ was just an example, bootstrapping works, but my module doesn't appear.


Alexis Rengifo

How do you call the index.php

berliner's picture

How do you call the index.php file?

Like this

spideep's picture

I have my drupal directory here: www/ext/drupal/
I have made a index.php in : www/ext/index.php

Is the index.php in a one level superior to the drupal installation

http://mydomain.com/ext/index.php

and my drupal is here:

http://mydomain.com/ext/drupal/


Alexis Rengifo

That should normally work. I

berliner's picture

That should normally work. I just tested it on my local machine.

Anything special about your drupal installation? Are all modules in sites/all/modules? A settings.php file in sites/default?

Modulo list

diegodalr's picture

Listando module_list(TRUE,FALSE) tampoco aparece???

Spain

Group organizers

Group categories

Región geográfica

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: