Page 1 of 1

SOLVED Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 10:18 am
by CMSmonkey
Hi Everyone,
I am setting up a website using the Sticky Header theme. I am using the latest CMSMS version and modules.

The error message received is:

Code: Select all

Unable to load template file 'uploads/stickyheader/slider.tpl' in 'content:slider'
In the template file, the code is:

Code: Select all

{* Slider template START *}
{content_image urlonly='1' block='slider_image_one' dir='stickyheader/img/bg'  assign='slider_bg_img' label='Slider background image(.jpg only!)' tab='Header' } 
{content block='slider' label="Slider template" wysiwyg="false" tab='Header' smarty='true' assign='slider' default='{include file="/uploads/stickyheader/slider.tpl"}'} 
{* Slider template END *}  
Can someone please let me know how to resolve the issue? I have double checked and the file is uploaded in the uploads directory.

Thanks.

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 10:37 am
by velden
http://forum.cmsmadesimple.org/viewtopi ... =3&t=72720

try moving the file to tmp/templates and I think tested you then can should remove the path and just keep filename:

Code: Select all

...{include file="slider.tpl"}...

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 10:39 am
by Jo Morg
CMSMS had an issue in which it was not enforced a security policy to not allow the use of template files outside of the modules typical templates folders and tmp/templates folder. That was solved in version 1.12 so including templates from outside these directories is not possible for security reasons.

I suggest the following:
  • - move the template from uploads/stickyheader/slider.tpl to tmp/templates/slider.tpl;
  • - change the code in the template where it reads default='{include file="/uploads/stickyheader/slider.tpl"} change it to default='{include file="/tmp/templates/slider.tpl"}
PS: velden beat me to it :) but you can't remove the include statment ;); velden post was correct all along...

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 11:16 am
by CMSmonkey
Thank you for the quick responses Velden and Jo Morg!

I have made the suggested changes to the template, created the templates folder and uploaded the file in /tmp/templates.

When I try to reload the page it still shows the same error message ??

Please note that I have cleared the cache from the browser and Admin/System Maintenance, and cleared out the files from templates_c folder.

Thanks.

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 11:25 am
by Jo Morg
Well although it should work, I can't test it atm. Given the fact that it's just a default template, remove the whole default=... parameter from that tag and just copy & paste the content of that file on the page you want to use it. It's not an optimal solution but a temporary workaround. At least it allows you to move from that point on and assess if the template doesn't have other issues that render it incompatible with CMSMS 1.12...

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 12:17 pm
by velden
Are we sure the path is right this way? Not sure wath 'root' is in this context (because of leading '/')

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 1:52 pm
by CMSmonkey
velden wrote:Are we sure the path is right this way? Not sure wath 'root' is in this context (because of leading '/')
The root does not include the trailing / so it should work. I tried it with and without just to double check.

I found that in editing the page the content block still had "{include file="/uploads/stickyheader/slider.tpl"}" even though it was changed in the template. So I changed that to {include file="/tmp/templates/slider.tpl"}.

Now the error message says:

Code: Select all

Unable to load template file '/tmp/templates/slider.tpl' in 'content:slider'
So at least the path is right in the error message but it still doesn't load.

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 2:01 pm
by velden
Remove the path information. Just filename like I suggested in my original reply. (edited back now)

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 2:06 pm
by Jo Morg
velden wrote:Remove the path information. Just filename like I suggested in my original reply. (edited back now)
Well caught! My bad, sorry ;).

Re: Sticky Header Template gives error for loading slider

Posted: Mon Aug 10, 2015 2:11 pm
by velden
CMSmonkey wrote:I found that in editing the page the content block still had "{include file="/uploads/stickyheader/slider.tpl"}" even though it was changed in the template.
Changing a template does not influence the saved page content (fortunately) so it makes sense it should be changed per existing page having this tag saved in content.

Re: Sticky Header Template gives error for loading slider

Posted: Tue Aug 11, 2015 2:02 am
by CMSmonkey
velden wrote:http://forum.cmsmadesimple.org/viewtopi ... =3&t=72720

try moving the file to tmp/templates and I think tested you then can should remove the path and just keep filename:

Code: Select all

...{include file="slider.tpl"}...
THAT'S IT!

Thank you Velden and Jo Morg for all of your assistance!