TinyPortal

Development => Block Codes => Topic started by: Bobbyplant on March 25, 2008, 08:36:22 AM

Title: Scrolling recent post
Post by: Bobbyplant on March 25, 2008, 08:36:22 AM
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
Title: Re: Scrolling recent post
Post by: Smoky on March 25, 2008, 09:05:05 AM
http://www.tinyportal.net/index.php?topic=4983.0
Title: Re: Scrolling recent post
Post by: Bobbyplant on March 25, 2008, 09:32:36 AM
Hey thanks for the reply Smokey i have already tried that and none appear to be blocks??
Title: Re: Scrolling recent post
Post by: Smoky on March 25, 2008, 09:38:55 AM
if you scroll down that topic link i sent, you will see recent post (scrolling) lol hope this works for you ;)
Title: Re: Scrolling recent post
Post by: Bobbyplant on March 25, 2008, 09:52:19 AM
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.
Title: Re: Scrolling recent post
Post by: JPDeni on March 25, 2008, 12:57:26 PM
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"?
Title: Re: Scrolling recent post
Post by: Bobbyplant on March 25, 2008, 02:20:31 PM
Hi, i would like it to be constantly moving scrolling upwards.
Title: Re: Scrolling recent post
Post by: JPDeni on March 25, 2008, 04:45:15 PM
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>
   ';
Title: Re: Scrolling recent post
Post by: Bobbyplant on March 25, 2008, 05:29:05 PM
Hi, thanks for the reply. Does this just go in a php block?
Title: Re: Scrolling recent post
Post by: JPDeni on March 25, 2008, 05:54:54 PM
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. :)
Title: Re: Scrolling recent post
Post by: Bobbyplant on March 25, 2008, 05:56:39 PM
Thank you so much.
Title: Re: Scrolling recent post
Post by: Bobbyplant on March 26, 2008, 01:55:32 PM
Hi is there a way to make this scroll a little slower as it scrolls quite fast?

Thanks
Title: Re: Scrolling recent post
Post by: JPDeni on March 26, 2008, 02:19:00 PM
I don't think so. It's set at speed 1 now. You can try setting it at 0 to see if that slows things down any more or just stops it.
Title: Re: Scrolling recent post
Post by: Bobbyplant on March 26, 2008, 03:18:24 PM
Ok thanks
Title: Re: Scrolling recent post
Post by: Spize on April 02, 2008, 03:13:21 AM
Is there a way to make it only draw posts from 1 board?
Title: Re: Scrolling recent post
Post by: JPDeni on April 02, 2008, 03:38:10 AM
There was a discussion here and on the SMF forum about an SSI function to list boards to include, rather than one where you have to list boards you want to exclude. I can't seem to find it right now, but you might give it a try.