ChrisTERiS Posted December 7, 2020 Share Posted December 7, 2020 Hello, I'm using this code to load a template from within a hook: $my_template_code = file_get_contents('mytemplate.tpl'); Works fine as for design, but it does not output any phrase. eg This: <input type="submit" class="btn btn-info btn-block" value="{$LANG.affiliatesactivate}" /> appears as this in output: Any idea what's going wrong? If I add the template code inside the hook, like this: <input type="submit" class="btn btn-info btn-block" value="'.Lang::trans('affiliatesactivate').'" /> works, but I don't like to have code and design in a php file. Thank you Chris 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted December 7, 2020 Share Posted December 7, 2020 With file_get_contents() you get the content of a file "as is". It doesn't magically parse variables. You'll need to parse them manually with str_replace. Anyway I don't see why you need to use file_get_content(). If you really want to follow this path, maybe a better option is Smarty fetch. It allows you to return template output instead of displaying it. 1 Quote Link to comment Share on other sites More sharing options...
ChrisTERiS Posted December 7, 2020 Author Share Posted December 7, 2020 4 minutes ago, Kian said: If you really want to follow this path, maybe a better option is Smarty fetch. It allows you to return template output instead of displaying it. I think that with a single answer you solved 2 of my problems. Need to test it. Have another post where I was wondering why $smarty->fetch() does not works. But I was trying with $ca->fetch() Thank you ! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.