Hello Guest
No Avatar
Sign In to Remove
Posts: 
17
Reputation: 
5
Posted: May 1, 2011, 12:41 PM
  • Group: Member
So I have the Recent Topics set up and working. But before I log in it says "Array" im guessing there are no new Topics. Is there away to make it say instead of Array say = "No new Threads".

Posts: 
400
Reputation: 
20
Posted: May 2, 2011, 8:35 AM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
This should work  ;) - Come back if you have any issues

FIND:
Code: [Select]
foreach ($posts as $post)
echo '
<tr>
<td valign="top">
<div class="banner_area_recent_topics_topic_title"><a class="banner_area_recent_topics_topic_title" href="', $post['href'], '">', $post['subject'], '</a></div>
</td>
<td align="right" nowrap="nowrap" class="banner_area_recent_topics_time">
&nbsp<small>', $txt['by'], ' ', $post['poster']['link'], '</small>
<small>', $post['time'], '</small>
</td>
</tr>';

REPLACE:
Code: [Select]
foreach ($posts as $post)
{
if(!empty($posts))
{
echo '
<tr>
<td valign="top">
<div class="banner_area_recent_topics_topic_title"><a class="banner_area_recent_topics_topic_title" href="', $post['href'], '">', $post['subject'], '</a></div>
</td>
<td align="right" nowrap="nowrap" class="banner_area_recent_topics_time">
&nbsp<small>', $txt['by'], ' ', $post['poster']['link'], '</small>
<small>', $post['time'], '</small>
</td>
</tr>';
}
else
{
<tr>
<td valign="top">
No new Threads
</td>
</tr>
}
}
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
17
Reputation: 
5
Posted: May 2, 2011, 9:50 AM
  • Group: Member
Code: [Select]
The file you tried to save generated the following error:
Parse error: syntax error, unexpected '<' in index.template.php on line 681
Posts: 
400
Reputation: 
20
Posted: May 3, 2011, 2:03 AM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
woops forgot the echo sorry  ;D

REPLACE:
Code: [Select]
foreach ($posts as $post)
{
if(!empty($posts))
{
echo '
<tr>
<td valign="top">
<div class="banner_area_recent_topics_topic_title"><a class="banner_area_recent_topics_topic_title" href="', $post['href'], '">', $post['subject'], '</a></div>
</td>
<td align="right" nowrap="nowrap" class="banner_area_recent_topics_time">
&nbsp<small>', $txt['by'], ' ', $post['poster']['link'], '</small>
<small>', $post['time'], '</small>
</td>
</tr>';
}
else
{
echo '
<tr>
<td valign="top">
No new Threads
</td>
</tr>
';
}
}
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
17
Reputation: 
5
Posted: May 3, 2011, 3:59 AM
  • Group: Member
Still says Array.
Posts: 
400
Reputation: 
20
Posted: May 3, 2011, 4:24 AM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
What version of smf?

Are there any posts to begin with?

Is this only happening before you log in?
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
17
Reputation: 
5
Posted: May 3, 2011, 5:50 AM
  • Group: Member
Forum version: SMF 2.0 RC5.

I have it set up so only a few boards can be viewed by guests, and yes there are some threads.

Its only happening before I log in.
Posts: 
400
Reputation: 
20
Posted: May 3, 2011, 9:51 AM  -- Last Edit: May 3, 2011, 9:56 AM by MLM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
Here is a pastebin of the index.template.php but try to do the edits yourself  :D
http://pastebin.com/B3sSS2sQ

Alright this should do the trick. Just tested as well...

REDO THE EDIT AS NORMAL - http://custom.simplemachines.org/themes/index.php?lemma=2343


then do this...

FIND:
Code: [Select]
// Just return it.
if ($output_method != 'echo' || empty($posts))
return $posts;

