|
Posted by alanbe on 06/14/06 13:07
I am working on some scripts to help me automate the website creation
process.
I want to use a template for the whole website and call pages using
something like
'http://localhost/template.php?page=links'
I actually have a working system, but I thought I would improve by
using comma-separated key => value pairs.
The code is below.
I am using the part of the page filename as the key and the value as
the <title></title>
Problem is that the first 9 work, that is I get the correct page
linked.
When I enter
'http://localhost/template.php?page=plan2', I get the default 'home'
page.
For the life of me I don't see what is wrong.
I use HTML-Kit and notepad. (in the process or weening of wysiwyg
products)
I considered it was a text encoding problem but the same whether I use
notepad or HTML-Kit.
<?php
$allpages=array(
'Home Page'=>'home',
'Purpose'=>'purpose',
'Spiritual Gifts'=>'spiritgifts',
'Reaching Potential'=>'potential',
'Weight Loss'=>'weightloss',
'Contact Me'=>'contactme',
'Spiritual Gifts2'=>'gifts2',
'Spiritual Gifts3'=>'gifts3',
'Links'=>'links',
'The Plan'=>'plan1',
'The Plan'=>'plan2',
'The Plan'=>'plan3'
);
if (isset($_GET['page']) AND (array_search($_GET['page'], $allpages)))
{ $thispage=$_GET['page'];
$title=array_search($thispage, $allpages);
}
else
{ $thispage='home';
$title="Home Page";
}
?>
[Back to original message]
|