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

How to Halt Hackers as Fraud Attacks Rise

For hackers, it’s often a game of trial and error. Bad actors will perform enumeration and account testing, repeating the same test on a system to look for vulnerabilities — and if you are not equipped with the proper tools, your merchant account could be the next target.

Cathy Beardsley ·
profile

VerifyMy Seeks to Provide Frictionless Online Safety, Compliance Solutions

Before founding VerifyMy, Ryan Shaw was simply looking for an age verification solution for his previous business. The ones he found, however, were too expensive, too difficult to integrate with, or failed to take into account the needs of either the businesses implementing them or the end users who would be required to interact with them.

Alejandro Freixes ·
opinion

How Adult Website Operators Can Cash in on the 'Interchange' Class Action

The Payment Card Interchange Fee Settlement resulted from a landmark antitrust lawsuit involving Visa, Mastercard and several major banks. The case centered around the interchange fees charged to merchants for processing credit and debit card transactions. These fees are set by card networks and are paid by merchants to the banks that issue the cards.

Jonathan Corona ·
opinion

It's Time to Rock the Vote and Make Your Voice Heard

When I worked to defeat California’s Proposition 60 in 2016, our opposition campaign was outspent nearly 10 to 1. Nevertheless, our community came together and garnered enough support and awareness to defeat that harmful, misguided piece of proposed legislation — by more than a million votes.

Siouxsie Q ·
opinion

Staying Compliant to Avoid the Takedown Shakedown

Dealing with complaints is an everyday part of doing business — and a crucial one, since not dealing with them properly can haunt your business in multiple ways. Card brand regulations require every merchant doing business online to have in place a complaint process for reporting content that may be illegal or that violates the card brand rules.

Cathy Beardsley ·
profile

WIA Profile: Patricia Ucros

Born in Bogota, Colombia, Ucros graduated from college with a degree in education. She spent three years teaching third grade, which she enjoyed a lot, before heeding her father’s advice and moving to South Florida.

Women In Adult ·
opinion

Creating Payment Redundancies to Maximize Payout Uptime

During the global CrowdStrike outage that took place toward the end of July, a flawed software update brought air travel and electronic commerce to a grinding halt worldwide. This dramatically underscores the importance of having a backup plan in place for critical infrastructure.

Jonathan Corona ·
opinion

The Need for Minimal Friction in Age Verification Technology

In the adult sector, robust age assurance, comprised of age verification and age estimation methods, 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

Account-to-Account Payments: The New Banking Disruptor?

So much of our industry relies upon Visa and Mastercard to support consumer payments — and with that reliance comes increased scrutiny by both brands. From a compliance perspective, the bar keeps getting raised until it feels like we end up spending half our time making sure we are compliant rather than growing our business.

Cathy Beardsley ·
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 ·
Show More