I tried adding custom php using Sourcerer under the "Global Page Settings". While it works for the "After <body>" and "Before </body>" it does not work for the "Custom content" in the "head section" - I can only include static content (which is NOT what I want).
I need to include and execute custom "<?php ... ?>" code in the "<head> </head>" section depending on a variety of defined parameters (URL passed), ip addresses, hostnames, usernames etc for a variety of joomla gantry v5 templates.
How can I do this?
I also figured one way to do this in the body, but it is really akward and rather time consuming using different Jumi modules (one for each location including different PHP includes).
There must be a better way?
Re: SOLVED How to include PHP code into header & different body locations?
Posted 6 years 1 month ago
Damir
Yep, that's it.
You need to ADD this to the documentation of adding php functions with a good example to add section to the "<head> ... </head>" section, it would have saved me lots of head scratching and a post in the forum.
I read the section "Creating Custom File Overrides", too. But that gets confusing once your half way down the page - now I get it after connecting it to the "add php code" ...
A good example "Add custom php code to the <head> section" will be a good example for both document sections and will make it easy for anyone to understand.