TinyPortal

Development => Block Codes => Topic started by: OIDanTheManIO on November 14, 2005, 03:45:36 AM

Title: Topics in board displayed in block...
Post by: OIDanTheManIO on November 14, 2005, 03:45:36 AM
How do I make the topics from a board (with a limit, of course) display in a blocK?  For example, just a small list of topic names that link to the topic.  Oh say, the five most recently created topics for board 5.
Title: Re: Topics in board displayed in block...
Post by: IchBin on November 14, 2005, 07:00:58 AM
I think this is what you're looking for.

http://www.tinyportal.net/smf/index.php?topic=596.0
Title: Re: Topics in board displayed in block...
Post by: OIDanTheManIO on November 14, 2005, 03:28:09 PM
Quote from: IchBinÃ,â,,¢ on November 14, 2005, 07:00:58 AM
I think this is what you're looking for.

http://www.tinyportal.net/smf/index.php?topic=596.0

That's too large, I'm afraid.  I only want text links...is that possible?
Title: Re: Topics in board displayed in block...
Post by: OIDanTheManIO on November 14, 2005, 03:34:51 PM
Hmm, I just now noticed the RSS Feed box...that would work.

EDIT:  Or not :P.  No feed is displayed after I configure it.
Title: Re: Topics in board displayed in block...
Post by: iowamf on November 14, 2005, 06:46:26 PM
I'm doing this in a column block ... the only difference is that I rewrote the ssi_recentTopics call to accept a board value to include - ie, the "array(9)" parameter,   in the default ssi_recentTopics command it requires you to provide a list of boards to exclude boards (difficult to maintain if you are going to be adding boards).

global $context, $scripturl;
$result=ssi_recentTopics_hack(10,array(9),'return');
foreach($result as $my){
  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 '<br>';
}
echo '</span>';


Title: Re: Topics in board displayed in block...
Post by: OIDanTheManIO on November 14, 2005, 09:06:10 PM
Quote from: iowamf on November 14, 2005, 06:46:26 PM
I'm doing this in a column block ... the only difference is that I rewrote the ssi_recentTopics call to accept a board value to include - ie, the "array(9)" parameter,   in the default ssi_recentTopics command it requires you to provide a list of boards to exclude boards (difficult to maintain if you are going to be adding boards).

global $context, $scripturl;
$result=ssi_recentTopics_hack(10,array(9),'return');
foreach($result as $my){
  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 '<br>';
}
echo '</span>';




Hmm, won't let me use that code in a PHP block.
Title: Re: Topics in board displayed in block...
Post by: iowamf on November 14, 2005, 09:27:17 PM
I'm a rookie - bled all over the keyboard with that one.
Perpaps try it in a PHP article and debug there?
Sorry I can't be of more help - just trying to help out where/when I can as this board has helped me.
The output of that looks like the 2nd box (note, I stripped the time out).

Title: Re: Topics in board displayed in block...
Post by: snork13 on November 15, 2005, 02:01:16 AM
Quote from: iowamf on November 14, 2005, 09:27:17 PM
I'm a rookie - bled all over the keyboard with that one.
Perpaps try it in a PHP article and debug there?
Sorry I can't be of more help - just trying to help out where/when I can as this board has helped me.
The output of that looks like the 2nd box (note, I stripped the time out).



i like to see the hacked version if possible?

thanks

snork
Title: Re: Topics in board displayed in block...
Post by: iowamf on November 15, 2005, 03:10:41 AM
Not sure I understand your question - I'm calling the code I posted a "hack" as it has limited usage ... but it does produce the output shown in the attachment and my error log isn't going too crazy.
Title: Re: Topics in board displayed in block...
Post by: snork13 on November 15, 2005, 03:24:57 AM
Quote from: iowamf on November 15, 2005, 03:10:41 AM
Not sure I understand your question - I'm calling the code I posted a "hack" as it has limited usage ... but it does produce the output shown in the attachment and my error log isn't going too crazy.



right, i assume you reworked the original code to work with the block, i was interested in see what you excluded
Title: Re: Topics in board displayed in block...
Post by: criminalmind on February 26, 2006, 04:47:41 PM
Iowamf, what is the code for the modified ssi_recentTopics_hack function?
Title: Re: Topics in board displayed in block...
Post by: crip on February 26, 2006, 06:07:11 PM
ssi_recentTopics();

I think?
Title: Re: Topics in board displayed in block...
Post by: IchBin on February 26, 2006, 06:46:34 PM
Depends on what you want criminal.
Title: Re: Topics in board displayed in block...
Post by: falguni1 on November 30, 2007, 02:13:34 PM
this code is  not working only what to do

I want to display topics from board 39.0 only  :-\


global $context, $scripturl;
$result=ssi_ssi_recentTopics(10,array(39.0),'return');
foreach($result as $my){
  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 '<br>';
}
echo '</span>';


Title: Re: Topics in board displayed in block...
Post by: IchBin on November 30, 2007, 07:19:11 PM
take out the .0 Only use the number not the decimal number.
Title: Re: Topics in board displayed in block...
Post by: falguni1 on December 01, 2007, 05:35:29 AM
inside a scriptbox it looks like

(https://www.tinyportal.net/index.php?action=dlattach;topic=1365.0;attach=12958;image)
Title: Re: Topics in board displayed in block...
Post by: falguni1 on December 01, 2007, 05:42:16 AM
inside a phpbox it looks like this


(https://www.tinyportal.net/index.php?action=dlattach;topic=1365.0;attach=12960;image)
Title: Re: Topics in board displayed in block...
Post by: IchBin on December 01, 2007, 06:07:07 AM
Well it goes in a PHP box. If you are using the <?php tags in your code please remove them. If not, please post exactly what you are putting into your PHPbox.
Title: Re: Topics in board displayed in block...
Post by: falguni1 on December 01, 2007, 06:40:24 AM


global $context, $scripturl;
$result=ssi_ssi_recentTopics(10,array(39.0),'return');
foreach($result as $my){
  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 '<br>';
}
echo '</span>';





I am using this code in php box
Title: Re: Topics in board displayed in block...
Post by: IchBin on December 01, 2007, 07:22:50 AM
This line:
$result=ssi_ssi_recentTopics(10,array(39.0),'return');

Needs to be this:
$result=ssi_recentTopics(10,array(39.0),'return');
Title: Re: Topics in board displayed in block...
Post by: falguni1 on December 01, 2007, 07:40:24 AM
it gives some syntax error it says

Parse error: syntax error, unexpected T_STRING in /home/omsitesc/public_html/omsaigan/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 11

first the error was on line 1 now it is resolved
now it shows the next error on line 11