Jump to content

Use dropdown instead


blesseld

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.