educational

Why I Did It: Working With Walnuts, Part 2

In this installment of my ongoing "Why I Did It" series, I'm going to continue discussing the use of includes, focusing on PHP and Server Side Includes (SSI) for fast and easy page formatting, and simplified site maintenance.

The first part of this article laid the groundwork for today's discussion by outlining what "includes" are, and some of the things that they're used for. I also showed you the syntax for using includes with Microsoft's popular "FrontPage" visual HTML Editor and site maintenance tool. But what about those Webmaster's who do not use FrontPage? Can they use includes to perform routine maintenance tasks and so much more?

PHP is not yet something that might be considered "standard"...

In most cases, the answer is yes, they can! While other options may be available, two that I have (and do) use are PHP and Server Side Includes (SSI), and we'll take a look at them today:

PHP Includes
As I said in my first installment, I'm not a programmer, and so I can't explain to you WHY PHP includes are preferable to standard Server Side Includes (SSI), even though I have found several benefits to using them over SSI. In fact, there are only two things that I know about PHP: I need to name my pages ".php" and that PHP really stands for "Personal Home Page" — NOT the often claimed "Hypertext Pre-Processor" — a function-describing name given to it by marketing types who couldn't sit in some corporate boardroom and sell the use of a powerful technology with the words "Personal" or "Home Page" in it. Evolution, you know, but I digress:

PHP is a server-side technology that requires a PHP enabled Web server. While increasingly available to Webmasters using virtual hosts, and easily installed by those on dedicated boxes, PHP is not yet something that might be considered "standard," and so if you're not sure that your host supports it, you should inquire first before frustrating yourself over something that may not currently work for you.

If you do have a PHP enabled server, then you are definitely in luck! I say this because one of the coolest things that I have found about the way PHP works for me on my box, as opposed to what works for me using SSI, is that I am able to include "outside" pages into my content. By that I mean I can by using the full, absolute URL of the resource that I desire, toss it into my Web page, even if it is on a different server.

This was something that I was unable to do with SSI, which on my hosts' setup, didn't allow me to pull content from other domains, or include CGI script output, for example. These capabilities are extremely important for me, as they allow me to include the same "Pic Of The Day" (POTD) panel on all of my sites, or the same Full Page Ad (FPA), or anything else that I desired! This is a key prerequisite for my content centralization strategy where many "front ends" can share the same content-filled "back end" — a process much simplified by PHP's relativly easy integration with mySQL databases, a topic beyond the scope of this article. For now, basic file sharing in PHP is possible through this simple snippet of code:

?PHP include("http://domain.com/header.php"); ?

In this example, I would use this include at the top of my page, calling a standard page header file to appear, and in this case I would also likely have another include at the bottom of my page to display the footer file:

?PHP include("http://domain.com/footer.php"); ?

This is a great way to include navigational structures , credits, copyright, contact and legal info across all of your pages, in a way that is easily updated by editing a single file. You can find a wealth of additional PHP information and tutorials at the official Web site: http://www.php.net Once my domains were moved to upgraded Linux servers with PHP support I abandoned the use of SSI in favor of the more flexible PHP approach.

Server Side Includes (SSI)
Perhaps more accessible to a wider range of Webmasters is SSI. While in my own experience, its use has not been as flexible as that of PHP, I relied upon it to include page headers and footers, along with BODY tag information across one of my sites that wasn't yet PHP enabled. I found that using SSI includes for such things as BODYtag inclusion is an easy way to change the look and feel of your site by updating one file with new background colors or images, and text and hyperlink properties.

