Menu

includes in templates

Josh S.
2003-11-15
2003-11-16
  • Josh S.

    Josh S. - 2003-11-15

    Hi,

    I followed the instructions in the FAQ for adding includes to templates and it works except for one problem...it includes everything at the begining of the template instead of where I put the {data} markers.

    What I'm trying to do is make use of a header and footer.  What follows is the code I am using...

    In the config.php file:

    $OVERALLHEADER = include("./templates/header.php");

    $tpl->set_var(
        array(
            "RELEASE"             => "v0.7.0",
            "HOME_LINK"             => $linkbackurl,
            "ADMIN_LINK"             => $admin_link,
            "ADD_LINK"             => $add_link,
            "SUG_CATEGORY"             => $sug_category,       
            "UPDATE_LINK"             => $update_link,
                    "TOP_LINKS"             => $top_links,
            "NEW_LINKS"             => $new_links,
            "UPD_LINKS"             => $upd_links,
            "START_SCRIPT"             => $start_script,
            "DATE"                         => $date,
            "ACTION"             => $start_script,
            "CATEGORY_TITLE"             => "",
            "ACTION_ADMIN"             => "$start_script?mode=admin",
                "OVERALLHEADER"              => $overallheader
        )
    );

    And in the main tmp I use {OVERALLHEADER} below the <DIV> tag, but it includes it at the very begining of the file.

    Any help is greatly appreciated!!!

     
    • Ludovic Drolez

      Ludovic Drolez - 2003-11-16

      You included file should be php code which returns data.
      As stated in the FAQ, you should try something like this:

          ob_start();
          include ('calendar.php');
          $mydata = ob_get_contents();
          ob_end_clean();

      To buffer any output to a variable.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.