Jump to content
Manolo93

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More