You are here:  » Add extra information to AtoZ pages

Support Forum



Add extra information to AtoZ pages

Submitted by npaitken on Mon, 2009-01-26 22:16 in

Hi David,

Hope you can help me with something. It's similar to a problem you solved for me before where I wanted to add extra information on products pages. That time you suggested creating files with exact product names and used this code in:

product.php

<?php
  if (file_exists("descriptions/".$mainProduct["name"]))
   {
     require("descriptions/".$mainProduct["name"]);
   }
   else
   {
     print substr($mainProduct["description"],0,500);
   }
?>

and this code in

prices.php

<?php
  if (file_exists("extras/".$q))
  {
    print "</div><div class='bodybottom'></div><div class='bodytop'><h2>Detailed Information</h2></div><div class='bodymiddle'>";
    require("extras/".$q);
  }
 ?>

This resulted in alternative product descriptions and additional 'Detailed Information' below the price table - example here on product page for Skycaddie SG5 Golf GPS.

It worked beautifully :-)

Ok, so now I'd like to do something similar on my category pages like this Golf Accessories page. It's a hard coded page NOT a normal PT category page. And you can see from the sidebar-top-left theres about 10 similarly hard coded pages that I use for categories.

They all have this structure:

<?php
$header["title"] = "Golf Accessories title here";
$header["meta"]["description"] = "Golf Accessories description here";
$header["meta"]["keywords"] = "golf accessories, meta tags";
  require("includes/common.php");
  $atoz["items"][] = array("name" => "Artwork", "href" => "category/Artwork/");
  $atoz["items"][] = array("name" => "Ball Markers", "href" => "search.php?q=ball+marker");
  $atoz["items"][] = array("name" => "Books, CDs & DVDs", "href" => "category/Books-CDs-DVDs/");
  $atoz["items"][] = array("name" => "Cleaners", "href" => "search.php?q=cleaner");
  $atoz["items"][] = array("name" => "Divot Tool", "href" => "search.php?q=divot");
  $atoz["items"][] = array("name" => "Football Teams", "href" => "category/Accessories-Football-Teams/");
  $atoz["items"][] = array("name" => "Gloves", "href" => "search.php?q=glove");
  $atoz["items"][] = array("name" => "Grips", "href" => "search.php?q=grip");
  $atoz["items"][] = array("name" => "Headcovers", "href" => "search.php?q=headcover");
  $atoz["items"][] = array("name" => "Health & Wellbeing", "href" => "category/Health-Wellbeing/");
  $atoz["items"][] = array("name" => "Mittens", "href" => "search.php?q=mitt");
  $atoz["items"][] = array("name" => "Pitchmark Repairers", "href" => "search.php?q=pitchmark");
  $atoz["items"][] = array("name" => "Rangefinders", "href" => "search.php?q=range+finder");
  $atoz["items"][] = array("name" => "Rangefinders GPS", "href" => "search.php?q=gps");
  $atoz["items"][] = array("name" => "Scorecards", "href" => "search.php?q=scorecard");
  $atoz["items"][] = array("name" => "Tees", "href" => "search.php?q=tees");
  $atoz["items"][] = array("name" => "Towels", "href" => "search.php?q=towel");
  $atoz["items"][] = array("name" => "Umbrellas", "href" => "search.php?q=umbrella");
  $banner["h2"] = "<strong>".translate("Golf Accessories")." A-Z</strong>";
  require("html/header.php");
  require("html/menu.php");
  require("html/searchform.php");
  require("html/banner.php");
  require("html/atoz.php");
  require("html/footer.php");
?>

I'd like to be able to add further information both above and below the AtoZ listings on these pages. Initially, I'd just like to get this working with some additional static HTML. However, I've got ambitions to try and bring in some dynamic content too.

Any thoughts on best way to approach this would be very much appreciated.

Thanks,
Neil

Submitted by support on Tue, 2009-01-27 11:01

Hi Neil,

Very straight forward - the main output of those pages will not be generated until this line:

  require("html/atoz.php");

...so to surround the A to Z with your own content, REPLACE the above line with something like:

?>
  <p>Some above the A to Z HTML here</p>
<?php
  require("html/atoz.php");
?>
  <p>Some below the A to Z HTML here</p>
<?php

Cheers,
David.

Submitted by npaitken on Tue, 2009-01-27 20:58

Thanks David,

That's done the trick. I've actually created some new files above and below like so:

require("atozextras/above_atoz.php");
require("html/atoz.php");
require("atozextras/above_atoz.php");

Thanks again for great support.

Neil