When using SSI on my virtually hosted domains, I was required to adopt the ".shtml" extension on the pages I had placed the includes before they would work. My host (apparently for security reasons) disallowed the use of SSI (#exec) from within CGI scripts, and CGI output from within SSI. Major inconveniences for me given the amount of CGI used on the same site that I placed these includes. Still, the benefits outweighed the restrictions, and I was able to use the following snippet format to add my various includes:

!--#include virtual="/includes/header.shtml" --

One problem that I encountered with this was my excessive use of this happy new tool: I used includes for the HEAD and BODYtags, to provide common headers, footers, navigation, and certain JavaScript based advertising functions, and anything else that I could think of, with an end result of pages that would not fully load on occasion, probably as I was choking my server... A poor trade for the flexibility and ease of maintenance that I was seeking. Once my domains were moved to upgraded Linux servers with PHP support I abandoned the use of SSI in favor of the more flexible PHP approach.

In my next installment, I'll discuss JavaScript "includes" and the damn Walnut metaphor... ~ Stephen

Copyright © 2024 Adnet Media. All Rights Reserved. XBIZ is a trademark of Adnet Media.
Reproduction in whole or in part in any form or medium without express written permission is prohibited.

More Articles

profile

'Traffic Captain' Andy Wullmer Braves the High Seas as Spirited Exec

Wullmer networked and hobnobbed, gaining expertise in everything from ecommerce to SEO and traffic, making connections and over time rising through the ranks of several companies to become CEO of the mobile business arm of TrafficPartner.

Alejandro Freixes ·
opinion

To Cloud or Not to Cloud, That Is the Question

Let’s be honest. It just sounds way cooler to say your business is “in the cloud,” right? Buzzwords make everything sound chic and relevant. In fact, someone uninformed might even assume that any hosting that is not in the cloud is inferior. So what’s the truth?

Brad Mitchell ·
opinion

Upcoming Visa Price Changes to Registration, Transaction Fees

Visa is updating its fee structure. Effective April 1, both the card brand’s initial nonrefundable application fee and annual renewal fee will increase from $500 to $950. Visa is also introducing a fee of 10 cents for each settled transaction, and 10 basis points — 0.1% — on the payment volume of certain merchant accounts.

Jonathan Corona ·
opinion

Unpacking the New Digital Services Act

Do you hear the word “regulation” and get nervous? When it comes to the EU’s Digital Services Act (DSA), you shouldn’t worry. If you’re complying with the most up-to-date card brand regulations, you can breathe a sigh of relief.

Cathy Beardsley ·
opinion

The Perils of Relying on ChatGPT for Legal Advice

It surprised me how many people admitted that they had used ChatGPT or similar services either to draft legal documents or to provide legal advice. “Surprised” is probably an understatement of my reaction to learning about this, as “horrified” more accurately describes my emotional response.

Corey D. Silverstein ·
profile

WIA Profile: Holly Randall

If you’re one of the many regular listeners to Holly Randall’s celebrated podcast, you are already familiar with her charming intro spiel: “Hi, I’m Holly Randall and welcome to my podcast, ‘Holly Randall Unfiltered.’ This is the show about sex, the adult industry and the people in it.

Women In Adult ·
trends

What's Hot Now: Leading Content Players on Trending Genres, Monetization Strategies

The juggernaut creator economy hurtles along, fueled by ever-ascendant demand for personality-based authenticity and intimacy — yet any reports of the demise of the traditional paysite are greatly exaggerated.

Alejandro Freixes ·
opinion

An Ethical Approach to Global Tech Staffing

One thing my 24-year career as a technologist working to support the online adult entertainment industry has taught me about is the power of global staffing. Without a doubt, I have achieved significantly more business success as a direct result of hiring abroad.

Brad Mitchell ·
opinion

Finding the Right Payment Partner

Whenever I am talking with businesses that are just getting started, one particular question comes up a lot: “How do I get a merchant account?” It’s a simple question, but it has a complicated answer.

Jonathan Corona ·
opinion

The Taxman Cometh for Every Business

February may be the month of romance, but it is also a time when we need to think about something that inspires very little love: taxes. April is not far away, and the taxman is always waiting. This year, federal and most state income taxes are due Monday, April 15.

Cathy Beardsley ·
Show More