webweever Posted June 21, 2009 Share Posted June 21, 2009 I have one base php page in my site, I create all the other pages based on passed variables in the url such as map.php?page=local. Currently all the pages have the same title and I'm running through my head trying to figure out what the most efficient way to do this is. I could append the url to something like map.php?page=local&pageTitle=Local catch that variable and echo it in the title tags, my problem with this is the site could potentially grow to hundreds of pages. I can pull that pageTitle variable from the DB but I wonder if there is a more efficient way. Any ideas from any of the PHP geniuses here? Quote Link to comment https://forums.phpfreaks.com/topic/163102-unique-page-titles/ Share on other sites More sharing options...
RussellReal Posted June 21, 2009 Share Posted June 21, 2009 I'm sure you include a 'config.php' or something.. well.. inside the config.php put a title array $titles = array(); $titles['map'] = array( 'local' => 'Your local bla bla search!', 'blar' => 'blar blar blar' ); $titles['index'] = array( ); this way for map.php you can echo for whatever flags are passed, (you handle that with your php code) and pull the correct title.. dw if two array elements conflict with one another, you can just let them overwrite eachother, you'll still get a title. Quote Link to comment https://forums.phpfreaks.com/topic/163102-unique-page-titles/#findComment-860684 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.