TinyPortal

Development => Block Codes => Topic started by: rocknroller on March 21, 2012, 04:22:26 PM

Title: [php] Block "Scrolling Marquee Recent topics"
Post by: rocknroller on March 21, 2012, 04:22:26 PM
Hello everyone, this is my first post here, so to contribute something.
if this isn't right place moderators please move it.

Add this code into php block. Remove body and title from block, put it in top, upper, bottom or lower block. It's really nice way to show recent posts and does not occupy much space.


global $settings, $txt, $scripturl, $post;
$array = ssi_recentTopics(16, null, null, 'array');
echo '<marquee scrollamount="3" class="moving" onmouseover="this.stop()" onmouseout="this.start()">';
foreach ($array as $post)
{              if (!empty($post['new']) )
                    echo'';
                else
                    echo'<img src="' . $settings['lang_images_url'] . '/new.gif" class="new_posts" alt="" />';echo'<div class="triangle-isosceles" id="a', $post['topic'], '" style="display: none">', $post['preview'], '</div><a href="'. $post['href']. '" target="_self" onmouseover="document.getElementById(\'a', $post['topic'], '\').style.display = \'block\'" onmouseout="document.getElementById(\'a', $post['topic'], '\').style.display = \'none\'">', $post['short_subject'], '</a>';
}
echo '</marquee>
<style type="text/css">
marquee.moving a
{
     font-size:12px;
     font-weight:bold;
     margin-right:50px;
}
.triangle-isosceles {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index:1000;
    padding:15px;
    margin:1em 0 3em;
    color:#fff;
    max-width: 400px;
    border: 1px solid #ccc;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    border-radius:10px;
    -moz-box-shadow: 1px 1px 0px 0px #777;
    -webkit-box-shadow: 1px 1px 0px 0px #777;
    box-shadow: 1px 1px 0px 0px #777;
    background: -moz-linear-gradient(top, rgba(41,137,216,0.9) 0%, rgba(30,87,153,0.9) 94%, rgba(30,87,153,0.9) 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(41,137,216,0.9)), color-stop(94%,rgba(30,87,153,0.9)), color-stop(100%,rgba(30,87,153,0.9)));
    background: -webkit-linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
    background: -o-linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
    background: -ms-linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
    background: linear-gradient(top, rgba(41,137,216,0.9) 0%,rgba(30,87,153,0.9) 94%,rgba(30,87,153,0.9) 100%);
}
</style>';


*block uses marquee tah which is not XHTML vaild
*block uses CSS3

Title: Re: [php] Block "Scrolling Marquee Recent topics"
Post by: ZarPrime on March 22, 2012, 10:29:24 AM
rocknroller,

The first line in your code is not necessary and will cause an error in the block.  Also, I have edited the subject of your topic ...

Code (Remove from code) Select
require_once('SSI.php');

Other than that, nice job. O0

ZarPrime
Title: Re: [php] Block "Scrolling Marquee Recent topics"
Post by: rocknroller on March 22, 2012, 03:48:08 PM
Removed, thank you.