PHP within a .tpl file

Discussion in 'PHP' started by dalem, Jul 24, 2008.

  1. #1
    Hi does anyone know how to enable php within a template file ( .tpl )

    I have tried enclosing the php within {php} {/php} tags but it doesn't function.

    If anyone can help I would be grateful.

    Thanks
     
    dalem, Jul 24, 2008 IP
  2. voodoo709

    voodoo709 Member

    Messages:
    69
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    48
    #2
    If your hosting account is using cPanel to can use the Apache Handlers section to add .tpl or you can jsut put the follwoing in a .htaccess file.

    AddHandler application/x-httpd-php .tpl
     
    voodoo709, Jul 24, 2008 IP
  3. dalem

    dalem Peon

    Messages:
    494
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you will try that :)
     
    dalem, Jul 24, 2008 IP
  4. varoon

    varoon Well-Known Member

    Messages:
    138
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #4
    Did that work ???

    me too having same problem.....

    any one know how ?
     
    varoon, Jul 24, 2008 IP
  5. MakeThatDollar

    MakeThatDollar Notable Member

    Messages:
    4,451
    Likes Received:
    158
    Best Answers:
    0
    Trophy Points:
    225
    #5
    I did this in a .tpl file and it worked fine:

    And then in adstext.php I had all the php code.
     
    MakeThatDollar, Jul 24, 2008 IP
  6. varoon

    varoon Well-Known Member

    Messages:
    138
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #6
    i use
    and worked.... but only normal html codes works...

    when i use google adsense for mob php it shows......

     
    varoon, Jul 24, 2008 IP
  7. varoon

    varoon Well-Known Member

    Messages:
    138
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #7
    i m using Autoindexer script from source forge.....

    it output is xhtml and works in my mobile.....

    how do u add a google Mobile adesense code into it....

    any one tried ????
     
    varoon, Jul 24, 2008 IP
  8. BMR777

    BMR777 Well-Known Member

    Messages:
    145
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    140
    #8
    @varoon: Try something like:

    $ads = file_get_contents("ads.txt");
    echo $ads;
    PHP:
    This reads straight from the file so may work better with Google Ad code. Also, ad code file doesn't need to be a PHP file, can be any file.

    BMR777
     
    BMR777, Jul 24, 2008 IP
  9. VideoGirls

    VideoGirls Member

    Messages:
    74
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #9
    These start and close php code insertions:
    
    <?php
    
    ?>
    
    PHP:
     
    VideoGirls, Jul 25, 2008 IP