Warm tip: This article is reproduced from stackoverflow.com, please click
html javascript php prestashop prestashop-1.7

How to add footer.tpl to .php file

发布于 2020-04-23 14:51:58

I would like to add a footer.tpl file to product_gallery.php in Prestashop.

I'm doing it like bellow:

product_gallery.php


 <!DOCTYPE html>
 <html>
 <head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="style_gallery.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="/gallery/js/gallery_button.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1">

 </head>
 <div class="logo"><a href="" class="logo_link"></a></div>
 <body>
<div class="nav_buttons">
  <ul class="tabs">
     <a data-filter=".group-1" href="#" class="group_link"><button class="button_search">Koszule</button></a>
     <a data-filter=".group-2" href="#" class="group_link"><button class="button_search">Sukienki</button></a>
     <a data-filter=".group-3" href="#" class="group_link"><button class="button_search">Spódnice</button></a>
     <a data-filter=".group-4" href="#" class="group_link"><button class="button_search">Spodnie</button></a>
     <a data-filter=".group-5" href="#" class="group_link"><button class="button_search">Swetry</button></a>
     <a data-filter=".group-6" href="#" class="group_link"><button class="button_search">Płaszcze</button></a>
     <a data-filter=".group-7" href="#" class="group_link"><button class="button_search_all">Wszystkie produkty</button></a>
  </ul>
</div>

<div class="thumbnails grid" id="portfolio">

  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-1 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-2 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-3 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-4 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-5 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-6 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-1 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-2 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-3 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-4 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-5 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-6 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-1 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-2 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-3 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-4 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-5 group-7"></a>
  <a href="#"><img src="gallery/M01.jpg" alt="" class="group-6 group-7"></a>

</div>
   <?php
     {include '/themes/TheStyle/templates/_partials/footer.tpl';}
   ?>
</body>
</html>


This code gives result as follow:

Failed to open stream: No such file or directory and 403 error: permission denied. My question is: How to solve this problem and display a footer.tpl file from prestashop at other .php page created by me?

Questioner
Adrian
Viewed
24
Konstantinos A. Kogkalidis 2020-02-13 07:55

It's nowhere like this. You have to create a module (or an override for an existing controller) over there you will use the setTemplate function.

Keep in mind that normally your template shouldn't be complete. It will have

{extends file='page.tpl'}

on the top.

In case you like to include only the footer but no header you have to make a block around the header and make

{block name='header'}{/block}

to make it empty.