Padgoi Posted August 14, 2008 Share Posted August 14, 2008 I keep getting an error about unexpected t_function, expecting ). function fetch_latest_replies($read_perms) { $latest_replies = ''; $this->ipsclass->DB->simple_construct( array( 'select' => 't.title, t.tid, t.forum_id, t.last_post, t.last_poster_name, t.last_poster_id, t.views, t.posts as replies, m.mgroup', 'from' => 'topics t left join ' . SQL_PREFIX . 'members m on (m.id = t.last_poster_id)', 'where' => 't.forum_id in (' . $read_perms . ')', 'order' => 't.last_post desc', 'limit' => array(0, $this->ipsclass->vars['_inferno_topxstats_show']) ) ); $this->ipsclass->DB->simple_exec(); while ($thread = $this->ipsclass->DB->fetch_row()) { $thread['replies'] = $this->ipsclass->do_number_format($thread['replies']); $thread['last_post'] = $this->ipsclass->get_date ($thread['last_post'], 'SHORT' ); $thread['forum'] = $this->ipsclass->txt_truncate($thread['forum_id']); $thread['views'] = $this->ipsclass->do_number_format($thread['views']); $thread['title'] = $this->ipsclass->txt_truncate($thread['title'], $this->ipsclass->vars['_inferno_topxstats_titles']); $latest_replies .= $this->ipsclass->compiled_templates[$this->skingroup]->inferno_topxstats_latestreply($thread); } setTimeout( function() { Effect.SlideDown( $latest_replies, { duration: 0.3 } ); }); return $latest_replies; } Link to comment https://forums.phpfreaks.com/topic/119661-whats-wrong-with-this-function/ Share on other sites More sharing options...
Padgoi Posted August 14, 2008 Author Share Posted August 14, 2008 I'm pretty sure the error is with this line: setTimeout( function() { Effect.SlideDown( $latest_replies, { duration: 0.3 } ); }); Link to comment https://forums.phpfreaks.com/topic/119661-whats-wrong-with-this-function/#findComment-616470 Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 You're trying to call Javascript from within PHP. This is not possible. You'll have output the javascript code, eg echo 'setTimeout( function() { Effect.SlideDown( '.$latest_replies.', { duration: 0.3 } ); });'; Link to comment https://forums.phpfreaks.com/topic/119661-whats-wrong-with-this-function/#findComment-616474 Share on other sites More sharing options...
Padgoi Posted August 14, 2008 Author Share Posted August 14, 2008 Ok, but that didn't work. I'm trying to add the SlideDown effect to this list of topics I have that updates via Ajax and not sure how. The tutorial shows how to add it via a href, but this is updating via ajax, so I don't know where to put the javascript function to call the slidedown effect, which is the line in the above post. Link to comment https://forums.phpfreaks.com/topic/119661-whats-wrong-with-this-function/#findComment-616483 Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 I'm don't have much experience with AJAX, but that code will have to be triggered from an Ajax response, eg when readyState is 4, not within your PHP code. We have an AJAX Help forum here. Link to comment https://forums.phpfreaks.com/topic/119661-whats-wrong-with-this-function/#findComment-616487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.