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

Recent

Welcome to TinyPortal. Please login or sign up.

May 05, 2024, 06:55:21 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,178
  • Total Topics: 21,220
  • Online today: 274
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 265
  • Total: 265

'In The News' - Block [Posts from a specific board]

Started by akulion, August 19, 2006, 04:05:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IchBin

Find:
ORDER BY t.ID_LAST_MSG DESC

Change to:
ORDER BY t.ID_LAST_MSG ASC

durgia


Dianna

#32
TP: v1.0.5. beta 1
SMF: v1.1.7
www.schreeandbaby.com/updates

Hi guys! This is one of the exact snippets I was looking for to show latest news from one of the forum categories. I have something weird happening. I've indicated that I wanted the last 8 posts to show. It's only showing the last 2 posts.  It's the 2nd block on the right side on my site.

Here's my coding that I tweaked to fit my site's design. I'm wondering if there is some ROW height that I'm missing either in this coding or in the SSI coding that I was instructed to include in the ssi.php in the root directory.

Here's my edited php block, anything you guys can see?:

echo' <div align="center">
<table border="0" width="140" id="table1">
<tr>
<td><font face="Verdana">';

global $context, $scripturl;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$result=ssi_recentTopicsINC(8,array(5.0),'return');
foreach($result as $my){

  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];
  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
echo '
                                                <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['newtime'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<hr>';
}
echo '</span>';

echo'   <br></font><font size="1" face="Verdana">Latest On Your Mind News <a href="http://www.schreeandbaby.com/updates/index.php?board=5.0">From the OYM News Section</a></font></td>
</tr>
</table>
</div>';




ZarPrime

Dianna,

One of our coders will probably have to take a look at this when they are on.  I can do some basic things with php but I'm not that great with it.

In the meantime, can you amend your post above to place the code inside of code tags.  The reason for this is because when it is place like you have it, some code is sometimes missed.  To do that, Paste your code into your message and highlight the code.  Then select the code button (the one with the # on it).

After you do this, it will look more like this ...

Your Code here


Thanks,
ZarPrime

Dianna

Awww, thanks ZarPrime, my bad, I just fixed it and put the code into the box.

ZarPrime

Diana,

I notice that none of our coders has responded here yet, so I will mention it to them.  As I said, I'm not too good with this stuff but I looked through your code to make sure you didn't have any open tags or anything but nothing jumped out at me.

In the meantime, assuming you made the changes to the ssi file specified in the first post in this topic, the only thing you might try is to change ...

$result=ssi_recentTopicsINC(8,array(5.0),'return');

to

$result=ssi_recentTopicsINC(8,array(5),'return');

and see if that makes a difference.

ZarPrime

JPDeni

Sorry I didn't get here sooner. I was asleep. :)

I reformatted the code so I could follow it a little easier. I noticed that you had your opening span tag inside the "foreach" loop, but the closing tag outside of it. I don't know if that would make a difference or not. Also, ZarPrime's suggestion to use the number without the ".0" is good.


global $context, $scripturl;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$result=ssi_recentTopicsINC(8,array(5),'return');

echo' <div align="center">
<table border="0" width="140" id="table1">
  <tr>
    <td><font face="Verdana">';

foreach($result as $my){
echo "$bullet";
echo '<span class="smalltext">'.$my['link'];
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
echo '<a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['newtime'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<hr>';
echo '</span>';
}

echo'   <br></font><font size="1" face="Verdana">Latest On Your Mind News <a href="http://www.schreeandbaby.com/updates/index.php?board=5.0">From the OYM News Section</a></font></td>
</tr>
</table>
</div>';


Otherwise, I don't see a problem with the code.

I couldn't access the page. Looks like it's been moved. The only other possibility I can think of for it only showing 2 posts is that maybe you only have 2 topics. Realize that this is a recent topics function, so it will only show once for each topic.