How I can add in a php include into a TPL template file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jace
    FBOP Class Of 2013
    • Jan 2004
    • 35562

    #1

    How I can add in a php include into a TPL template file?

    because it is a template file it won't allow me to insert the php include directly into it

    someone told me I could create a call function and place the php include into the config files and call that function from the config files

    how do I do that?
  • jwerd
    Confirmed User
    • Jun 2003
    • 1953

    #2
    The simplest way I would think is (apache only example) to just have your server parse php within .tpl extensions. I'm not sure the directive offhand, but if you search around, you'll find what you are looking for!

    Goodluck
    Yii Framework Guru - Seasoned PHP vet - Partner @ XXXCoupon.com

    Comment

    • sarettah
      see you later, I'm gone
      • Oct 2002
      • 14356

      #3
      Originally posted by Jace
      because it is a template file it won't allow me to insert the php include directly into it

      someone told me I could create a call function and place the php include into the config files and call that function from the config files

      how do I do that?
      I usually do the logic in the php program calling the tpl file and then just include it as a tag.

      The apache directive would be an addtype but because the tpl files are not usually called directly, they are used by the php program to format the output, that will probably not work.
      Last edited by sarettah; 07-11-2006, 07:34 PM.
      All cookies cleared!

      Comment

      • sarettah
        see you later, I'm gone
        • Oct 2002
        • 14356

        #4
        Also, the best way to do it can depend on the system using the tpl file. In smarty templates, you can do a certain amount of logic within the template itself. In something like phpBB it is usually just tags that are filled in without logic within the template.

        So, if you told me what you are trying to do with what kind of system it might help
        Last edited by sarettah; 07-11-2006, 07:38 PM.
        All cookies cleared!

        Comment

        • Jace
          FBOP Class Of 2013
          • Jan 2004
          • 35562

          #5
          Originally posted by sarettah
          Also, the best way to do it can depend on the system using the tpl file. In smarty templates, you can do a certain amount of logic within the template itself. In something like phpBB it is usually just tags that are filled in without logic within the template.

          So, if you told me what you are trying to do with what kind of system it might help
          it is a smarty run site

          esyndicat is the script

          Comment

          • Serge Litehead
            Confirmed User
            • Dec 2002
            • 5190

            #6
            Why can't you use include before calling tpl?

            offsubject, smarty is great! i'm loving it

            Comment

            • sarettah
              see you later, I'm gone
              • Oct 2002
              • 14356

              #7
              Originally posted by Jace
              it is a smarty run site

              esyndicat is the script

              Good icq session...lol. Glad we got it working. Yeah smarty is pretty easy to work with.
              All cookies cleared!

              Comment

              • sarettah
                see you later, I'm gone
                • Oct 2002
                • 14356

                #8
                Originally posted by holograph
                Why can't you use include before calling tpl?

                offsubject, smarty is great! i'm loving it

                You could do that and just suck it into a tag but we just used a smarty include {include file="jdjdjdj"} It did the trick
                All cookies cleared!

                Comment

                • Serge Litehead
                  Confirmed User
                  • Dec 2002
                  • 5190

                  #9
                  cool it worked out that way =)

                  Comment

                  • Jace
                    FBOP Class Of 2013
                    • Jan 2004
                    • 35562

                    #10
                    thanks so much sarettah, that worked perfectly....you rock as usual!

                    Comment

                    Working...