Hi David, hope all is well!
I've lost title & meta tags for products, but I know why - hoping there's a fix.
I combined my PT site with another one & there's a file that now loads before Price Tapestry. The new file contains code that can't be copied into PT header files (long story), so I'm trying to insert PT title/tag code into this new file. I have no choice but to do this outside the PT header.
Everything works perfectly, so I know the database is being called properly.
Is there a snippet of code to insert in "head" of this new file (to set title & tags) that will simulate settings in my (old) product page..? I've tried many combinations using the below :)
My PT header file contains:
<title><?php if (isset($header["title"]) && $header["title"]) {echo $header["title"]." - ".$config_title; } else {echo $config_title; } ?></title>
<?php if (isset($header["meta"])): foreach($header["meta"] as $name => $content): ?>
<meta name="<?php print $name; ?>" content="<?php print $content; ?>" />
<?php endforeach; endif; ?>
Products.php contains:
$header["title"] = htmlentities($q,ENT_QUOTES,$config_charset)." | ".$product["products"][0]["brand"];
Any help would be much appreciated - I might be overthinking this, all I want to do is place code in my new file that will lift PT info.
Thanks!
Hi David, thanks very much, very helpful, works great!
Quick follow-up question - is there a way to assign a second header file (eg. html/header2.php) for products only..?
This may sound like an odd request, but it will allow me to change the look & feel of my PT site to match a new layout I designed for a content site.
Thanks!
Hi,
Sure - simply create your new file, and then change the filename that is called in products.php, line 101 in the distribution:
require("html/header.php");
...for example:
require("html/header2.php");
Cheers,
David.
Oh wow ... thanks for that.. you have just saved me MANY hours of work!!!
This is such a fantastic app, you thought of everything in the development.
Thanks again David, your help is always much appreciated!!
T.
Hi,
As the title, description and keywords are all based on $q (which comes from the URL),
you should actually be able to replicate almost exactly what Price Tapestry generates
if you are able to simply insert the following PHP into your new header:
<?php
if ($_GET["q"])
{
print "<title>".htmlentities($_GET["q"])."</title>";
print "<meta name='description' content='Search results for ".htmlentities($_GET["q"])."' />";
print "<meta name='keywords' content='".htmlentities($_GET["q"])."' />";
}
else
{
print "<title>Default Title Tag</title>";
}
?>
Hope this helps!
Cheers,
David.