Jump to content

Unique Page Titles


webweever

Recommended Posts

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?

Link to comment
Share on other sites

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.

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.