Customizing SMF > SMF Coding Discussion
SSI recentTopics... how to show just the topic name?
distante:
I'm thinking that the only way to show JUST the topic name without the board and poster name when I'm using the recentTopics SSI function is to made a new function...
but maybe I'm wrong, can anyone point me in the rigth direction?
Thanks!
Ricky.:
You can do as follow:
--- Code: ---$temp = ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'array');
--- End code ---
Now $temp will hold all stuff in array, you can choose what you want to display and how to display .
distante:
Thank you ricky for your help
I managed to show the topics in this way (looking in the final example in the ssi_examples page)
--- Code: ---<?php
require("../foro/SSI.php");
$topics = ssi_recentTopics(5, null, null, 'array');
foreach ($topics as $topic) {
echo ' <li><a href=\"', $topic['href'], '\">', $topic['subject'], '</a></li>';
}
unset($topics); ?>
--- End code ---
But for some reason the last topic isn't showed, look:
I don't understand why :\
Ricky.:
Not sure, may be you can see print_r($topics) ; to verify what you are receiving.
Also, you don't need to escape double quote if used inside single quotes in echo ..
ie.
--- Code: ---echo ' <li><a href="', $topic['href'], '">', $topic['subject'], '</a></li>';
--- End code ---
distante:
Oh you're rigth, I just copied the example in the ssi_examples with the escaped "
well I did the print_r and the subject of the last topic is empty... I don't know why
--- Quote ---Array
(
[board] => Array
(
[id] => 33
[name] => Foro Libre
[href] => http://www.musicaysonido.com/foro/index.php?board=33.0
[link] => Foro Libre
)
[topic] => 296
[poster] => Array
(
[id] => 39
[name] => distante
[href] => http://www.musicaysonido.com/foro/index.php?action=profile;u=39
[link] => distante
)
[subject] =>
[replies] => 0
[views] => 27
[short_subject] =>
[preview] => "Dynamic Range Day 2012"
Charles Dye, Allen Wagner and Ian Shepherd (Ian Shepherd es uno, si
[time] => Ayer a las 04:09 pm
[timestamp] => 1331932165
[href] => http://www.musicaysonido.com/foro/index.php?topic=296.msg1414;topicseen#new
[link] =>
[new] => 1
[is_new] =>
[new_from] => 0
[icon] =>
)
1
Array
(
[board] => Array
(
[id] => 40
[name] => Masterizacion
[href] => http://www.musicaysonido.com/foro/index.php?board=40.0
[link] => Masterizacion
)
[topic] => 279
[poster] => Array
(
[id] => 39
[name] => distante
[href] => http://www.musicaysonido.com/foro/index.php?action=profile;u=39
[link] => distante
)
[subject] => "Mastering for Itunes" Confundiendo a los escuchas....
[replies] => 3
[views] => 122
[short_subject] => "Mastering for Itunes" Co...
[preview] => Cita de: acousrama en Marzo 02 del 2012, 05:23pmBandcamp.com te da la oportunidad de descargar tus compras en varios formatos ...
[time] => Marzo 02 del 2012, 06:37pm
[timestamp] => 1330731438
[href] => http://www.musicaysonido.com/foro/index.php?topic=279.msg1385;topicseen#new
[link] => "Mastering for Itunes" Confundiendo a los escuchas....
[new] => 1
[is_new] =>
.
.
.
--- End quote ---
I performed a database maintenance in the admin panel, empty the cache, look for errors and still doesn't work =\
I even tried to fix the database in my Cpanel (but no errors where found)
If I use only the ssi_recentTopics() function, it shows me everything except the last topic title...
Navigation
[0] Message Index
[#] Next page
Go to full version