Jump to content


This topic is now archived and is closed to further replies.

Branden Wagner

include if variable exists in document

Recommended Posts

I dont know if this can be done... or should be done.
ive written a module system, and at the moment you have to go to mod_settings.inc and make each line

$mod_name = "";
$mod_type = ""; // cust,admin,billing,extra,other
$enabled = 1 // 0 or 1

is there a way i can include a file based on whether it contains those variables. all modules are stored in the modules directory.
and i want to include all files which have $mod_type="cust"; in my customer modules list.


Share this post

Link to post
Share on other sites
I'm not sure what you mean.  Do you mean you have the folder modules then it has other folders?  And you want it to look for $mod_type in every file?

Share this post

Link to post
Share on other sites
yes, i want it to include the file


but only if in the file i wish to include the variable $mod_type = "cust"  exists else ignore it...

if($mod_type == "cust") # is contain
{ include($module) }

but i figure im going  to do it this way....
$dir = MODULES ."/". $type ;
if (is_dir($dir))
        if ($dh = opendir($dir))
                while (($file = readdir($dh)) !== false)
                        if($file != "." && $file != "..")
                        { include_once($file); }

so if they dont specify which module they want they get the generic.... but now i will just split up the modules into folders by type and this should fix it..

sooo.. uhh.. just ignore my question i just answered it myself.. i just had to think a bit longer

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.