SOLVED Sticky Header Template gives error for loading slider

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
CMSmonkey
Power Poster
Power Poster
Posts: 290
Joined: Thu Nov 27, 2008 4:58 pm

SOLVED Sticky Header Template gives error for loading slider

Post 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.
Last edited by CMSmonkey on Tue Aug 11, 2015 2:02 am, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Sticky Header Template gives error for loading slider

Post 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"}...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: Sticky Header Template gives error for loading slider

Post 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...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
CMSmonkey
Power Poster
Power Poster
Posts: 290
Joined: Thu Nov 27, 2008 4:58 pm

Re: Sticky Header Template gives error for loading slider

Post 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.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: Sticky Header Template gives error for loading slider

Post 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...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Sticky Header Template gives error for loading slider

Post by velden »

Are we sure the path is right this way? Not sure wath 'root' is in this context (because of leading '/')
CMSmonkey
Power Poster
Power Poster
Posts: 290
Joined: Thu Nov 27, 2008 4:58 pm

Re: Sticky Header Template gives error for loading slider

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Sticky Header Template gives error for loading slider

Post by velden »

Remove the path information. Just filename like I suggested in my original reply. (edited back now)
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1922
Joined: Mon Jan 29, 2007 4:47 pm

Re: Sticky Header Template gives error for loading slider

Post 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 ;).
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Sticky Header Template gives error for loading slider

Post 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.
CMSmonkey
Power Poster
Power Poster
Posts: 290
Joined: Thu Nov 27, 2008 4:58 pm

Re: Sticky Header Template gives error for loading slider

Post 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!
Locked

Return to “Layout and Design (CSS & HTML)”