• I am working on adding Comments to the Events pages in Events manager. Because I cannot use ‘echo’ within a variable function, I cannot do anything like

    $replace = $comments();

    within the EM_EVENTS.php file in the ‘classes’ folder. I am now trying to simply add the function to the event_single.php file in the ‘templates’ folder, but am unsure how to access the ‘event_id’ corresponding to the event.

    Here is the function that I am trying to add:

    function comment(){
    global $commentid;
    $q=mysql_query("SELECT name, dtl,dt FROM cmt_post WHERE event_id= '$commentid' and status='apv' order by dt ");
    echo "<table width='400' border='0' cellspacing='1' cellpadding='0'>";
    while($nt=mysql_fetch_array($q)){ $dtl=nl2br($nt['dtl']);
    echo "<tr bgcolor='#f1f1f1'><td>$nt[name]</td><td align=right>".date("d-m-Y",strtotime($nt['dt']))."</td></tr>";
    echo "<tr ><td colspan=2>$dtl</td></tr>";
    }
    echo "</table>";
    }

    I have $commentid = $this->id; within the em_events.php file, but that is not helping. I just need to know how to get the event_id from the current event to add to the mysql_query…

    Thanks in advance for any help that anyone can offer, I have been banging my head against a wall for a while on this one.

Viewing 4 replies - 1 through 4 (of 4 total)
  • try this:

    global $EM_Event;

    THEN

    $EM_Event->output("#_EVENTID")

    Thread Starter bsha100

    (@bsha100)

    Thanks for the help. I found a solution on the events manager homepage in the documentation ( probably the first place I should have looked ). I just added WHERE event_id= '{$EM_Event->id}' and it worked.

    Hello, I try to do this, I cant write a comment in the page of events, but I’ll like to put each comment in there event. ?It?s posible??
    Thanks.

    I put this code in the file em_events.php:

    function comment(){
    global $commentid;
    $q=mysql_query("SELECT name, dtl,dt FROM cmt_post WHERE event_id='{$EM_Event->id}' and status='apv' order by dt ");
    echo "<table width='400' border='0' cellspacing='1' cellpadding='0'>";
    while($nt=mysql_fetch_array($q)){ $dtl=nl2br($nt['dtl']);
    echo "<tr bgcolor='#f1f1f1'><td>$nt[name]</td><td align=right>".date("d-m-Y",strtotime($nt['dt']))."</td></tr>";
    echo "<tr ><td colspan=2>$dtl</td></tr>";
    }
    echo "</table>";
    }

    it won’t work because the code is for displaying the comments only..

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding Comments in EVENTS MANAGER’ is closed to new replies.