Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Category Static URL and Dynamic Page Title issue
Author « Topic »  

ITZAP
Ecommerce Template Guru

Australia
1018 Posts

Posted - 09/13/2016 :  01:43:31  
Hi, I have created a Static URL for a Menu Category as described here :
https://www.ecommercetemplates.com/seo/static-url-php.asp

Why? It is handy to be able to lock down the page URL address, so if the Menu Category Name changes, the URL does not.
Or maybe you would like to use the $productpagelayout feature to setup a different layout for one particular Menu Category.

i.e. In Category Admin, where it says Category URL (Optional): I entered "website-design-portfolio.php"

Open products.php, do a File ... Save As ... website-design-portfolio.php
The Menu Category Number is (3)
Modify opening lines to read
==========================================
<?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";
$explicitid=3;
include "vsadmin/inc/metainfo.php" ?>
<!DOCTYPE html>
==========================================

In the <head>, I have this for page title
==========================================
<?php $pno = (isset($_GET['pg']) && is_numeric($_GET['pg'])) ? (int)$_GET['pg'] : 1; $pagenumber = ' page ' . $pno; ?>
<title><?php
if(!empty($pagetitle) && $pno == 1) {print $pagetitle;}
else if(!empty($pagetitle) && $pno != 1){print $pagetitle . $pagenumber;}
else if($topsection != "" && $pno == 1) {print $sectionname . ' | ' . $sitename;}
else if($topsection != "" && $pno != 1) {print $sectionname . ' | ' . $sitename . $pagenumber;}
else if(!empty($manname) && $pno == 1) {print $manname . ' | ' . $sitename;}
else if(!empty($manname) && $pno != 1) {print $manname . ' | ' . $sitename . $pagenumber;}
else if($pno == 1) {print $allpagestitle;}
else {print $allpagestitle . $pagenumber;} ?></title>
==========================================

and for the short description
==========================================
<meta name="Description" content="<?php
if(!empty($sectiondescription) && $pno < 2) {print $sectiondescription;}
else if(!empty($sectiondescription) && $pno > 1) {print $sectiondescription . ' ' . $pagenumber;}
else if($pno < 2) {print $allpagesdescription;}
else {print $allpagesdescription . ' ' . $pagenumber;} ?>">
==========================================

Further down in the <body>, i have this
==========================================
<h1><?php
if(!empty($pagetitle) && $pno == 1) {print $pagetitle;}
else if(!empty($pagetitle) && $pno != 1){print $pagetitle . $pagenumber;}
else if($topsection != "" && $pno == 1) {print $sectionname;}
else if($topsection != "" && $pno != 1) {print $sectionname . $pagenumber;}
else if(!empty($manname) && $pno == 1) {print $manname;}
else if(!empty($manname) && $pno != 1) {print $manname . $pagenumber;}
else if($pno == 1) {print $allpagestitle;}
else {print $allpagestitle . $pagenumber;} ?></h1>

<?php include "vsadmin/inc/incproducts.php" ?>
==========================================

Neither the Menu Category Name $sectionname or Short Description $sectiondescription are imported by metainfo.php.

What is printed are the $allpagestitle and $allpagesdescription. Both those parameters I created and added to includes.php, as described here :
https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=101377

Even if I dumb-down the code to the basic
==========================================
<title><?php print $sectionname ?></title>
==========================================
that prints nothing.

Tried following the advice given here
https://www.ecommercetemplates.com/seo/dynamic-title-meta-php.asp
i.e. In Category Admin, where it says Page Title Tag (Optional): I entered "Website Design Portfolio"
==========================================
<title><?php print $pagetitle ?></title>
==========================================
that prints nothing.

When creating a Static URL for a Menu Category, can you offer me any solution on how to print the Menu Category Name and Short Description dynamically please ?

Gary

Edited by - ITZAP on 09/13/2016 21:38:30

Andy
ECT Moderator

95440 Posts

Posted - 09/13/2016 :  03:10:30  
Hi Gary

I'll set up an example here and get back to you.

Andy

Please feel free to review / rate our software

ITZAP
Ecommerce Template Guru

Australia
1018 Posts

Posted - 09/13/2016 :  03:26:09  
Thanks alot Andy,

Correction : What is being printed is the $allpagestitle, a parameter I created and added to includes.php

And use just standard URL's. SEO friendly URL's with Rewrite Rules will not work at all for this.

