1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 calling a php file directly from template

Discussion in 'XenForo Questions and Support' started by Forum, Sep 6, 2015.

  1. Forum

    Forum Member

    [Hello!] everyone..

    I tried to include a php on my footer template.

    Following steps from:

    Code:
    https://xenforo.com/community/threads/provide-the-ability-to-call-a-php-file-directly-from-template.47825/
    Here's what I created in library/test/footer.php

    Code:
    <?php
    
    class footinc {
    
      public static function getHtml(){
      include '/home/web/public_html/library/test/123.php';
      }
    }
    
    And then I used this on my footer template:

    Code:
    <xen:callback class="footinc" method="getHtml"></xen:callback>
    But it doesn't work.

    It returns me:
    Code:
    Could not execute callback footinc::getHtml() - Not callable.
    What mistake could I've done here?

    Any solution would be appreciated.

    Thank you :)
     
  2. Arty

    Arty Well-Known Member

    For that file name class name should be called Test_Footer, not footinc
     
  3. Forum

    Forum Member

    Hi mate,

    I renamed the class file name from footinc.php to Footer_Inc.php, but I'm still getting same issue:
    Code:
    Could not execute callback Footer_Inc::getHtml() - Not callable.
     
  4. Arty

    Arty Well-Known Member

    Why did you rename php file? Don't. Rename only class.
     
  5. Arty

    Arty Well-Known Member

    Actually, I've made a error in my post above. Correct class name for file library/test/footer.php is test_footer without capital letters.
     
  6. Forum

    Forum Member

    yeah make sense for me now, I'm using test_footer class but still no luck:

    Code:
    Could not execute callback test_footer::getHtml() - Not callable.
     
  7. AndyB

    AndyB Well-Known Member

    Forum likes this.
  8. Forum

    Forum Member

    Sweet as icicles.. (y)

    I forgot to add:
    Thank's heaps man! (y)
     

Share This Page