You are here:  » Varying footers


Varying footers

Submitted by Retro135 on Mon, 2015-07-06 14:17 in

I need to add my own related site links and sidebar info that will vary according to category/subcategory.

Should I create different footers (footer1.php, footer2.php) or should I have different installs then for each category, each with their own footer, but all use same database? How would be the best way to implement this?

Submitted by support on Mon, 2015-07-06 16:14

Hi,

No need for separate installations, if you just have a common html/footer.php you can dynamically include an additional file based on the category name of the product being viewed. Simply create your category dependent content files as

html/footer_Category-1.php
html/footer_Category-2.php

Use hyphens in place of spaces in the filenames, and make sure the capitalisation exactly matches how the category appears on your site. Then, all you need to do is add the following code at the required position:

<?php
  
if (isset($product_main) && $product_main["category"])
  {
    
$filename "html/footer_".tapestry_hyphenate($product_main["category"]).".php";
    if (
file_exists($filename))
    {
      require(
$filename);
    }
  }
?>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Retro135 on Mon, 2015-07-06 17:06

What an easy solution! Happy Monday, indeed! TY!