How to create new header and footer sections and connect to page

LiteCart Fan
Od Sweden
Użytkownik od paź 2021

Hello 

How can I build new header and footer sections of site and then how to connect the new header, footer sections to page ?

LiteCart Fan
Od Thailand
Użytkownik od sie 2017

For the header edit the file:
public_html/includes/templates/default.catalog/layouts/default.inc.php
for the footer edit the file:
public_html\includes\templates\default.catalog\views\box_site_footer.inc.php
I hope it helps.
Bye

LiteCart Fan
Od Sweden
Użytkownik od paź 2021

@vilaiporn 

I need to create new one header and footer and it should connect one page. Purpose is one page should have special header and footer.

When I create new page and I opened it had a header and footer which came from that you showed path but I can’t find link in that page for it.

LiteCart Fan
Od Thailand
Użytkownik od sie 2017

Oh, so you need a footer and header different depending on each page, for example the home page will have a different footer than the category page, right?

LiteCart Fan
Od Sweden
Użytkownik od paź 2021

Yes, you got it now.

LiteCart Fan
Od Thailand
Użytkownik od sie 2017

In the file public_html\includes\templates\default.catalog\layouts\default.inc.php
you will find this string:
<?php include vmod::check(FS_DIR_APP . 'includes/boxes/box_site_footer.inc.php'); ?>

duplicate it and wrap it in 2 div:


<?php include vmod::check(FS_DIR_APP . 'includes/boxes/box_site_footer.inc.php'); ?>
</div>
<div class="hide-categories">
<?php include vmod::check(FS_DIR_APP . 'includes/boxes/box_site_footer2.inc.php'); ?>
</div>```

In this example we will use the standard footer for all pages, a different footer for the page yourecommerce.com/categories.
Up in the file default.inc.php create a <style></style> section and add:
```.hide-categories {display:none}
.hide-categories {display:<?php
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$z = "https://yourecommerce.com/categories";
if ($actual_link == $z)
echo "block"; ?>}
.hide-index {display:<?php
if ($actual_link == $z)
echo "none"; ?>}```
Change yourecommerce.com with your actual domain.
In this way you will let appear a div that contain a link to a different footer depending on the URL.
Then go to the file public_html\includes\boxes\box_site_footer.inc.php
duplicate it and rename it box_site_footer2.inc.php; in the end of the file locate:
echo $box_site_footer->stitch('views/box_site_footer');
and modify to 
echo $box_site_footer->stitch('views/box_site_footer2');
then go to public_html\includes\templates\default.catalog\views\box_site_footer.inc.php
Duplicate the file box_site_footer.inc.php and rename it to box_site_footer2.inc.php and edit on will.
So, when you will reach the categories page it will apply a different footer.
Probably does exist an easier way...
Let's see if somebody else in the forum will have an idea.
tim
Founder
Od Sweden
Użytkownik od maj 2013
tim

For a separate layout for the first page.

Edit pages/index.inc.php

Set the layout to use at the top:

<?php
  document::$layout = 'firstpage';

Then create includes/templates/default.catalog/layouts/firstpage.inc.php and give it any html you would like.

Ten wątek został zamknięty z powodu zbyt długiej nieaktywności. Przesyłanie nowych odpowiedzi nie jest teraz możliwe.
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.