echo '
<table border="0" class="ssi_table recent_topics_ssi_table">';
foreach ($posts as $post)
echo '
<tr>
<td valign="top">
<div class="banner_area_recent_topics_topic_title"><a class="banner_area_recent_topics_topic_title" href="', $post['href'], '">', $post['subject'], '</a></div>
</td>
<td align="right" nowrap="nowrap" class="banner_area_recent_topics_time">
&nbsp<small>', $txt['by'], ' ', $post['poster']['link'], '</small>
<small>', $post['time'], '</small>
</td>
</tr>';
echo '
</table>';

echo '
<center>
<div class="recent_posts_link_banner_area">
<a href="', $scripturl ,'?action=recent"><small>::ALL RECENT POSTS::</small></a>
</div>
</center>
';

REPLACE:
Code: [Select]
// vp
$stop_the_recent_posts_in_its_tracks = false;
if(!empty($posts))
{
$stop_the_recent_posts_in_its_tracks = true;
}

if($stop_the_recent_posts_in_its_tracks == true)
{

// Just return it.
if ($output_method != 'echo' || empty($posts))
return $posts;

echo '
<table border="0" class="ssi_table recent_topics_ssi_table">';
foreach ($posts as $post)
{
echo '
<tr>
<td valign="top">
<div class="banner_area_recent_topics_topic_title"><a class="banner_area_recent_topics_topic_title" href="', $post['href'], '">', $post['subject'], '</a></div>
</td>
<td align="right" nowrap="nowrap" class="banner_area_recent_topics_time">
&nbsp<small>', $txt['by'], ' ', $post['poster']['link'], '</small>
<small>', $post['time'], '</small>
</td>
</tr>';


}



echo '
</table>';

echo '
<center>
<div class="recent_posts_link_banner_area">
<a href="', $scripturl ,'?action=recent"><small>::ALL RECENT POSTS::</small></a>
</div>
</center>
';
}
else
{
echo '
<table border="0" class="ssi_table recent_topics_ssi_table">
<tr>
<td valign="top">
No new Threads
</td>
</tr>
</table>
';
}
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
17
Reputation: 
5
Posted: May 3, 2011, 9:58 AM
  • Group: Member
Thanks!
Posts: 
17
Reputation: 
5
Posted: May 3, 2011, 10:08 AM
  • Group: Member
You should make it default, so other people dont have problems! I have mine saying "Sorry, no new Threads" and have it centered. "http://www.forum.hostellroleplay.net/index.php"
Posts: 
4
Reputation: 
0
Posted: May 4, 2011, 12:18 AM
  • Group: Member
Dang, I modified the code and my board isn't showing the Recent Topics mod.  It doesn't even say "No new topics."  Any ideas what I might be doing wrong?

Here is what I have (this board won't let me post all the code, so here it is in a txt file):

http://www.braineurysm.com/smf_code.txt


Thank you.
Posts: 
400
Reputation: 
20
Posted: May 4, 2011, 2:24 AM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
You probably just messed up the edits....

Try this one:
http://pastebin.com/VrirRzh4
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
400
Reputation: 
20
Posted: May 4, 2011, 2:25 AM  -- Last Edit: May 4, 2011, 2:51 AM by MLM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
You should make it default, so other people dont have problems! I have mine saying "Sorry, no new Threads" and have it centered. "http://www.forum.hostellroleplay.net/index.php"

edit: just remembered that i can not since the featured work area uses a database call :(
<3 Nerve, Sk8, Labradoodle, Austin
Posts: 
4
Reputation: 
0
Posted: May 4, 2011, 2:41 AM
  • Group: Member
You probably just messed up the edits....

Try this one:
http://pastebin.com/VrirRzh4

Thank you. I added the file from pastebin.  I got the index to show "No new threads" but not actually show any new threads.  Any ideas?
Posts: 
400
Reputation: 
20
Posted: May 4, 2011, 2:51 AM
  • Group: Administrator
  • AIM: mlm@visualpulse.net
  • deviantART: MadLittleMods
  • Photobucket: MadLittleMods
Thank you. I added the file from pastebin.  I got the index to show "No new threads" but not actually show any new threads.  Any ideas?

What version of smf?

When does it happen?
<3 Nerve, Sk8, Labradoodle, Austin
anything