Announcement

Collapse
No announcement yet.

$foruminfo not available in phpinclude?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • $foruminfo not available in phpinclude?

    I have the following snippet in template 'phpinclude'

    PHP Code:
      if( basename($PHP_SELF)=="forumdisplay.php" and $foruminfo[cancontainthreads]==and $foruminfo[allowposting]==) {
        
    $navhead_post="
    <td width=50>
    <a href=\"newthread.php?s=
    $session[sessionhash]&action=newthread&forumid="
    .$foruminfo[forumid]
    .
    "\">
    <img src=\"{dcimages}/post.gif\" border=0><br>
    <smallfont>Post!</smallfont></a></td>"
    ;
      } else {
        
    $navhead_post="";
      } 
    It doesn't seem to be working, even though other similar scripts work fine. It never evaluates $foruminfo[cancontainthreads] equal to 1, even if I am on a page where the "New Thread" button is visible.

    Is the $foruminfo variable not available at the time the phpinclude is procesed within forumdisplay.php?

  • #2
    The phpinclude template is evaluated within global.php which occurs at the very beginning of all pages.

    Comment


    • #3
      Workaround

      Is there a workaround?

      Can I assign a variable to some kind of eval() statement whose execution is deferred to the time of substitution, instead of when global.php is processed?

      Comment


      • #4
        You can place your variable to be set in the header template with two $$ (i.e. $$var) and then place your code that sets it in the forumdisplay.php file above the dooutput line it might work
        Last edited by Freddie Bingham; Sat 26 May '01, 5:13pm.

        Comment

        Loading...
        Working...
        X