Padgoi Posted August 14, 2008 Share Posted August 14, 2008 Ok, I have this script that shows latest posts on my forum that updates using ajax. I want to add the Slidedown effect to it, but I'm not sure where to implement it. Can anyone help with this? Here's the php function that I want to add the Slidedown effect to: 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; } And here's the SlideDown effect instructions: Add this to top of file: <script src="ajax/prototype.js" type="text/javascript"></script> <script src="ajax/scriptaculous.js" type="text/javascript"></script> Then add this line to where you want the effect to go: setTimeout( function() { Effect.SlideDown( $latest_replies, { duration: 0.3 } ); }); But when I put that function right above the return $latest_replies line, I get a php error. Can anyone help with this? Thanks! Link to comment https://forums.phpfreaks.com/topic/119658-slidedown-effect/ Share on other sites More sharing options...
lemmin Posted August 14, 2008 Share Posted August 14, 2008 That is javascript, not PHP. Try to echo that line: echo "setTimeout( function() { Effect.SlideDown( $latest_replies, { duration: 0.3 } ); })"; Link to comment https://forums.phpfreaks.com/topic/119658-slidedown-effect/#findComment-616510 Share on other sites More sharing options...
Padgoi Posted August 15, 2008 Author Share Posted August 15, 2008 Echoing that line just . . . displayed that line. It didn't actually run it, just displayed. Link to comment https://forums.phpfreaks.com/topic/119658-slidedown-effect/#findComment-617641 Share on other sites More sharing options...
lemmin Posted August 18, 2008 Share Posted August 18, 2008 It would have to be in a script tag: echo "<script type=\"text/javascript\">setTimeout( function() { Effect.SlideDown( $latest_replies, { duration: 0.3 } ); }</script>)"; Link to comment https://forums.phpfreaks.com/topic/119658-slidedown-effect/#findComment-619228 Share on other sites More sharing options...
Padgoi Posted August 18, 2008 Author Share Posted August 18, 2008 Thanks lemmin, it no longer echo'd the text, but it's still not working properly. I appreciate the help though. Link to comment https://forums.phpfreaks.com/topic/119658-slidedown-effect/#findComment-619428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.