referencing local style sheet, only if it exists...
I'm using the same template/formats for multiple sites but some need to be bit more custom than others... at first I was using:
#if ($currentPageSiteName == SITENAME")2<link href="style.css" rel="stylesheet" type="text/css"/>#end
which works fine but I would have to do that for each site that has a local style sheet... I'd like to check if a local style sheet exist then reference it, something like:
#set($localstyle = $_.locateFile('/style.css', $currentPageSiteName))
#if($localstyle)<link href="style.css" rel="stylesheet" type="text/css"/>#end
but that doesnt work... is what I'm trying to do possible?
as always, thanks in advance!
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Nando on 09 Mar, 2016 06:44 PM
got it!
had to do it this way bc we have different sites on the root of Sites and sites inside directories of sites... thoughts? suggestions?
2 Posted by Ryan Griffith on 10 Mar, 2016 02:47 PM
Thank you for following up. I am glad to hear you were able to come up with a solution.
Another possible solution is to apply a specific Metadata Set to these CSS files and use the Query API to obtain all files using that Metadata Set and sort them by path. You could then loop over those files (if any were returned) and match the file path to the calling page (to handle the nested issue).
I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!
Ryan Griffith closed this discussion on 10 Mar, 2016 02:47 PM.
3 Posted by Ryan Griffith on 10 Mar, 2016 02:47 PM
Thank you for following up. I am glad to hear you were able to come up with a solution.
Another possible solution is to apply a specific Metadata Set to these CSS files and use the Query API to obtain all files using that Metadata Set and sort them by path. You could then loop over those files (if any were returned) and match the file path to the calling page (to handle the nested issue).
I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!