PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY browser, you ll see that the here ID has been automatically inserted into the correct link. If you experience any problems, compare your code with menu.inc02.php in the download files. Figure 4-5. With the help of some simple conditional code, the include file produces different output for each page. Now that you know how to find the filename of the current page, you might also find it useful to automate the
tag of each page. This works only if you use filenames that tell you something about the page s contents, but since that s a good practice anyway, it s not really a restriction. PHP Solution 4-4: Automatically generating a page s title from its filename Although the following steps use the Japan Journey website, you can try this out with any page. 1. The basename() function used in the previous solution takes an optional second argument: a string containing the filename extension. Create a new PHP file and insert the following code between a pair of PHP tags (the code is in scriptname2.php): echo basename($_SERVER[’SCRIPT_NAME’], ‘.php’); Note that when passing more than one argument to a function, you separate the arguments with commas. 2. Save the page with any name you like (as long as it has a .php filename extension), and load it into a browser. It should display the name of the file stripped of the .php extension. The download file displays scriptname2.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.
This entry was posted
on Wednesday, November 21st, 2007 at 8:21 am and is filed under MYSQL5.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.