Jump to content

Smarty3 and PS 1.4 include file StackTrace problem


Recommended Posts

Hello,

I tried almost everything with this problem, but did not manage to solve it on my own.

This is a code in another .tpl file and I can not get trough Stack Trace #0 error.

I have read that it is usually with bad path, but the names of folder and .tpl are good, also $modules_dir shows /modules/

{include file="$modules_dir./mymodule/file.tpl"}



... tools/smarty/sysplugins/smarty_internal_template.php:163 Stack trace: #0 ....


I am loading another template in the same folder as is the main template.

What else could be here?
Link to comment
Share on other sites

Toward troubleshooting, edit config/config.inc.php and enable error reporting
@ini_set('display_errors', 'on');
then revisit the affected page(s)


Everything is done - I just did not want to copy all the error text.

But here it is:

Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file '/modules/./qodwholesale/qodwholesaleform.tpl'' in /var/www/vhosts/domain.lt/subdomains/qod/httpdocs/tools/smarty/sysplugins/smarty_internal_template.php:163 Stack trace: #0 /var/www/vhosts/domain.lt/subdomains/qod/httpdocs/tools/smarty/sysplugins/smarty_internal_template.php(551): Smarty_Internal_Template->isExisting(true) #1 /var/www/vhosts/domain.lt/subdomains/qod/httpdocs/tools/smarty/compile/14e5258e1f4ad3e0e8132a5bff1f9fa480dc35d7.file.qodwholesaleaccount.tpl.php(34): Smarty_Internal_Template->getRenderedTemplate() #2 /var/www/vhosts/domain.lt/subdomains/qod/httpdocs/tools/smarty/sysplugins/smarty_internal_template.php(433): include('/var/www/vhosts...') #3 /var/www/vhosts/domain.lt/subdomains/qod/httpdocs/tools/smarty/sysplugins/smarty_internal_template.php(568): Smarty_Internal_Template->renderTemplate() #4 /var/www/vhosts/domain.lt/subdomains/qod/httpdocs/tools/smarty/Smarty.class.php(339): Smarty_Internal_Template- in /var/www/vhosts/domain.lt/subdomains/qod/httpdocs/tools/smarty/sysplugins/smarty_internal_template.php on line 163
Link to comment
Share on other sites

Yes, I saw that in most cases $tpl_dir is used, but is not this bad for module logic as all the files of module should be independent from everything including the theme? And there's additional work to add that .tpl file to theme folder and so on.

Is not there a way how to include the file in other way but also making it universal? I just have another .tpl that I am using in couple places and one of them is in this second template file and it seems the most proper way just to include it and not copy/paste the same twice.

Link to comment
Share on other sites

I am not new to Prestashop and I wanted something different, but maybe I did not express myself right. However, I got trough without this...

What I really wanted to do is this:

Imagine that in /modules/mymodule/ I have two .tpl files and I just load from the hook one of them by

public function myHook($params)
{
     return $this->display(__FILE__, "firsttemplate.tpl");
}



Then in the template file called firsttemplate.tpl I wanted to add something like this

{include file="secondtemplate.tpl"}



So the $tpl does everything with the right paths for theme folder, but there are any solution to do something simillar for plugin. :)

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...