News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Scrolling Recent Posts/

Started by Vinoth, July 17, 2004, 05:38:09 PM

Previous topic - Next topic

Bulakbol

Quote from: joybreezy on July 23, 2007, 02:20:34 PM
Where do I put this code please? What do I need to make it work in one of the blocks?

Sorry, I don't use TP. I am using Helios-multi, modified the codes from BoardIndex.template.php then went to Admin > Current Theme ang entered 15 on the "Number of recent posts to display on board index" and it appeared under the Info Center. Check this site for the scrolling recent posts..
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

zenodaddy

#41
I have tried for the past 20 minutes to get this code to work with the site and keep getting a parse error. So I try again, and it happens again.

Can anyone explain where exactly to post this code in the boardindex.template.php file?

At one point it pointed to an unexpected $ error for ?>

I would attach the boardindex.template.php file but there is no option to attach the file

zenodaddy

Nevermind, I realized the problem.  :D

salim

Hi all,

i wanted to share my experience also on this topic.

u can view `recent post scroller` at my site

1. Arabic Version:
http://www.aburatib.com/component/option,com_smf/itemid,81/forum,arabic/lang,ar/ [nofollow]

2. English Version:
http://www.aburatib.com/component/option,com_smf/itemid,81/forum,english/lang,en/ [nofollow]

3. French Version:
http://www.aburatib.com/component/option,com_smf/itemid,81/forum,french/lang,fr/ [nofollow]

but im not using `marquee` tag but javascript

`Translucent scroller- By Dynamic Drive`

regards
The second half of a man's life is made up of nothing but the habits he has acquired during the first half. - Fyodor Dostoevsky

Bulakbol

<marquee uses only 3 lines while java uses many lines to yield the same effect.  They are not both supported by all browsers. So, I'll stick with marquee.  :-\
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

clcrm96

#45
Hi! I used this code in index.template.php:


---------------------------------------------------------------------------------------------------

// Show lots of posts.
      if (!empty($context['latest_posts']))
      {
         echo '<marquee  behavior="scroll" direction="up" height="50" scrolldelay="300" scrollamount="2">
         <table width="100%" border="0">';
         /* Each post in latest_posts has:
            board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
            subject, short_subject (shortened with...), time, link, and href. */
         foreach ($context['latest_posts'] as $post)
            echo '
            <tr>
               <td align="right" valign="top" nowrap="nowrap">[', $post['board']['link'], ']</td>
               <td valign="top">', $post['link'], ' ', $txt[525], ' ', $post['poster']['link'], '</td>
               <td align="right" valign="top" nowrap="nowrap">', $post['time'], '</td>
            </tr>';
         echo '
         </table></marquee>';
      }
---------------------------------------------------------------------------------------------------

and I didn't get any errors, but it doesn't show any scrolling posts either.  Any ideas?
My site is here: hxxp:thecinnamonhollow.com/smf/index.php [nonactive]
and I would actually like to have it to the right of the top greeting. You know where it says 'Hey, and then your name and any PM's or even at the very bottom. That might be better.
Sorry, I don't know the correct terminology. If anyone can tell me how to fix it and where to place the code I'd be very grateful!
Thanks,
Crystal

Bulakbol

Go to Admin > Current Theme > Number of recent posts to display on board index: 
Try 15. That will enable the scrolling of recent posts.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

clcrm96

Hi JohnyB,
  That sort of worked. It shows the posts but instead of scrolling, it placed them right above the news fader box and they don't scroll. Maybe it is because I'm using an edited theme? Where would I place the code to have it show/scroll at the bottom of the page instead? Thank you so much for your help!

Crystal

Bulakbol

Quote from: clcrm96 on September 29, 2007, 01:00:48 AM
Hi! I used this code in index.template.php:

---------------------------------------------------------------------------------------------------

Copy the codes from index.template.php to BoardIndex.template.php. Comment out the ones from Index.template.php in case something goes wrong.  Check default/BoardIndex.template.php and you can find similar codes (without the <marquee> line) that display recent post at the bottom. If it's hard for you to do it, attach your BoardIndex.template.php and index.template.php and we'll see what we can do to help. 
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

clcrm96

Thank you! I finally got it!!! YAY! Thank you for your help.
I really appreciate it!

God Bless,
Crystal
hxxp:thecinnamonhollow.com/smf/index.php [nonactive]
hxxp:thecinnamonhollow.com [nonactive]

Bulakbol

You are welcome.  Here's more.

