blesseld Posted February 18, 2010 Share Posted February 18, 2010 Hey, I use a control file to set my meta tags and titles Here's an example <?php switch ($sheet_name) { case 'page-2'://The page that has $sheet_name equal to the case value, this is the link to tell the page what info to use { $page_id = "2";//Standard Page ID $page_location = "home";//Multi Purpose control, Adds Menus, forms or whatever you create. //Header Controls $level_value = "inc";//Used for Path to Stylesheets and Scripts $title = "About Us";//Title of Page $meta_desc = "About Us";//Description of Page $meta_key = "About Us";//Keywords of Page //Add Different Elements $content_area = "true"; break; } ?> I want to eliminate the need to open this control.php file, I want to use a form to update the case variables. Any suggestions? Little bit lost on where I should start since I have only posted to a database. Reason for doing this, everything else is done through an admin panel except this one file and I would like to integrate it with the admin area to eliminate the need to open any files. ** side note, this is a template site I built, and does not use a database, crucial for the market im in. Quote Link to comment Share on other sites More sharing options...
teamatomic Posted February 18, 2010 Share Posted February 18, 2010 You either gotta store the data somewhere or pass it in links with GET. I'd opt for storing it somewhere. HTH Teamtomic Quote Link to comment Share on other sites More sharing options...
blesseld Posted February 18, 2010 Author Share Posted February 18, 2010 by storing somewhere do you mean only in a database, or can i store it in a separate php file? Quote Link to comment Share on other sites More sharing options...
teamatomic Posted February 18, 2010 Share Posted February 18, 2010 You can do either, your choice, but it does not need be a DB, a flat file is just fine for most uses. HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
blesseld Posted February 19, 2010 Author Share Posted February 19, 2010 Hey, Ok, I am attempting this.... and a bit lost, I am trying to get a form to save to an Array... not sure of this part Here is the form <form method='post' action='admin-submit-meta.php?edit_page=5'> <ul class="single"> <li><label>Title</label><input type='text' maxlength='16' name='updatemeta[]' value='updatemeta' /></li> <li><input type='submit' name='submit' /></li> </ul> </form> I will need 3 or 4 fields... title, keywords, description then on submit if I can get them into an array... foreach($_POST['updatemeta'] as $value){ } $fp = fopen("content-page-5-meta.php", "w"); fwrite($fp,serialize($value)); Saves to the file ok Then before I include my template-top // Reading the data $readmeta = file_get_contents('inc/admin/content-page-5-meta.php'); $metadata = unserialize($readmeta); // Now you can access those normally like arrays: echo $metadata['updatemeta']; // Or if you want those to be variables you can use extract function extract($metadata); echo $updatemeta; $title = "$updatemeta"; I include my template-top with the html <head> and set the title with <title><?=$title?></title> I am getting this error Warning: extract() [function.extract]: First argument should be an array in /home/insidegu/public_html/contact.php on line 19 Any Ideas, I know it has something to do with the array, but i never understood them so I am trying to tackle this. I used this as a resources // set and write data for example $store = array( 'name' => 'John', 'age' => 29, 'location' => 'Finland', 'hobby' => 'music' ); $fp = fopen('info.txt','w'); fwrite($fp,serialize($store)); // Reading the data $infotxt = file_get_contents('info.txt'); $info = unserialize($infotxt); // Now you can access those normally like arrays: echo $info['name']; echo $info['age']; echo $info['location']; echo $info['hobby']; // Or if you want those to be variables you can use extract function extract($info); echo $name; echo $age; ... And found this other thread http://www.phpfreaks.com/forums/index.php?topic=234067.0 Tried to figure it out... now need a bit of assistance, Any help is greatly appreciated. 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.