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

Problem calling my own php file with callback

Discussion in 'XenForo Development Discussions' started by omoe, Jun 21, 2016.

  1. omoe

    omoe Member

    Im trying to run the following

    class Attachments_Sum{
        public static function getHtml(){
    $conn_error = 'A problem has occured ,Please report it directly to the website developer ';
    $mysql_host = '******';
    $mysql_user = '******';
    $mysql_pass = '******';
    $mysql_db = '******';
    if (!@mysql_connect($mysql_host, $mysql_user, $mysql_pass)|| !@mysql_select_db($mysql_db)) {die($conn_error);}
    $query = @mysql_query("SELECT SUM(`view_count`) FROM `xf_attachment`");
    return $totaldownloads;
    The callback
    <xen:callback class="Attachments_Sum" method="getHtml"></xen:callback>

    the php file is stored in Library/Attachments/Sum.php

    The error i keep on getting is

    Parse error: syntax error, unexpected '}' in /home/admin/public_html/library/Attachments/Sum.php on line 17
  2. TRGCommunity

    TRGCommunity Active Member

    Delete ?> from the last line and try it again.
  3. Pierce

    Pierce Well-Known Member

    It's in the error delete the last }

  4. omoe

    omoe Member

    There are 2 } , One for Class and the other for the function , It doesn't make sense to remove one .

    Will try to tonight , Thanks for you response .
    TRGCommunity likes this.
  5. omoe

    omoe Member

    Yup ,Works fine after i removed ?> , Thank you so much for your help! .
    TRGCommunity likes this.
  6. TRGCommunity

    TRGCommunity Active Member

    You're welcome :)

Share This Page