1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to include php codes into Smarty TPL file?

Discussion in 'Co-op Advertising Network' started by bestempire, Nov 7, 2008.

  1. #1
    Hello,

    Can someone help me with the php codes to insert in Smarty TPL file
    SEMrush
    <?php
    ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../. ./../');
    include ('ad_network_254.php');
    echo $ad_network;
    echo $2t;
    ?>

    My site uses Smarty and I donot know how to include the php codes
     
    bestempire, Nov 7, 2008 IP
    SEMrush
  2. easydolla

    easydolla Peon

    Messages:
    403
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It should be

    {php}
    // PHP code here
    {/php]

    :)
     
    easydolla, Nov 7, 2008 IP
  3. masoud.su

    masoud.su Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    HI everybody
    how can I realize if the php file is included in the smarty template file? I included a php file into my smarty template like this: {php} include('./path/to/whatever.php'); {/php}
    and I really don't know if it's included or not? sorry i don't know any thing about PHP at all? I'm a web designer.
     
    masoud.su, May 6, 2010 IP
  4. mattalexx

    mattalexx Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I believe it's this:

    {include_php file="/path/to/somefile.php"}
     
    mattalexx, May 20, 2010 IP
  5. Alexandros1

    Alexandros1 Banned

    Messages:
    332
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Smarty is a great tool for both designers and developers. By using Smarty you can reduce the site development and maintenance times. If you are a developer you no longer need to mix PHP code with HTML code. Just take care of business logic and leave the HTML to the designer.
     
    Alexandros1, Jul 26, 2010 IP
  6. shibli123

    shibli123 Active Member

    Messages:
    325
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #6
    close the <?php tag.. that would work i guess.. :)
     
    shibli123, Jan 21, 2012 IP
  7. tittbit

    tittbit Active Member

    Messages:
    161
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    75
    #7
    there are two options

    one is
    {php}
    the code u want to place
    {/php]

    and the other method may be use the php include function.
     
    tittbit, Feb 2, 2012 IP
  8. Irfi0009

    Irfi0009 Banned

    Messages:
    17,587
    Likes Received:
    33
    Best Answers:
    1
    Trophy Points:
    48
    #8
    by closing php tag it could be work
     
    Irfi0009, Apr 13, 2012 IP
  9. aliforever

    aliforever Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I am So so so Sorry .
    But You Are So Stupid . :mad:
    He Said Non Of The Codes That U Gave had Worked .
    This Is A Big Problem For Me .
    I Need To echo mysql Field Content To a Form In TPL Format .
    And Non Of These Works :
    {php} Your COde {/php}
    {include_php file="/path/to/somefile.php"}

    What Is Closing Tags . Are U Just ... .
    Is He That Stupid To Forgot To Close Tag ????
    I Put This Code In a TPL File But The File's contents DId Not Appear When I Opened It :|
    
    <?php
    include('Templates/db/config.php); $sql = "select * from `p_players` where ID = 1";$query = mysql_query($sql); while ($row = mysql_fetch_array($query)){     $id = $row['ID'];    $fname = $row['name'];    $lname = $row['email'];    $phone = $row['gold_num'];     //we will echo these into the proper fields } ?>
    
    PHP:
    What To Do ??
     
    aliforever, Aug 28, 2012 IP