Announcement

Collapse
No announcement yet.

How to include a custom template ?

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

  • How to include a custom template ?

    Hi, could someone remind me how to include a custom template in a template ?

    Lets say I create a template called customtemplate, inserting the template $customtemplate in a template will have no effect.

    Is there a way to insert customtemplate ?

    Thanks,

  • #2
    I use the code:

    Code:
    eval("\$whatsnew = \"".gettemplate('whatsnew')."\";");
    (the template is 'whatsnew' and the text $whatsnew will make the 'whatsnew' template contents appear)

    Comment


    • #3
      THanks,
      in which file ?

      Comment


      • #4
        Originally posted by Sharg
        in which file ?
        in whichever file you want it to show up in. I put it at the end of index.php, just before
        Code:
        eval("dooutput(\"".gettemplate('forumhome')."\");");
        so that it'll appear on the forum homepage.

        Comment


        • #5
          K thanks !

          Comment


          • #6
            Another simple way to include a template, so long as the template only needs to be included once on a page, is to add the name of the template to the $templatesused variable at the top of the PHP script, and then use the $templatecache[] array in the template you want it to be included in... for example, suppose I have a template called forumhome_javascript that I want to put in the <head> of forumhome...

            First, I add this:
            PHP Code:
             $templatesused 'forumhome_javascript,...................(other templates).......'
            then, in the forumhome template, i add this:
            Code:
            // bits of forumhome
            <head>
            $headinclude
            [b]$templatecache[forumhome_javascript][/b]
            </head>
            Did that make any sense?

            Comment

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