|
|
|
|
|
|
| |
Do everything you can to keep visitors on your site, the experts say. Give your audience great content and interactive tools. Provide fresh information and product listings that keep them coming back. |
|
The experts also say to limit links to other sites, especially on your home page. If visitors leave your site for greener pastures, they may never come back. |
|
Good advice, all. But, what if a goal of your site is to provide links to valuable resources at other sites? Perhaps you're a champion of the efficacy of the web, in that it is the ultimate information-sharing medium. |
|
Not to worry. You can do as we did at WEBtheJOINT. Provide your visitors links to relevant goodies that others have built, but with a constant reminder of your site and a way to get back (besides the browser's Back button). |
|
|
A simple yet effective solution is framesets, where you can place your banner at the top of the window when you send visitors elsewhere. |
|
Here's how to do it using PHP. |
|
First, create a simple PHP program called "frameset.php" in your root directory. Here's the code: |
|
~~~~~~~~~~~ ( begin frameset.php code ) ~~~~~~~~~~~
1. <HTML>
2. <HEAD>
3. <TITLE>Your Site Name</TITLE>
4. </HEAD>
5. <?
6. $t = "../banner.htm";
7. ?>
8. <FRAMESET ROWS="27,*">
9. <FRAME SRC="<? echo "$t" ?>" NAME="tframe" >
10. <FRAME SRC="<? echo "$dest" ?>" NAME="main">
11. </FRAMESET>
12. <BODY>
13. </BODY>
14. </HTML>
~~~~~~~~~~~ ( end frameset.php code ) ~~~~~~~~~~~
|
|
|
Expand on the HTML as needed. For one, you might add a NOFRAMES tag within the BODY tag (line 12) to accommodate older browsers that can't handle frames. And, you might need to modify the path references to match your server's file structure on line 6. |
|
Change the "27" (meaning that the top frame will be 27 pixels tall) in line 8 to match the height of the banner you want to display. Keep that number small, so that your banner doesn't use too much of the screen real estate. |
|
Next, create a simple HTML file and call it "banner.htm" (as referenced in line 6 above. Here's the simplified code for that file: |
|
~~~~~~~~~~~ ( begin banner.htm code ) ~~~~~~~~~~~
1. <html>
2. <head>
3. <title>Your Site Name</title>
4. </head>
5. <body>
6. <base target="_top">
7. <a href="index.htm">My Home Page</a>
8. -- add other links here --
9. </body>
10. </html>
~~~~~~~~~~~ ( end banner.htm code ) ~~~~~~~~~~~
|
|
|
In the vicinity of lines 7 and 8, add the HTML code that you want for your banner. We use a one-row, six-cell table that spans the width of the window, and contains our logo with a link to our home page as well as links to the top five sections of our site. If you use any images here, keep them small in height. We use one image in ours and its height attribute matches the ROWS attribute in line 8 of frameset.php. |
|
With these two pieces in place, you're ready to modify the links on your pages to use the frameset. |
|
For example, if you have a link to WEBtheJOINT, your anchor tag would normally look like this: |
|
<a href="http://www.webthejoint.com">WEBtheJOINT</a>
|
|
|
Modify the anchor tag so that you open WEBtheJOINT within your own frameset, so that your banner appears at the top of the window: |
|
<a href="../frameset.php?dest=http://www.webthejoint.com">WEBtheJOINT</a>
|
|
|
What comes after the "?dest=" becomes the PHP variable value that is passed to line 10 of frameset.php. |
|
|
That's all there is to it. Note that some sites are coded so that they escape from framesets imposed by others. You'll have no control over that. We've found a few sites (especially affiliate links) that absolutely won't open within a frameset. You may get an "invalid link" or other error message in these cases. Your best bet is to test each link before implementing. |
|
If you want to see this technique in action, copy the following line into your browser's address box and replace the x's with your site's address: |
|
http://webthejoint.com/fset.php?dest=http://xxxxxx
|
|
|
Get the best of both worlds by using this PHP-driven frameset technique to keep visitors in touch with your site while giving them the additional resources and links they need. |
|
| |
| Honey, I Shrunk My Website Categories : PHP, PHP options/info, Site Planning, Other | | | Getting Intimate With PHP's Mail() Function Categories : PHP, Mail, PHP Functions | | | Custom MySQL-functions Categories : Databases, MySQL, PHP, PHP Functions | | | 10 PHP Functions I Bet You Didn't Know About! Categories : PHP, PHP Functions, Filesystem, Arrays, Errors and Logging | | | Developing a Security Policy, by Anna Johnson Categories : Other, Security, Site Planning | | | Generating One-Time URLs with PHP Categories : PHP, URLs | | | PHP CLI and Cron Categories : PHP, CLI, Cron | | | The Search Portals are going through some growing pains Categories : Search Engines, Search, Site Planning | | | Data, its presentation and user interface forms Categories : PHP, XML, User Interface | | | Saving Images in MySQL Categories : MySQL, PHP, Graphics, Databases | | | PHP 101 Part 8 of 15 : Databases and Other Animals Categories : PHP, Beginner Guides, Databases | | | Beginners guide to PHP and MySQL Categories : PHP, Beginner Guides, Databases, MySQL, Installation | | | Building XML Web Services with PHP NuSOAP Categories : PHP, NuSOAP, XML | | | Introduction to WAP using WML, ASP and PHP Categories : PHP, WAP, WML | | | Web Development With PHP FastTemplate Categories : PHP, Templates, FDF | |
| |
|
|