Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Run php code in Paper lantern using .html.tt

Discussion in 'cPanel Developers' started by tecwithquestion, Jul 17, 2017.

  1. tecwithquestion

    tecwithquestion Well-Known Member

    Joined:
    Oct 20, 2014
    Messages:
    57
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hello

    I was using plugin which was working on x3 theme. That code written in .php

    how can I use that code with .html.tt ? When I tried to create new file , my php code doesn't work
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. tecwithquestion

    tecwithquestion Well-Known Member

    Joined:
    Oct 20, 2014
    Messages:
    57
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hello

    I already checked cpanel documentation couple of times but I an not able to run my php code in paper_latern.

    Can you please tell me how can I get header and footer using .php file ?

    If I use index.live.php file name, I am able to get header and footer but when I place my code in that file I get this error
    Child failed to make LIVEAPI connection to cPanel.

    Please help to get header footer and side bar using .php file.


    Thanks
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  5. tecwithquestion

    tecwithquestion Well-Known Member

    Joined:
    Oct 20, 2014
    Messages:
    57
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hello

    Thank you for the reply, but if I want to use below code, I must set file filename.live.php

    <?php
    include("/usr/local/cpanel/php/cpanel.php"); // Instantiate the CPANEL object.
    $cpanel = new CPANEL(); // Connect to cPanel - only do this once.
    print $cpanel->header( "Page Heading , app_key" ); // Add the header.
    ?>

    Is that correct ?

    Using this code, I am able to get header, but when I set my code in file, and run file , I get error
    Child failed to make LIVEAPI connection to cPanel.

    Can I get header and footer using only .php file ?
     
  6. tecwithquestion

    tecwithquestion Well-Known Member

    Joined:
    Oct 20, 2014
    Messages:
    57
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    All good.

    Thank you. There was a small issue with my code which is fixed now.

    Thanks for the help.
     
    cPanelMichael likes this.
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hi,

    I'm happy to see you solved the issue. Could you share the code change that you made?

    Thanks!
     
Loading...

Share This Page