Gary

Edited by - ITZAP on 09/13/2016 04:06:54

Andy
ECT Moderator

95440 Posts

Posted - 09/13/2016 :  04:07:00  
I just had a good read through and see you want dynamic titles on a static page. Normally you'd just added the title to the page through your text editor but there is also the option for dynamic titles but the syntax is slightly different

https://www.ecommercetemplates.com/seo/static-url-php.asp#dynamic

Andy

Please feel free to review / rate our software

ITZAP
Ecommerce Template Guru

Australia
1018 Posts

Posted - 09/13/2016 :  21:31:48  
Thanks for that link Andy.
quote:
If you are setting this up (a static URL) for a categories page, you'd want to use catid rather than prodid. For the manufacturers page that would be manid.
==========================================
<?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";
$explicitid=3;
$catid=3;

include "vsadmin/inc/metainfo.php" ?>
==========================================
BINGO !

The code above, together with what is posted here
https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=101377
completes the total solution for Dynamic Titles and Meta Descriptions on

(1) categories.php
(2) products.php
(3) Static URL product category pages
(4) manufacturers.php
(5) proddetail.php
(6) Static URL product detail pages

I was hoping maybe you would climb on board with me and update your "Help" pages with all this code, so everybody is clear on how to implement it.

Gary

Phil
ECT Moderator

United Kingdom
7715 Posts

Posted - 09/14/2016 :  02:23:19  
Hi Gary,
I think just the $catid=3; will do, I don't think you need $explicitid=3; as well

<?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";
$catid=3;
include "vsadmin/inc/metainfo.php"
?>



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

Edited by - Phil on 09/14/2016 02:24:10

tgorski
Ecommerce Template Expert

USA
918 Posts

Posted - 12/12/2017 :  16:07:44  
Sinbad asked me to post my question here about the advanced Title tag...

I have implemented the advanced title tag to a site (products.php) with the following code...

<?php $pno = (isset($_GET['pg']) && is_numeric($_GET['pg'])) ? (int)$_GET['pg'] : 1; $pagenumber = ' page ' . $pno; ?>
<title><?php
if(!empty($pagetitle) && $pno == 1) {print $pagetitle;}
else if(!empty($pagetitle) && $pno != 1){print $pagetitle . $pagenumber;}
else if(!empty($sectionname) && $pno == 1) {print $sectionname . ' | ' . $sitename;}
else if(!empty($sectionname) && $pno != 1) {print $sectionname . ' | ' . $sitename . $pagenumber;}
else if($pno == 1) {print $allpagestitle;}
else {print $allpagestitle . $pagenumber;} ?></title>

My question is... On Sub categories, how can this be rewritten to show the category name of the category above WITH the current category?
i.e. CATEGORYNAME | CATEGORYABOVE
Kind of like a Cheese Spreads Category and the subcategory name is Smoked... the title would read "Smoked | Cheese Spreads | Etc."

Tim Gorski

ITZAP
Ecommerce Template Guru

Australia
1018 Posts

Posted - 12/12/2017 :  16:21:14  
Hi Tim, that involves referencing 2 category ID numbers and I do not know any way of doing that, sorry.

Gary

tgorski
Ecommerce Template Expert

USA
918 Posts

Posted - 12/12/2017 :  16:29:18  
Would $topsection be something to implement into the code?

Tim Gorski

tgorski
Ecommerce Template Expert

USA
918 Posts

Posted - 12/12/2017 :  16:31:27  
This is the other code that we have used and it does do what I was talking about, but does not address the pg 1, 2, 3 issues.

<title><?php if(!empty($pagetitle)) {print $pagetitle;} else print $productname . " - " . $sectionname;?> - WI Flea Market</title>

Tim Gorski

Edited by - tgorski on 12/12/2017 16:32:20

ITZAP
Ecommerce Template Guru

Australia
1018 Posts

Posted - 12/12/2017 :  17:13:43  
Tim, rethinking, I guess you could create a bunch of STATIC Menu Category Pages and enter by hand whatever

<title>Sub Category Name | Main Category Name | Sitename</title>

you like. How to do all that is explained on my website here >>

Gary

tgorski
Ecommerce Template Expert

USA
918 Posts

Posted - 12/12/2017 :  17:21:19  
Thanks, Ill check that out.

Tim Gorski
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.05 seconds. Snitz Forums 2000