defeated Posted April 1, 2008 Share Posted April 1, 2008 Hi, Is it possible to use the $_Get function with the base of the url of a page? I want to have a dynamic <head> based on the url of the page.... something like $page=$_GET['url']; if($page='http://www.jackiebrownmedical.ie'){ echo "<title>the homepage</title>"; //there will also be other tags here eg description, robots etc. } elseif($page='http://www.jackiebrownmedical.ie/jobdetails.php'){ $id=$_GET['id']; echo "<title>more php that created a title for each page based on the job id</title>"; //there will also be other tags here eg description, robots etc. } else {echo "<title>a default title</title>";} The site structure is like this: http://www.jackiebrownmedical.ie //homepage http://www.jackiebrownmedical.ie/about.php //Static page http://www.jackiebrownmedical.ie/jobs.php //Static Page with dynamic content http://www.jackiebrownmedical.ie/jobdetails.php?id='123456' //dynamic pages based on job id no. every <title> is different (dynamic based on details from db) http://www.jackiebrownmedical.ie/applyform.php?id='123456' //dynamic form based on job id no. I cant just have www.jackiebrownmedical.ie?url='home' www.jackiebrownmedical.ie/about.php?url='about' www.jackiebrownmedical.ie/jobs.php?url='jobs' www.jackiebrownmedical.ie/jobdetails.php?url='jobdetails', id='123456' Or can I????? I need a genius to help me out here....... or failing that you'll do! Link to comment https://forums.phpfreaks.com/topic/98960-is-it-possible-to-use-_get-with-base-url/ Share on other sites More sharing options...
mikefrederick Posted April 1, 2008 Share Posted April 1, 2008 The get variable consists of what comes after the ? in the URL. So: $page=$_GET['url']; if($page=='about') { run commands; } elseif($page=='jobs') { more commands; } etc. Notice also that I used == and not =. Link to comment https://forums.phpfreaks.com/topic/98960-is-it-possible-to-use-_get-with-base-url/#findComment-506370 Share on other sites More sharing options...
defeated Posted April 1, 2008 Author Share Posted April 1, 2008 can I put multiple items after the '?' ??? eg. www.jackiebrownmedical.ie/jobdetails.php?url=jobdetails, id='123456' ??? Link to comment https://forums.phpfreaks.com/topic/98960-is-it-possible-to-use-_get-with-base-url/#findComment-506392 Share on other sites More sharing options...
jibster Posted April 1, 2008 Share Posted April 1, 2008 Yes you can except not like that. Like this instead: www.jackiebrownmedical.ie/jobdetails.php?url=jobdetails&id=123456&thisvar=thisvalue etc. Link to comment https://forums.phpfreaks.com/topic/98960-is-it-possible-to-use-_get-with-base-url/#findComment-506542 Share on other sites More sharing options...
defeated Posted April 1, 2008 Author Share Posted April 1, 2008 Cheers Jibster.... that's all I need to know!..... for now anyway Link to comment https://forums.phpfreaks.com/topic/98960-is-it-possible-to-use-_get-with-base-url/#findComment-506589 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.