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

profile

WIA Profile: Samantha Beatrice

Beatrice credits the sex positivity of Montreal for ultimately inspiring her to pursue work in adult entertainment. She had many friends working in the industry, from sex workers to production teams, so it felt like a natural fit and offered an opportunity to apply her marketing and social media savvy to support people she truly believes in and wants to see succeed.

Women In Adult ·
opinion

Understanding the Latest Server Processors

Over the last decade, we mostly stopped talking about CPU performance. Recently, however, there has been a seismic and exciting change in the CPU landscape, due to innovation by a chip company called Advanced Micro Devices (AMD).

Brad Mitchell ·
opinion

User Choice, Privacy and the Importance of Education in AV

As we discussed last month, age verification in the adult sector is critical to ensuring legal compliance with ever-evolving regulations, safeguarding minors from inappropriate content and protecting the privacy of adults wishing to view adult content.

Gavin Worrall ·
opinion

Maintaining Payment Processing Compliance When the Goalpost Keeps Moving

VIRP is the new four-letter word everyone loves to hate. The Visa Integrity Risk Program went into effect last year, and affects several business types — including MCC 5967, which covers adult and anything else with nudity, and MCC 7273, dating services that don’t allow nudity.

Jonathan Corona ·
opinion

Making the Most of Your Sales Opportunities

The compliance road has been full of twists and turns this year. For many, it’s been a companywide effort just to make it across that finish line. Hopefully, most of us can now return our attention to some important things we’ve left on the back burner for months — like driving revenue.

Cathy Beardsley ·
profile

YourPaysitePartner Marks 25-Year Anniversary Amid Indie Content Renaissance

For 25 years, YourPaysitePartner has teamed up with stars and entrepreneurial brands to bring their one-stop-shop adult content dreams to life — and given the indie paysite renaissance of the past few years, the company’s efforts have paid off in spades.

Alejandro Freixes ·
opinion

WIA Profile: B. Wilde

B. Wilde considers herself a strategic, creative, analytical and entertaining person by nature — all useful traits for a “marketing girlie,” a label she happily embraces.

Women In Adult ·
opinion

Proportionality in Age Verification

Ever-evolving age verification (AV) regulations make it critical for companies in the adult sector to ensure legal compliance while protecting the privacy of adults wishing to view adult content. In the past, however, adult sites implementing AV solutions have seen up to a 60% drop in traffic as a result.

Gavin Worrall ·
opinion

Goodbye to Noncompete Agreements in the US?

A noncompetition agreement, also known as a noncompete clause or covenant not to compete, is a contract between an employer and an employee, or between two companies.

Corey D. Silverstein ·
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 ·
Show More