Forum
Select specific file from feather
Just curious if it is possible to retrieve a single file via options from a perch feather. For instance, via the script call perch_get_javascript();
. I have a working feather that pulls out my scripts but I've always wondered if you can be more specfic.
I've hunted through the docs but was unable to find anything.
I don't understand. Can you give an example?
Sure, so my feather looks like:
If I wanted to perhaps only pull out
myotherscript
on one page, is there a way via the call on the actual page to be selective about what script it's going to add to my page? Something likeperch_get_javascript('myotherscript');
Sure, the first argument to
perch_get_javascript()
is typically an options array, and you can use that however you'd like within your code.That's good news. Is there any of the old feathers that use the options array in such a manner that I could look at to get my started on getting it setup correctly in my own feather?
I think the Sass one did. But this is basic PHP - testing for a value with an
if
statement.