How to assign smarty variable in PHPBB?

Discussion in 'Programming' started by adamjblakey, Apr 5, 2007.

  1. #1
    Hi,

    Right basically i have a file which shows the last 5 posts/threads. My problem is that i want to include it in the overall_footer.tpl which is not a PHP file.

    At the moment to get the script to work i am just including the files like:

    <?php include "latestposts.php"; ?>
    Code (markup):
    Which works but what i need to to assign the results to a smarty variable so i can insert into overall_footer.tpl

    Cheers,
    Adam
     
    adamjblakey, Apr 5, 2007 IP
  2. abdussamad

    abdussamad Active Member

    Messages:
    543
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    $template->assign_vars(array("yummy"=>"mmm... cake"));
     
    abdussamad, Apr 5, 2007 IP
  3. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #3
    How would i then display this?

    {yummy} ?
     
    adamjblakey, Apr 5, 2007 IP
  4. abdussamad

    abdussamad Active Member

    Messages:
    543
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    only if you like cake :) . Yes thats how it should be done. It is untested but it should work. Do refer to the code in viewtopic.php. You'll find it variables assigned in this fashion.
     
    abdussamad, Apr 5, 2007 IP