Jump to content

Problem whit $smarty help me please! i'm stuck :(


Recommended Posts

i followed the guide of prestashop and when i arrive to the part of the displaying content i can create the first part whitout problem :

 

 

mymodule.tpl

<!-- Block mymodule -->

<div id="mymodule_block_left" class="block">

<h4>Welcome!</h4>

<div class="block_content">

<ul>

<li><a href="{$base_dir}modules/mymodule/mymodule_page.php" title="Click this link">Click me!</a></li>

</ul>

</div>

</div>

<!-- /Block mymodule -->

 

and after create the mymodule_page.php if i click i can see "welcome to my shop". up to here no problem, when i arrived to this part of the guide:

 

As you would expect, we have to create a TPL file in order to use the theme's style. Let's create the mymodule_page.tpl file, which will contain the basic "Welcome to my shop!" line, and call that file frommymodule_page.php, which we will rewrite in order to put that basic line within the theme's header, footer, etc.

check.png

You should strive to use explicit and recognizable names for your TPL files, so that you can find them quickly in the back-office – which is a must when using the translation tool.

mymodule_page.tpl

Welcome to my shop!

mymodule_page.php

<?php

global $smarty;

include('../../config/config.inc.php');

include('../../header.php');

$smarty->display(dirname(__FILE__).'/mymodule_page.tpl');

include('../../footer.php');

?>

Let's explore this new PHP file:

  • We first load the current Smarty instance. This must be done before any call to the display() method.
  • The various include()calls in the file enable us to load:
    • The current PrestaShop configuration.
    • The theme's header file (through header.php, which acts as a load file).
    • the theme's footer file (through footer.php, which acts as a load file).

    [*]In the middle of the include() calls, we place your custom template file, whose single action will be to display the "Welcome to my shop!" line.

i'm stuck. i follow the part but when i click, appeares this error:

Parse error: syntax error, unexpected '$smarty' (T_VARIABLE) in C:\xampp\htdocs\prestashop\modules\mymodule\mymodule_page.php on line 6

can someone help me please?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...