SSI Topic and Replies

Started by tyty1234, April 06, 2007, 07:35:13 AM

Previous topic - Next topic

AmaZulu

Firstly I'd just like to thank you for this mod, I am using it to good effect on a couple of my sites.

Secondly, I think I have found a bug or something that I am unable to fix (I'm still very new to PHP). If you go here: http://www.thephotojournals.com/GeoffCronje/SeaPhoenix_4.php you will see at the bottom of the page, where I am bringing in replies to the article from a linked forum topic that any replies by Guests have been given the name of the last guest to leave a comment.

Is there anyway to fix this? If its a mission I would be happy if it shows any posts by Guests simply as "by Guest" rather than the name they left.

MPT.

How to use a Board as ID instead of a topic as ID?

Is that possible?

MPT.

Quote from: MPT. on August 03, 2007, 02:04:09 PM
How to use a Board as ID instead of a topic as ID?

Is that possible?
Anyone, please? :(

Flying Drupalist

You may use SSI boardnews which takes from boards...

MPT.

But I want to show the replies too, that's the point..

MPT.

*Buummpp..

Quote from: MPT. on August 03, 2007, 02:04:09 PM
How to use a Board as ID instead of a topic as ID?

Is that possible?

aldo

#26
This mod is very cool! You can make pages on your site editable and make your site seem very interactive

hoochie coochie man

is there any manuel install?  :(

Wal-Mart Security

#28
I'd like to use this mod for the flash gallery at insanereality.com, only I've come up with a few problems.  I have not been able to get rid of the first post using the $start variable.  The first post in each thread made for the flash movies is an exact copy of the description already listed on the flash gallery.  I'll continue to play around with it and if I find a fix or find out what I'm doing wrong I'll post it here.  :)

[edit]
Nevermind, I just commented out the following:

/*echo '
<div>
<a href="', $return['href'], '">', $return['icon'], '<b>', $return['subject'], '</b></a>
<div class="smaller">', $return['time'], ' ', $txt[525], ' ', $return['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $return['body'], '</div>

', $return['locked'] ? '' : $return['comment_link'], '<br /><br />
</div>

<h2>', $txt['ssiTopic_replies'], ':</h2>
', $return['pageindex'];
*/
Achilleus Technologies
Ace Gaming Syndicate
PART TIME SMF CHARTER MEMBER 4LIFE

SMF slays phpbb, puts it in an IPB coffin, and buries them both with the ashes of vBulletin.

Badmovies.org

Quote from: AmaZulu on June 26, 2007, 01:20:59 PM
Secondly, I think I have found a bug or something that I am unable to fix (I'm still very new to PHP). If you go here: http://www.thephotojournals.com/GeoffCronje/SeaPhoenix_4.php [nofollow] you will see at the bottom of the page, where I am bringing in replies to the article from a linked forum topic that any replies by Guests have been given the name of the last guest to leave a comment.

Is there anyway to fix this? If its a mission I would be happy if it shows any posts by Guests simply as "by Guest" rather than the name they left.


This mod is a great idea.  I hope that it is pushed into the main release as a standard feature.

I saw the same issue you did with the last guest's name being carried along.  Look in SSI.php and find this line:

'poster' => &$memberContext[$row['ID_MEMBER']],

take out the "&" and make it:

'poster' => $memberContext[$row['ID_MEMBER']],
Andrew Borntreger
Champion of Cinematic Disasters
The Bad Movie Website
www.badmovies.org

growwl

is this mod still being developed?
how about a bit of customization/css styling of the output?
and how about attachments?

fangweile

would it be possible to display the recent replies there??

ryanhellyer

Thanks for the mod, it works great :)

Joker Grafix

I was just wondering if this will work on 1.1.4? I'd like to be able to use this so that I may be able to use the simple blog also.

ryanhellyer

Quote from: Joker Grafix on April 04, 2008, 04:34:23 PM
I was just wondering if this will work on 1.1.4? I'd like to be able to use this so that I may be able to use the simple blog also.

I've used it with SMF 1.1.4, it worked fine.

mark7144

Quote from: Daniel15 on April 09, 2007, 12:05:22 AM
QuoteCool mod! I've put it in but I was wondering how the best way of intergrating this with the board news would be? I'm a novice when it comes to this but instead of clicking the news link which takes you to the actual forum topic, could it take you to another page on your site utilizing this mod?
Alright, let's see :)
The page you want the news on, put something like this:

<?php
// Require SSI
require('SSI.php');

// Some variables. Change these if you like :)
$board 1// Board to use
$number 10// Number of items to return
$length 300// Return this number of characters, followed by "...".

// Get the news
$news_items ssi_boardNews($board$numbernull$length'array'); // board, number of items, item to start at, number of characters, output method
// Loop through all items
foreach ($news_items as $news)
{
// Output this item
echo '
<div>
<a href="viewnews.php?topic='
$news['id'], '">'$news['icon'], ' <b>'$news['subject'], '</b></a>
<div class="smaller">'
$news['time'], ' by '$news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">'
$news['body'], '</div>

'
$news['link'], $news['locked'] ? '' ' | ' $news['comment_link'], '
</div>'
;

// If it isn't the last item, output a <hr />
if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0;" width="100%" />'
;
}
?>



The most important things are:
1) The "array" return method is used (so we can customise the output)
2) Instead of linking to the topic page (that's $news['href']), we link to a file called "viewnews.php"

Now, in viewnews.php, add something like:

<?php
// Require SSI
require('SSI.php');

// No topic? That's bad
if (empty($_REQUEST['topic']))
die('No topic passed');

// Get this topic and its replies
$return ssi_topic($_REQUEST['topic'], nullnull'array'); // Setting something to 'null' will use the default value.

// Output the first post
echo '
<div>
<a href="'
$return['href'], '">'$return['icon'], '<b>'$return['subject'], '</b></a>
<div class="smaller">'
$return['time'], ' by '$return['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">'
$return['body'], '</div>

'
$return['locked'] ? '' $return['comment_link'], '<br /><br />
</div>

<h2>'
$txt['ssiTopic_replies'], ':</h2>
'
$return['pageindex'];

// Loop through each post
foreach ($return['replies'] as $post)
{
echo '
<div>
<a href="'
$post['href'], '">'$post['icon'], ' <b>'$post['subject'], '</b></a>
<div class="smaller">'
$txt['ssiTopic_reply'], ' '$post['number'], ': '$post['time'], ' by '$post['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">'
$post['body'], '</div>
</div>'
;

// The last post? Let's put the page numbers
if ($post['is_last'])
echo '
'
$return['pageindex'];
else
echo '
<hr style="margin: 2ex 0;" width="100%" />'
;

?>


I've used the "array" return type because this allows you to customise the output however you want :). If you want it to only show replies (and not the topic itself), remove the bit that outputs the topic (the // Output the first post bit).

QuoteAlso, I liked the page function and I was wondering how I could get that on my news page also?
Ah, that's SMF in-built page number thingy :D.
constructPageIndex is responsible for doing that. In this mod, the line that gets all the page numbers is:

'pageindex' => constructPageIndex('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?start=%d', $start, $row['numReplies'], $num_replies, true),

Basically, you pass the base URL (with %d to tell it where the number should go), the position to start at, the number of total replies, and the number of replies per page, and it returns a nicely formatted list of page numbers.

I wish I knew about constructPageIndex() sooner - I only discovered it recently. Before that, I spent time writing my own page number functions to duplicate SMF's ones :P :o.

If you need any help adding the page numbers to something, please feel free to ask :)

news.php is working, you can see it here. However, when you click on a topic it simply loads up a blank page yet I did copy and paste your viewnews.php code over.

Joker Grafix

Thanks Ryan, I'll test it out more.

jankariwo

I installed ok but the "use this board as a blog" in my blog boards does not stay ticked so the blog tab is empty. what to do ?

MoreBloodWine

This still in production ?
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits



Advertisement: