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("https://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("https://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: https://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

opinion

The Search for Perfection in Your Payments Page

There has been a lot of talk about changes to cross sales and checkout pages. You have likely noticed that acquirers are now actively pushing back on allowing merchants to offer a negative option, upsell or any cross sales on payment pages.

Cathy Beardsley ·
opinion

Unpacking the Payment Card Industry's Latest Data Security Standard

The Payment Card Industry Data Security Standard (PCI DSS) is a set of requirements and guidelines that apply to all businesses that accept credit card payments, and is designed to ensure the security of those transactions.

Jonathan Corona ·
opinion

Compliance With State Age Verification Laws

During the past year, website operators have faced a slew of new state age verification laws entailing a variety of inconsistent compliance obligations.

Lawrence Walters ·
opinion

Merchants in Spotlight With Visa's VIRP

By now, most merchants know about the Visa Integrity Risk Program (VIRP) rolled out in spring 2023. The program is designed to ensure that acquirers and their designated agents — payment facilitators, independent sales organizations and wallets — maintain proper controls and oversight to prevent illegal transactions from entering the Visa payment system.

Cathy Beardsley ·
opinion

How to Know When Hosting Upgrades Are Really Needed

I was reminded about an annoyingly common experience that often frustrates website owners: upgrades. Sometimes, an upgrade of physical system resources like CPU, RAM or storage really is required to solve a problem or improve performance… but how do you know you’re not just being upsold?

Brad Mitchell ·
profile

WIA Profile: Natasha Inamorata

Natasha Inamorata was just a kid when she first picked up a disposable camera. She quickly became enamored with it and continued to shoot with whatever equipment she could afford. In her teens, she saved enough money to purchase a digital Canon ELPH, began taking portraits of her friends, shot an entire wedding on a point-and-shoot camera and edited the photos with Picnik.

Women in Adult ·
trends

Collab Nation: Top Creators Share Best Practices for Fruitful Co-Shoots

One of the fastest ways for creators to gain new subscribers and buyers, not to mention monetize their existing fan base, is to collaborate with other creators. The extra star power can multiply potential earnings, broaden brand reach and boost a creator’s reputation in the community.

Alejandro Freixes ·
opinion

Bridging Generational Divides in Payment Preferences

While Baby Boomers and Gen Xers tend to be most comfortable with the traditional payment methods to which they are accustomed, like cash and credit cards, the younger cohorts — Millennials and Gen Z — have veered sharply toward digital-first payment solutions.

Jonathan Corona ·
opinion

Legal and Business Safety for Creators at Trade Shows

As I write this, I am preparing to attend XBIZ Miami, which reminds me of attending my first trade show 20 years ago. Since then, I have met thousands of people from all over the world who were doing business — or seeking to do business — in the adult industry.

Corey D. Silverstein ·
opinion

Adding AI to Your Company's Tech Toolbox

Artificial intelligence is all the rage. Not only is AI all over the headlines, it is also top of mind for many company leadership teams, who find themselves asking, “How can this new tool help our company?”

Cathy Beardsley ·
Show More