This will pause the scroll when you mouse over the scrolling "recent posts".

<marquee  behavior="scroll" direction="up" height="50" scrolldelay="300" scrollamount="2" onmouseover="this.stop()" onmouseout="this.start()">


You may also consider alternate background colors.

// Show lots of posts.
      if (!empty($context['latest_posts']))
      {
         $alternate = true;
         echo '<marquee  behavior="scroll" direction="up" height="50" scrolldelay="300" scrollamount="2">
         <table width="100%" border="0">';
         /* Each post in latest_posts has:
            board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
            subject, short_subject (shortened with...), time, link, and href. */
         foreach ($context['latest_posts'] as $post)
            echo '
            <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
               <td align="right" valign="top" nowrap="nowrap">[', $post['board']['link'], ']</td>
               <td valign="top">', $post['link'], ' ', $txt[525], ' ', $post['poster']['link'], '</td>
               <td align="right" valign="top" nowrap="nowrap">', $post['time'], '</td>
            </tr>';
             $alternate = !$alternate;
         echo '
         </table></marquee>';
      }
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

clcrm96

Thanks again! I did get it to pause when I hover my mouse but I can't get the colors to alternate. I am glad to at least have it working though. I have more trouble getting things installed and edited in my forum. :(
But this worked great! Thanks! :D

mzeblu

Hi,

I've got the scrolling recent topics plus stop on mouse over :)  I'm on cloud 9!!!  Thank you soo much! :)

I really want to be on cloud 10 next. lol..  hope someone can help.

I want to move "only" the recent topics to the top of my forum just above the shoutbox.

Can someone tell me:
1. what part of my code I need to copy
2. where I need to paste it.
3. any additional code I may have to enter after pasted to make it work properly.
I attempted it myself 2 dozen times without success.  Thanks for any help.


<?php
// Version: 1.1; BoardIndex

