blesseld Posted February 24, 2010 Share Posted February 24, 2010 Hey, First off the sample below works...but... I am unsure on how I can make this a drop down selection... Currently I have a form that updates a variable (stored in a file) and it's based on the answer of yes or no. All this does is activate a template change (turns on a theme across all pages, or turns it off) The Form $readmeta = file_get_contents('content-page-global-template.php'); $metadata = unserialize($readmeta); extract($metadata); echo <<< _END <div class="clear"></div> <br /> <br /> <div class="meta-form"> <form method='post' action='admin-submit-meta.php?edit_page=admin-gt'> <ul class="single"> <li><label>Global Template<br />(Type on or off)</label><input type='text' maxlength='300' name='updateglobalswitch' value='$argtswitch' /></li> <li><label>Template</label><input type='text' maxlength='50' name='updateglobaltemplate' value='$argttemplate' /></li> <li><input type='submit' name='submit' /></li> </ul> </form> </div> <div class="clear"></div> <br /> <br /> _END; The Action .... Opens the file and stores info. include ("admin-header.php"); //Must have to allow access to admin panel or any pages within admin panel if ($loggedin) { $updatemeta1 = $_POST['updatemeta1']; $updatemeta2 = $_POST['updatemeta2']; $updatemeta3 = $_POST['updatemeta3']; $updatetemplate = $_POST['updatetemplate']; $value = array( 'artitle' => "$updatemeta1", 'arkeyword' => "$updatemeta2", 'ardesc' => "$updatemeta3", 'artemplate' => "$updatetemplate" ); //Members Page $edit_page = $_GET["edit_page"]; if ($edit_page == "") { $edit_page = "1"; } switch ($edit_page) { case '0': { break; } case 'admin-gt': { $updateglobalswitch = $_POST['updateglobalswitch']; $updateglobaltemplate = $_POST['updateglobaltemplate']; $value = array( 'argtswitch' => "$updateglobalswitch", 'argttemplate' => "$updateglobaltemplate" ); $fp = fopen("content-page-global-template.php", "w"); fwrite($fp,serialize($value)); break; } } if (!$fp) { echo "Couldn't open the data file. Try again later."; exit; } fclose($fp); $sheet_name = "edit-page"; //**IMPORTANT** selects control informaiton. $global_template = "true";//Used to change all pages templates at once $single_template = "true";//Loads the Template $load_template = "load_template_admin"; $var = $_SERVER["SITE_HTMLROOT"] . '../../inc'; //**IMPORTANT** defines the path for the Global Control to load. include ("$var/global-control.php"); include ("$inc_sub2$inc_control"); //Path to Control File and Control File **Edit path based on directory level of Sub Folder, only edit control if you have multiple control files include ("$inc_sub2$template_top"); //**Edit path based on directory level of Sub Folder include("content-page-admin-menu.php"); ?> <div class="clear"></div> <?php switch ($edit_page) { case '0': { break; } case 'admin-gt': { include ('content-page-global-template.php'); break; } } And here is a file I include in every page... //Turns a Single Theme on for all pages $readmeta = file_get_contents("http://$website_domain/inc/admin/content-page-global-template.php"); $metadata = unserialize($readmeta); extract($metadata); $gt_switch = "$argtswitch"; $gt_template = "$argttemplate"; $global_template_switch = "$gt_switch"; $load_global_template = "$gt_template"; Thanks in Advance Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.