PHP script not executing in header template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kristian
    Member
    • Sep 2002
    • 59

    PHP script not executing in header template

    I get errors when I add php script into the Header Template. It appears that the code isnt executed...!!

    Code is below, it works fine throughout my site, except on the forums, any ideas...???

    --------------------------------------------------------------------

    <? // Register for News and Updates popup - START
    if ($HTTP_COOKIE_VARS["NewsAndUpdates"] == "registered") {
    ?>
    <!-- Register for News and Updates popup with-held -->
    <?
    }else if ($HTTP_COOKIE_VARS["NewsAndUpdates"] == "onhold") {
    ?>
    <!-- Register for News and Updates popup temporarily with-held -->
    <?
    }else{
    ?>
    <!-- Register for News and Updates popup activated - START -->
    <SCRIPT language="JavaScript" type="text/javascript">
    <!--
    popuptimer=setTimeout('registerpopup()',7000)
    function registerpopup(){
    var win = null;
    var w = 350;
    var h = 250;
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    window.open('http://www.flexifoil.com/newsupdate_popup.php','newsupdate_popup','toolbar=no,menubar=no,scrollbars=no,resizable=no ,location=no,height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+'');
    }
    //-->
    </SCRIPT>
    <!-- Register for News and Updates popup activated - END -->
    <?
    }
    // Register for News and Updates popup - END
    ?>
  • vBR
    Senior Member
    • Apr 2002
    • 1768

    #2
    I didn't think you could insert php into templates.
    Do the templates not write to html documents?

    Comment

    • Icheb
      Senior Member
      • Nov 2002
      • 1291

      #3
      You can't use PHP anywhere in templates except in phpinclude or without hacking.

      Comment

      • Brian Briscoe

        #4
        I think you will need a hack like this. You can also do a Search at vBulletin.org.
        Originally posted by Kristian
        I get errors when I add php script into the Header Template. It appears that the code isnt executed...!!

        Code is below, it works fine throughout my site, except on the forums, any ideas...???

        --------------------------------------------------------------------

        <? // Register for News and Updates popup - START
        if ($HTTP_COOKIE_VARS["NewsAndUpdates"] == "registered" ) {
        ?>
        <!-- Register for News and Updates popup with-held -->
        <?
        }else if ($HTTP_COOKIE_VARS["NewsAndUpdates"] == "onhold" ) {
        ?>
        <!-- Register for News and Updates popup temporarily with-held -->
        <?
        }else{
        ?>
        <!-- Register for News and Updates popup activated - START -->
        <SCRIPT language="JavaScript" type="text/javascript">
        <!--
        popuptimer=setTimeout('registerpopup()',7000)
        function registerpopup(){
        var win = null;
        var w = 350;
        var h = 250;
        LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
        TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
        window.open('http://www.flexifoil.com/newsupdate_popup.php','newsupdate_popup','toolbar=no,menubar=no,scrollbars=no,resizable=no ,location=no,height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+'');
        }
        //-->
        </SCRIPT>
        <!-- Register for News and Updates popup activated - END -->
        <?
        }
        // Register for News and Updates popup - END
        ?>

        Comment

        • Kristian
          Member
          • Sep 2002
          • 59

          #5
          Originally posted by Brian Briscoe
          I think you will need a hack like this. You can also do a Search at vBulletin.org.

          Excellent, that hack worked a treat...! Thanks

          Comment

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