News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SSI recentTopics... how to show just the topic name?

Started by distante, March 17, 2012, 12:48:35 AM

Previous topic - Next topic

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:

$temp = ssi_recentTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'array');
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)

<?php 
require("../foro/SSI.php");

$topics ssi_recentTopics(5nullnull'array'); 
foreach (
$topics as $topic) { 
echo 
' <li><a href=\"'$topic['href'], '\">'$topic['subject'], '</a></li>'
}
 unset(
$topics); ?>


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.
echo ' <li><a href="', $topic['href'], '">', $topic['subject'], '</a></li>';

distante

#4
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] =>
.
.
.

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...

IchBin™

Maybe it has something to do with the special characters in the title.

Also, where are your ul tags for your list?
IchBin™        TinyPortal

Ricky.

Can you change name of that topic or post new topic after that , if its again that topic missing then must be something as IchBin suggested.

distante

The ul tags where outside that php code.

I create a new topic con the accent vocals (á, í é) and yes, that topic doesn't get show either. when I changed that title to something with out especial chars ("range") the topic was showed.

Since my forum is a spanish based site, I or some other users will created titles with especial chars. How can I fix this so the title can be showed?

Thanks to both :)

Ricky.

Try Admin --> Maintenance --> Database --> Convert HTML-entities to UTF-8 characters , also we can set SMF to use utf-8 default character set.. just not able to recall where to do it ?.. though when you install forum it asks you to do so.

distante

I already have my forum with utf-8 as charset
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

And I use spanish_es-utf-8 language file, in the forum it self the topic is showed without problems : http://www.musicaysonido.com/foro/foro-libre/16-de-marzo-dia-del-rango-dinamico/

and in the ssi_examples page, the topic is being showed also
http://www.musicaysonido.com/foro/ssi_examples.php

I don't understand :(

distante

well I give up!!!!!

Something with the joomla config (where I'm positioning the recent topics() ) is messing with the title, so, I created a hole new php page and put it in an iframe...

Advertisement: