For users of the Ecommerce Templates PHP shopping cart software, here is a FREE download file containing HTML and PHP code to dynamically generate website page title, meta description, meta og tags, h1 heading and short description code.
Developed here at I.T.ZAP Website Design Works, this dynamic code is essential to maximise your Search Engine Optimization strategy and Social Media impact.
Download Free
This file will UnZip into a folder named “ect-dynamic-code”
Once you have downloaded and UnZipped the file, please open the “ect-dynamic-code-readme.pdf” file which explains all.
The dynamic code has been tested on I.T.ZAP website builds with:
-
Ecommerce Plus PHP Version 7.4.6 (and later) with no custom Mods installed.
-
cPanel LiteSpeed Server running PHP Version 7.4.27 (and later).
-
Requires using the Search Engine Friendly URL’s.
-
Requires both “Short” and “Long” descriptions to be entered for each Category, Product and Article page.
-
All files are provided “as is”.
The objective was to make all the code on the following Ecommerce Templates pages totally dynamic so that it could be used on any website whatsoever.
-
categories.php
-
products.php
-
proddetail.php
Note: This January 2022 update makes the manufacturers.php (or brands.php) page obsolete.
Implementing this dynamic code requires the end user to Copy Ctrl+C and Paste Ctrl+V code snippets into those website PHP files in 3 locations:
-
Above <!DOCTYPE html>
-
Inside “Editable Regions” in the <head>, and
-
Inside “Editable Regions” in the <body> of your page.
To adapt the code for your website, all that needs to be done is to edit and copy/paste code into these configuration files:
-
.htaccess
-
vsadmin/includes.php
-
social-meta-ids.php (Enter Facebook admin and appid numbers here. You can also add <meta> properties for Twitter.)
$sitesocialimage defines a SSL secured filepath to one Full HD Business Promo image (Premises, Logo or similar) for use as og:image on index.php, categories.php, or products.php pages when any of those page URL’s are shared on social media websites.
$publisher creates structured data rich snippets to identify Article Publisher and Author.
You will note that I just paste this one single line above <!DOCTYPE html> to start the visit session and load the necessary Ecommerce Templates content management system files:
<?php include_once("start-ect-metainfo-page.php"); ?>
I find this super simple; no spelling errors; everything loaded in the correct order. Otherwise, if you prefer, you can paste in the regular code.
<?php session_cache_limiter('none');
session_start(); ob_start();
include "vsadmin/db_conn_open.php";
include "vsadmin/inc/languagefile.php";
include "vsadmin/includes.php";
include "vsadmin/inc/incfunctions.php";
include "vsadmin/inc/metainfo.php" ?>
Please note: If you have any of those code entries appearing further down on any page, then you must remove those lines. They cannot be duplicated. And without “metainfo.php” loaded up top, the dynamic code entries will be BLANK.
categories.php
How it works:
Page Title and H1 heading:
(1) If viewing the brand/ page, then the $rootmanufacturertitle you added to includes.php gets printed. Otherwise :
(2) If you entered something into the Page Title Tag (Optional) field, then that gets printed.
Otherwise :
(3) If not the top Root Category, then print the Menu "Section Name" you entered | and "Site Name".
Otherwise it must be the Menu Root Category, so :
(4) Print the $rootcategorytitle you added to includes.php
Page Description:
(1) If viewing the brand/ page, then the $rootmanufacturerdescription you added to includes.php gets printed. Otherwise :
(2) If you entered something into the Meta Description (Optional) field, then that gets printed.
Otherwise if not the top Root Category :
(3) Print the Category Section "Short Description" that you entered.
Otherwise it must be the Menu Root Category, so :
(4) Print the $rootcategorydescription you added to includes.php
products.php
How it works:
<?php $pno > function adds a “page number” onto the end of Titles, Headings and Descriptions to stop Google Webmaster Tools grizzling about duplicate content.
Page Title and H1 heading:
(1) If you entered something into the Page Title Tag (Optional) field, then that gets printed. Otherwise :
(2) If not the top Root Category, then print the Menu "Section Name" you entered | and "Site Name".
Otherwise you must be viewing the list of All Pages, so :
(3) Print the $allpagestitle you added to includes.php AND add the $pagenumber to the end.
Page Description:
(1) If you entered something into the Meta Description (Optional) field, then that gets printed. Otherwise :
(2) If not the top Root Category, then Print the Category Section "Short Description" that you entered.
Otherwise you must be viewing the list of All Pages, so :
(3) Print the $allpagesdescription you added to includes.php AND add the $pagenumber to the end.
proddetail.php
Works in a similar fashion.