function template_main()
{
global $context$settings$options$txt$scripturl$modSettings;

// Show some statistics next to the link tree if SP1 info is off.
echo '
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="bottom">'
theme_linktree(), '</td>
<td align="right">'
;
if (!$settings['show_sp1_info'])
echo '
'
$txt[19], ': '$context['common_stats']['total_members'], ' &nbsp;&#38;#8226;&nbsp; '$txt[95], ': '$context['common_stats']['total_posts'], ' &nbsp;&#38;#8226;&nbsp; '$txt[64], ': '$context['common_stats']['total_topics'], '
'
, ($settings['show_latest_member'] ? '<br />' $txt[201] . ' <b>' $context['common_stats']['latest_member']['link'] . '</b>' $txt[581] : '');
echo '
</td>
</tr>
</table>'
;

// Show the news fader?  (assuming there are things to show...)
if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
{
echo '
<table border="0" width="100%" class="tborder" cellspacing="' 
, ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' '0' '" cellpadding="4" style="margin-bottom: 2ex;">
<tr>
<td class="catbg"> &nbsp;'
$txt[102], '</td>
</tr>
<tr>
<td valign="middle" align="center" height="60">'
;

// Prepare all the javascript settings.
echo '
<div id="smfFadeScroller" style="width: 90%; padding: 2px;"><b>'
$context['news_lines'][0], '</b></div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
// The fading delay (in ms.)
var smfFadeDelay = '
, empty($settings['newsfader_time']) ? 5000 $settings['newsfader_time'], ';
// Fade from... what text color? To which background color?
var smfFadeFrom = {"r": 0, "g": 0, "b": 0}, smfFadeTo = {"r": 255, "g": 255, "b": 255};
// Surround each item with... anything special?
var smfFadeBefore = "<b>", smfFadeAfter = "</b>";

var foreColor, backEl, backColor;

if (typeof(document.getElementById(\'smfFadeScroller\').currentStyle) != "undefined")
{
foreColor = document.getElementById(\'smfFadeScroller\').currentStyle.color.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};

backEl = document.getElementById(\'smfFadeScroller\');
while (backEl.currentStyle.backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined")
backEl = backEl.parentNode;

backColor = backEl.currentStyle.backgroundColor.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeTo = {"r": eval("0x" + backColor[1]), "g": eval("0x" + backColor[2]), "b": eval("0x" + backColor[3])};
}
else if (typeof(window.opera) == "undefined" && typeof(document.defaultView) != "undefined")
{
foreColor = document.defaultView.getComputedStyle(document.getElementById(\'smfFadeScroller\'), null).color.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};

backEl = document.getElementById(\'smfFadeScroller\');
while (document.defaultView.getComputedStyle(backEl, null).backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined" && typeof(backEl.parentNode.tagName) != "undefined")
backEl = backEl.parentNode;

backColor = document.defaultView.getComputedStyle(backEl, null).backgroundColor.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeTo = {"r": parseInt(backColor[1]), "g": parseInt(backColor[2]), "b": parseInt(backColor[3])};
}

// List all the lines of the news for display.
var smfFadeContent = new Array(
"'
implode('",
"'
$context['fader_news_lines']), '"
);
// ]]></script>
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/fader.js"></script>
</td>
</tr>
</table>'
;
}

  
// display shoutbox
  
if (function_exists('sbox')) sbox();

/* Each category in categories is made up of:
id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
and boards. (see below.) */
$first true;
foreach ($context['categories'] as $category)
{

**
skipping down to recent topics/posts**

// Here's where the "Info Center" starts...
echo '<br />
<div class="tborder" '
$context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' '''>
<div class="catbg" style="padding: 6px; vertical-align: middle; text-align: center; ">
<a href="#" onclick="shrinkHeaderIC(!current_header_ic); return false;"><img id="upshrink_ic" src="'
$settings['images_url'], '/', empty($options['collapse_header_ic']) ? 'collapse.gif' 'expand.gif''" alt="*" title="'$txt['upshrink_description'], '" style="margin-right: 2ex;" align="right" /></a>
'
$txt[685], '
</div>
<div id="upshrinkHeaderIC"'
, empty($options['collapse_header_ic']) ? '' ' style="display: none;"''>
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">'
;

// This is the "Recent Posts" bar.
if (!empty($settings['number_recent_posts']))
{
echo '
<tr>
<td class="titlebg" colspan="2">'
$txt[214], '</td>
</tr>
<tr>
<td class="windowbg" width="20" valign="middle" align="center">
<a href="'
$scripturl'?action=recent"><img src="'$settings['images_url'], '/post/xx.gif" alt="'$txt[214], '" /></a>
</td>
<td class="windowbg2">'
;

// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<b><a href="'
$scripturl'?action=recent">'$txt[214], '</a></b>
<div class="smalltext">
'
$txt[234], ' &quot;'$context['latest_post']['link'], '&quot; '$txt[235], ' ('$context['latest_post']['time'], ')<br />
</div>'
;
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '<marquee  behavior="scroll" direction="up" height="130" scrolldelay="75" scrollamount="2" onmouseover="this.stop()" onmouseout="this.start()"> 
<table width="100%" border="0">'
;
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td align="left" valign="top" nowrap="nowrap">['
$post['board']['link'], ']</td>
<td valign="top">'
$post['link'], ' '$txt[525], ' '$post['poster']['link'], '</td>
<td align="left" valign="top" nowrap="nowrap">'
$post['time'], '</td>
</tr>'
;
echo '
</table></marquee>'
;
}
echo '
</td>
</tr>'
;
}

mzeblu

I've tried moving the recent posts to the top of boardindex.template.php and index.template.php

When viewing in Firefox everything looks fine, but when I view in IE7, the recent posts appear to the far right as pictured below.

Can anyone help?


Jade Elizabeth

THIS IS SO AWESOME!!


thanks for making this!!!!!
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

perro88

#55
echo '<marquee  behavior="scroll" direction="up" height="200px" scrolldelay=" 10" scrollamount=" 1" onmouseover="this.stop()" onmouseout="this.start()">';
I use this code in a tp recent topics blocks and it scrolls ok etc, but when loading on firefox, for example if I have 10 topics to show there it shows all the topics in a row till it finish loading and then turn it to the usual size(also seems to take a bit longer than usual to load). on IE seems to work fine.  There's something that knows why this happen?(if you wanna check what I'm saying and you have firefox, check the right side block at www.bittechzone.com)
I know I shouldn't posted here but I saw that talk about problems in diferent browsers so I posted  :P

Fiery

Was everyone able to get their problems resolved?

If not please repost your problem as there are many different posts in here about different problems form different people... its getting a bit confusing ;)

kizley

can this work in smf 1.14 default..?

Jade Elizabeth

Yes it works with 1.1.4. I have it on mine :).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

etiobaba

I want to have a Manual featured post on my Home page. That is to say, I don't want all recent post to appear on my home page. I want to be a ble to add links to my home page like what is on hxxp:www.naijahotjobs.com [nonactive]. If you can help please reply this post!
www.mynaijajobs,com

Advertisement: