LIGHTENING YOUR (Web hosting uk) WORKLOAD WITH INCLUDES On Mac OS

LIGHTENING YOUR WORKLOAD WITH INCLUDES On Mac OS X, you should see something similar to this: $_SERVER[’SCRIPT_NAME’] comes from one of PHP s built-in superglobal arrays, and it always gives you the absolute (site root relative) pathname for the current page. As you can see from the two screenshots, it works the same regardless of the server s operating system. What you need now is a way of extracting just the filename. 4. Amend the code in the previous step like this: echo basename($_SERVER[’SCRIPT_NAME’]); 5. Save scriptname.php and click the Reload button in your browser. You should now see just the filename: scriptname.php. If you get a parse error message instead, make sure that you have included the closing parenthesis just before the final semicolon. The built-in PHP function basename() takes the pathname of a file and extracts the filename. So, there you have it a way of finding the filename of the current page. 6. Amend the code in menu.inc.php like this (the changes are highlighted in bold):

Make sure that you get the combination of single and double quotes correct. The value of attributes, such as id, must be enclosed in quotes for valid XHTML. Since I ve used double quotes around here, I ve wrapped the string ‘id=”here”‘ in single quotes. I could have written “id=”here”", but a mixture of single and double quotes is easier to read. 7. Save menu.inc.php and load index.php into a browser. The menu should look no different from before. Use the menu to navigate to other pages. This time, as shown in Figure 4-5, the border alongside the current page should be white, indicating your location within the site. If you inspect the page s source view in the
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Leave a Reply