addHeaderItem()
Permalink
Is there a way such as using addHeaderItem() to add a php include statement to the header dynamically rather than adding the include directly into the template header.
I want the inclusion to be dynamic and not static.
basically... should this work..?
...I am asking because this doesn't seem to work.
I want the inclusion to be dynamic and not static.
basically... should this work..?
$this->addHeaderItem("<?php include('folder/file.php') ?>");
Thanks Chad.. but it doesn't seem to work...
If I manually add <?php include('folder/file.php') ?> to the template header my stuff works
I installed your block...and...
If I use your block and add <?php include('folder/file.php') ?> to the textarea box my stuff doesn't work.
If I upload my php file to the library then use your block to select the file, my stuff doesn't work.
likewise if I use addHeaderItem('<?php include(\'folder/file.php\') ?>'); in my own controller my script doesn't work...
I think it may be to do with how the page is rendered...
Any other ideas...
If I manually add <?php include('folder/file.php') ?> to the template header my stuff works
I installed your block...and...
If I use your block and add <?php include('folder/file.php') ?> to the textarea box my stuff doesn't work.
If I upload my php file to the library then use your block to select the file, my stuff doesn't work.
likewise if I use addHeaderItem('<?php include(\'folder/file.php\') ?>'); in my own controller my script doesn't work...
I think it may be to do with how the page is rendered...
Any other ideas...
no no no...look at how it works bro. lol
you either 1.) upload your script to your files dir and add that file, or 2.) copy and paste all the actual script.
although, I think I wrote the text input field just for <script>...but you could easily modify the code to be any type of code.
Chad
you either 1.) upload your script to your files dir and add that file, or 2.) copy and paste all the actual script.
although, I think I wrote the text input field just for <script>...but you could easily modify the code to be any type of code.
Chad
let me check the code and see if I can make it work for php
what are doing adding php to a header exactly?
if you are just trying to get some java, then use my addon, and just add the java script, and do not use php at all.
please explain, and I can perhaps customize this addon. But I never have had a reason to add php to a header...just trying to wrap my head around what you could be doing exactly.
Chad
if you are just trying to get some java, then use my addon, and just add the java script, and do not use php at all.
please explain, and I can perhaps customize this addon. But I never have had a reason to add php to a header...just trying to wrap my head around what you could be doing exactly.
Chad
sorry to waste your time chad... I've sorted this now... I forgot I could use include_once to stop multiple blocks trying to include the same php file multiple times... this was why I was using the addToHeader idea as this guarantees a single entry...
It doesn't solve the riddle of why addToHeader didn't work though... maybe a puzzle for another time..
Thanks for the help though... much appreciated.
It doesn't solve the riddle of why addToHeader didn't work though... maybe a puzzle for another time..
Thanks for the help though... much appreciated.
I have since found that the code is indeed being placed in the header but it seems the php script is not being evaluated.
I wrote this for this type of application.
Chad