Portal Home > Knowledgebase > Articles Database > Adding text and integer to switch($cat)
Posted by bambinou, 07-25-2010, 01:32 PM Hello, I have this code here: if (isset($_GET['cat'])) { $cat = (int) $cat; } switch($cat) { case 1: $title = 'this is the page title 1'; break; case 2: $title = 'this is the page title 2'; break; } ?> At the moment this code check for numbers in my url and then change the title tag to the given $title above. If let's says my site has a page called: http://www.mysite.com/1 or http://www.mysite.com/2 then the $title will add the required title tag. I now have a problem, some of my pages do not always end with a number but a word, for a example: http://www.mysite.com/download.html I would like to associate an $title to each URL finishing with a word. For example, if I have a url like the one above i would like to add this in the $cat = (int) $cat; case download.html: $title = 'this is the page title 2'; break; How to do this please? Thank you, Ben
Add to Favourites
Print this Article