setCustomTemplate not loading CSS
Permalink
I'm hard-coding a custom template in my theme file:
$a = new Area('Main');
$a->setCustomTemplate('slideshow', 'templates/my_slideshow/view.php');
$a->display($c);
This is loading view.php but is not loading view.css (located in the same dir). The block template is loaded fine if selected through the CMS but not hard-coded like this. Any ideas?
Thanks
Joe
$a = new Area('Main');
$a->setCustomTemplate('slideshow', 'templates/my_slideshow/view.php');
$a->display($c);
This is loading view.php but is not loading view.css (located in the same dir). The block template is loaded fine if selected through the CMS but not hard-coded like this. Any ideas?
Thanks
Joe
I have seen this issue as well, but have never taken the time to really figure out the cause.
I have found that it is best to put as little css as necessary to make the template work in the view.css file. The rest goes in the theme template. This makes it much easier to apply a new theme later as the block css does not change when applying a new template. It also has the advantage of eliminating the issue you are experiencing.
I have found that it is best to put as little css as necessary to make the template work in the view.css file. The rest goes in the theme template. This makes it much easier to apply a new theme later as the block css does not change when applying a new template. It also has the advantage of eliminating the issue you are experiencing.
This is odd behavior. The 'setCustomTemplate' function doesn't do much except update some info in the database. I think this should be reported as a bug so the core team can have a look at it to determine if there is a bug or an oversight or a 'feature' we didn't know we wanted.
Depending on which version of C5 you're running, the way the system determines locations of related assets (like CSS files) for custom templates is different:
http://concrete5tricks.com/blog/how-562-changes-the-way-custom-temp...
If you're using the latest version (5.6.2 or 5.6.2.1) then it should be looking in the same directory that the overridden view.php file is in... but if you're using an earlier version of C5 then it might still be looking in the original directory.
Maybe. It's all very confusing and not documented anywhere. Or it might be a bug :)
http://concrete5tricks.com/blog/how-562-changes-the-way-custom-temp...
If you're using the latest version (5.6.2 or 5.6.2.1) then it should be looking in the same directory that the overridden view.php file is in... but if you're using an earlier version of C5 then it might still be looking in the original directory.
Maybe. It's all very confusing and not documented anywhere. Or it might be a bug :)
Maybe there are any better way.
Rony