severndigital Posted January 28, 2009 Share Posted January 28, 2009 OK .. I have a template.php included in an index.php file, that shows certain divs based off of variables set in the index.php. I would like to control what shows up in those divs using a database table. I'll show you what i have so far. //index.php switch($view){ default: $topNav = 1; $leftNav = 0; $rightNav = 0; $content = '/login/login.php'; break; include_once 'template.php'; //the template file $centerStyle = ''; $topString = ''; if($incTop == 1){ $topString = ' <div id="tmcTopNav"> ' . importModules(2) . ' </div>'; } the template file goes on to include all of the normal html information and then gets to where it would include the divs .... <?php echo $topString; ?> What i would like to do is write a function that looks for all the files that should go into the database. and then puts the correct file where it needs to go. I have the function built, but i don't know how to include the file(s) so that they don't show up in the top left of the page. //function so far. function importModules($location) { //retrieve all active modules $dBase = new pgConnect(); $modules = $dBase->retAssoc("SELECT name FROM modules WHERE active='1' AND location='$location'"); for($i = 0; $i <count($modules); $i++){ include_once MOD_DIR . $modules[$i]['name'] . '/' . $modules[$i]['name'] . '.php; ?>'; } } does anyone have any suggestions?? Thanks, -C Link to comment https://forums.phpfreaks.com/topic/142806-solved-this-one-should-be-fun/ Share on other sites More sharing options...
severndigital Posted January 28, 2009 Author Share Posted January 28, 2009 Well after a few hours of working through it on paper i was able to apply a solution to this. Gonna post it here for two reasons. 1. in the off change someone else will need it. 2. in case i forget what i did. so in the template file i did this if($topNav == 1){ //area is turned on $topString = '<div id="topNav">'; } $endString = '</div>'; if(!empty($topString){ echo $topString; includeModules(2); echo $endString; } that seemed to do the trick. -C Link to comment https://forums.phpfreaks.com/topic/142806-solved-this-one-should-be-fun/#findComment-748948 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.