Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

Custom PHP in the "Before </head>" section of the template

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

I am using the NewLifestyle template and it has the feature that allows you to put custom code in the <head> section. I am trying to conditionally load a script file in specific pages so I don't load it unnecessarily. Does php work in your Custom Code section of the template. If not, is there a way to get it in the <head> section without editing the base template?

Thanks,
Mark
  • Mark Rupert's Avatar
  • Mark Rupert
  • 3 Month Basic
  • 7 posts
  • 2 Thanks
  • Karma: 2
Last Edit: 5 years 6 months ago by Mark Rupert.
The administrator has disabled public write access.
Hi Mark,

I think I'd look at something like

www.nonumber.nl/extensions/sourcerer

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Paul,

Thanks for the quick reply. I looked at sourcer but it does not place code in the head section and did not convert my php in the template's custom code section.

However, I did more digging and found "JS By Itemid". You can load a JS in the <head> based on the item ID. The implementation is a little simplistic in configuration and has not been updated since 2012. But it works.

Thanks,
Mark
  • Mark Rupert's Avatar
  • Mark Rupert
  • 3 Month Basic
  • 7 posts
  • 2 Thanks
  • Karma: 2
The administrator has disabled public write access.
The following user(s) said Thank You: manh
HI Mark,

Sorry should have remembered that - think my cold is affecting my brain

Thanks for extension tip :)

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers