Variables in Templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KarlPurk
    New Member
    • Sep 2007
    • 6

    Variables in Templates

    Hi, I have been experimenting with vB and I am in the process of creating a new page. Everything is going well except I can't seem to access a variable inside one of my page related templates.

    Here is the code:

    PHP Code:

    error_reporting
    (E_ALL & ~E_NOTICE);

    define('THIS_SCRIPT''articles');

    // pre-cache templates used by all actions
    $globaltemplates = array(
        
    'articles',
        
    'article_bit'
    );

    // pre-cache templates used by specific actions
    $actiontemplates = array();

    require_once(
    './global.php');
    require_once(
    DIR '/includes/functions_faq.php');

    $aArticles $vbulletin->db->query("
                    SELECT *
                    FROM articles
                "
    );

    $szArticles '';

    while (
    $aArticle $vbulletin->db->fetch_array($aArticles))
    {
        
    $szTitle 'Test Title';
        
    $szArticles .= fetch_template('article_bit');
    }

    eval(
    '$navbar = "' fetch_template('navbar') . '";');
    eval(
    'print_output("' fetch_template('articles') . '");'); 
    When I load the page I can access $szArticles inside the articles template, but I cannot access $szTitle inside the article_bit template. Any help here would be greatly appreciated!

    Karl
  • Analogpoint
    Senior Member
    • Feb 2007
    • 519
    • 3.6.x

    #2
    Could it be due to the fact that you don't have an eval around yoru call to the article_bit template?
    My vBulletin Modifications.

    Comment

    • KarlPurk
      New Member
      • Sep 2007
      • 6

      #3
      yep that did it, thanks.

      Comment

      • Analogpoint
        Senior Member
        • Feb 2007
        • 519
        • 3.6.x

        #4
        Originally posted by KarlPurk
        yep that did it, thanks.
        No problem.
        My vBulletin Modifications.

        Comment

        Related Topics

        Collapse

        Working...
        😀
        😂
        🥰
        😘
        🤢
        😎
        😞
        😡
        👍
        👎