Re: Re: Calling page and condition check?
| From: | Design in Motion Webdesign | Date: | Mon, 16 Jun 2014 19:21:45 +0000 |
| Subject: | Re: Re: Calling page and condition check? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323493@lists.php.net to get a copy of this message | ||
----- Original Message ----- From: "Joey J" <jacklistmail@gmail.com>
Cc: <php-general@lists.php.net>
Sent: Monday, June 16, 2014 6:28 PM
Subject: Re: [PHP] Re: Calling page and condition check?
Yes, that's what I'm saying. The page has an include of header and this is the header. ONLY this is before that code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> On Mon, Jun 16, 2014 at 11:20 AM, Jim Giner <jim.giner@albanyhandball.com> wrote:First of all, I would not use short tags. If you move your files to a server with short_open_tag disabled in php.ini, you have a problem. Use the regular php tags instead. Second, $_SERVER['SCRIPT_NAME'] returns the absolute pathname of the file from where the script is running, including the folder name if you place your files in one. So either add the folder name in your if-else statements, or strip the folder name from $calling_page (if there is one) before passing the variable to your if-else statements. Best regards. StevenOn 6/16/2014 11:08 AM, Joey J wrote: <?-- Thanks! Joey$calling_page=$_SERVER['SCRIPT_NAME']; echo $calling_page; if ($calling_page == "/index.php") { $title = "Page home"; } elseif ($calling_page == "/contact-us.php") { $title = "Page -- Contact"; } else { $title = "Default"; } echo "<title>".$title." ". $calling_page ."</title>\n"; ?> You're saying that the above code shows you a valid calling_page valuein line 2 that matches one that you are looking for in the if else statements beginning at line 3? Is this code located in the header section of your html page? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php