Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2014-09-26 17:30:40
- candyman
- Member
- From: Italy
- Registered: 2006-08-08
- Posts: 684
Custom header for different pages
Probably there is already a plugin that do what I need but I can’t find it.
I have different pages (map, faq, gallery…) and they need some jquery scripts (gmaps.js and so on…).
In order to make the site lightweight I’ve created different html_head forms (html_head_map, html_head_faq…) which have only the script that the page need.
Is there a method to load the script according to the page?
A thing like: IF the page is “map” THEN load script “gmaps.js”?
Thanks in advance,
Alessandro
Offline
Re: Custom header for different pages
How about:
<txp:output_form form='html_head_<txp:section />' />
Look ma, no plugins!
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Custom header for different pages
A similar trick I like to use in the default page:
<txp:variable name="task" value="frontpage" />
<txp:if_category><txp:variable name="task" value="category" /></txp:if_category>
<txp:if_search><txp:variable name="task" value="search" /></txp:if_search>
<txp:if_author><txp:variable name="task" value="author" /></txp:if_author>
<txp:output_form form="task-<txp:variable name="task" />" />
Offline
Re: Custom header for different pages
I’ve made the one <txp:output_form form="html_head" />
only, containing a <txp:yield />
tag, though.
Last edited by Vienuolis (2014-09-27 09:54:49)
Offline