header & footer php parsed require statements?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nutcase
    Member
    • May 2000
    • 50

    header & footer php parsed require statements?

    Hey..

    I am trying to misuse $header & $footer. Help.

    I have set them to be advparsed in the options section, and then placed a lot of require statments in them. The problem is this:

    if i do require("xxxxx"); the "'s are an error, so i do require(\"xxxxx\"); which just causes that to be printed. Then i tried putting it in <?php ?> but that causes NOTHING to show up.

    So here's my question. If they are parsed as php code, what do i have to get them to do to recognize a require command?
  • vbsquare
    Member
    • May 2000
    • 61

    #2
    I'm no PHP expert (far from it) but when I wanted this I did the following:

    - set the header and footer to be parsed (you say that you've done this already)

    - In the header and footer templates just type in normal php code. You don't need the <? or <?php tags:

    require("myfile.php"); #remember the semi-colon at the end
    $header = "some text for the header";

    Remember to assign the $header and $footer variables because they are the ones that are parsed into the other templates where you see these variables. Strangely, the contents of the header and footer templates are not what is parsed in, simply the values of the two variables.

    Comment

    • Nutcase
      Member
      • May 2000
      • 50

      #3
      damn.

      That works, but it leads to ANOTHER problem. Apparently John has the script parsing the php at the top, so what ends up happening is this:

      the footer variable is parsed, and the html that is in the required files is drawn at the top of the page, rather than where i place the $footer value. The $header one is the same way, but i use the header one at the top anyway.

      Is there a fix for this? so it will include/parse the footer template where the $footer value is?

      Comment

      • vbsquare
        Member
        • May 2000
        • 61

        #4
        I came across this problem as well. What it comes down to is making sure that all the php code that you put in the footer template does not output any HTML itself, but rather writes the output HTML to the $footer variable. You may also want to do this with the $header variable, because it looks a bit ugly to open up the HTML source and find a load of HTML before the <html> tag.

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...