include on tpl

Discussion in 'PHP' started by onlyican.com, Dec 6, 2005.

  1. #1
    I am building a website in PHP, and i have installed something to send e cards, one of the files to edit the e card look is a tpl file, and the php include does not work on this, how do i use an include on tpl, (which links to a php)
     
    onlyican.com, Dec 6, 2005 IP
  2. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #2
    so your using what, the smarty template system?

    Try using {include file="file.tpl"}
     
    mdvaldosta, Dec 6, 2005 IP
  3. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    no, on the tpl file i want to include the php file
    a code i have found, which does not work is
    [TPL include='http://jokes.onlyican.com/nav_inc.php']
    I don;t really want another include, I am already using 3 style sheets to do this site.
     
    onlyican.com, Dec 6, 2005 IP
  4. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No thats not the correct way to use a php includes. The code I gave you is for using in the smarty template system to call another file.

    If your in a php file calling another, then use this code:

    <? include('file.php'); ?>
     
    mdvaldosta, Dec 6, 2005 IP
  5. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I am using this, and it is still printing everything between the tags

    {php}include("http://jokes.onlyican.com/nav_include.php");{/php}
     
    onlyican.com, Dec 6, 2005 IP
  6. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #6
    ok, well then try this:

    {literal}<?php include ("http://jokes.onlyican.com/nav_include.php");?>{/literal}
     
    mdvaldosta, Dec 6, 2005 IP
  7. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ok, its not giving me the script no more, it is comming up blank
     
    onlyican.com, Dec 6, 2005 IP
  8. mdvaldosta

    mdvaldosta Peon

    Messages:
    4,079
    Likes Received:
    362
    Best Answers:
    0
    Trophy Points:
    0
    #8
    One of those three ways will work.
     
    mdvaldosta, Dec 6, 2005 IP
  9. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I give up and cheat, just paste the code instead of the include, just means i have to change that when i chage the include
     
    onlyican.com, Dec 6, 2005 IP
  10. philej

    philej Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    You could do this if you gave your TPL file a PHP extension.

    -phil
     
    philej, Dec 7, 2005 IP
  11. onlyican.com

    onlyican.com Peon

    Messages:
    206
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #11
    The TPL file was part of a program i installed on my site, in the end i did not like the way it was working, or looking, (beyond changes) so i deleted it. Got something better now.

    CASE CLOSED
     
    onlyican.com, Dec 7, 2005 IP