TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 468
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 98
  • Total: 98

Scrolling recent post

Started by Bobbyplant, March 25, 2008, 08:36:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bobbyplant

Hi, im looking for a block to perform scrolling recent posts on tp. I have done a fair of searching but can't seem to find one.

Thanks


Bobbyplant

Hey thanks for the reply Smokey i have already tried that and none appear to be blocks??

Smoky

if you scroll down that topic link i sent, you will see recent post (scrolling) lol hope this works for you ;)

Bobbyplant

I see thanks again. I presume you just cant add a php block?? Yoo have to edit other templates too?? I ask this as it isn't particularly clear.

JPDeni

What exactly do you want? Do you want scrolling as in "constanly moving" or do you want scrolling as in "has scroll bars on the side so that it doesn't take up so much room on the page"?

Bobbyplant

Hi, i would like it to be constantly moving scrolling upwards.

JPDeni

Like the shoutbox is, yes?

This will give a preview of each post, along with the subject of the post and a link to the post in the board. I didn't know what you wanted to display. You can add the poster name, with or without a link to their profile, the time it was posted and some other stuff.


$number_of_recent_posts = 5;
$exclude_boards = array();

$posts = ssi_recentPosts($number_of_recent_posts, $exclude_boards, 'return');

echo '
<style type="text/css">

#marqueecontainer{
position: relative;
width: 95%; /*marquee width */
height: 150px; /*marquee height */
overflow: hidden;
padding: 2px;
padding-left: 4px;
}

</style>

<script language="javascript" type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=1000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=\'\'

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
if(cross_marquee == null)
   return
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarquee()",30)\', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


</script>

<div id="marqueecontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
<div id="vmarquee" style="position: absolute; width: 98%;">';

foreach ($posts as $post) {
  echo $post['link'] . '<br />';
  echo $post['preview'] . '<br /><br />';
}
echo '
</div>
</div>
   ';

Bobbyplant

Hi, thanks for the reply. Does this just go in a php block?

JPDeni

Yes. (I always forget to mention that.) Just copy the code and paste it into a php block. I ran it on my site and it works just fine. :)

This website is proudly hosted on Crocweb Cloud Website Hosting.