SSI Topics and Replies
Original Author: Daniel15 (http://wwww.simplemachines.org/community/index.php?action=profile;u=9547)
Currently Developed by: tyty1234 (http://www.simplemachines.org/community/index.php?action=profile;u=159909)
Current Version: 2.0
Compatible With: SMF 2.0
Download (http://custom.simplemachines.org/mods/index.php?mod=751)
Summary
This mod adds a new SSI function that allows you to grab a topic and its replies.
Usage
Basic usage:
<?php ssi_topic(int $topic, int $num_replies); ?>
$topic - The topic id for the topic you want to grab.
$num_replies - The number of replies you would like to show (provides a "more replies" link if there are more comments than the amount you limit).
Please visit the tytyweb.net (http://www.tytyweb.net/forum/mod-support/ssi-topics-and-replies/) for advanced usage.
Installation
This mod should be installed using the Package Manager. No manual edits should be necessary, but if it comes to that resort, please use the Package Parser (http://www.tytyweb.net/smf/package-parser/).
Changelog
What's new in this version?
Released for SMF 2.0
Dropped SMF 1.1.x compatibility.
Full re-write of mod.
Ability to grab attachments, and use of negative offsets in $start variable to get last # of replies.
Replaced page index with a "more replies" link (customizable).
thanx man let understand some
u know that ssi function
<?php ssi_boardNews(); ?>
grabs the topics and number on comment on the topics only from the frist section in the frist catigory that was aproblem to me ...
so that mod u gave to.. gonna grab all new topics from all over the catigories of the whole forum or what ?
Quoteso that mod u gave to.. gonna grab all new topics from all over the catigories of the whole forum or what ?
No, this mod just grabs
one topic and all of its replies.
Quoteu know that ssi function
<?php ssi_boardNews(); ?>
grabs the topics and number on comment on the topics only from the frist section in the frist catigory that was aproblem to me ...
You can get the topics from another board with ssi_boardNews(), just pass it the board ID. On your forum index, if you go into the board, the URL will look a bit like:
index.php?board=
2The 2 is the board number. Then, you use the ssi_boardNews function like this:
<?php ssi_boardNews(2); ?>
thanx my hero
listen in the package-info.xml u didnt type any thing about the smf versions that mod should be in installed with ..
i tried to u use ur mod but the forum gave me the error that says that pakage doesnt fit the forum version
my forum is
SMF 1.1.2
now what ?.... i dont like to install mods manually.... plz tell me that it is ur fault and ur gonna fix it
Sorry about that, my computer seems to make corrupted ZIP files. I've uploaded a new package that should work. Please download it and tell me if it works for you :).
Quotelisten in the package-info.xml u didnt type any thing about the smf versions that mod should be in installed with
Yeah, I don't usually do that, as this should work for all current SMF versions
yah i can install it with no errors now but
i still confused about how to use it
can u show an example for dummies like me :P
u know eglish is not my 1st language and many ppl in this site dont speak english too
hey do me afav plzzz add this code in ur mod
its actually atranslation for ur mode in to arabic
Quote
<file name="$languagedir/Modifications.arabic.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[
// --- Begin modification - SSI Topic and Replies ---
$txt['ssiTopic_no_id'] = 'ssi_topic(): من فضلك اختار رقم الموضوع';
$txt['ssiTopic_notfound'] = 'الملف اذزى تحاول العثور عليه غير موجود او لايمكنك الحصول عليه';
$txt['ssiTopic_replies'] = 'الردود';
$txt['ssiTopic_reply'] = 'اضافة رد';
// --- End modification ---
]]></add>
</operation>
</file>
now u know why ian calling my self dummy
Quoteyah i can install it with no errors now but
i still confused about how to use it
Basically, you pass the function a topic ID, and it returns that topic, and the replies for it. You'd use this if you want to get a topic on your own PHP page.
A simple example can be seen on the ssi_examples.php page (yoursite.com/forum/ssi_examples.php).
And thanks for the translation; I'll add it soon :)
Cool 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? I'm sure it can be done, just wouldn't know where to start. Thanks in advance!
Also, I liked the page function and I was wondering how I could get that on my news page also? I tested it manually with the news and it works but when I tried to add it to the SSI.php page nothing would show up.
// The last post? Let's put the page numbers
if ($news['is_last'])
echo '
', $return['pageindex'];
else
echo '
<hr style="margin: 2ex 0;" width="100%" />';
Cheers!
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, $number, null, $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'], null, null, '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 (http://support.simplemachines.org/function_db/index.php?action=view_function;function=256) 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 :)
Hi, thanks my site is looking ace now! I didn't seem to understand how to add the page index on my main site to go through the pages of news. Also, the page index on the replies only links to one thread ID.
/ !!! Better way to do this?
'pageindex' => constructPageIndex('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?page=viewnews&topic=2026&start=%d', $start, $row['numReplies'], $num_replies, true),
'replies' => array(),
I tried changing 2026 to ', $news['id'], ' but I just got an error:
Warning: Division by zero in /home/content/B/l/a/Blackthorne519/html/forum/Sources/Subs.php on line 766
Warning: Division by zero in /home/content/B/l/a/Blackthorne519/html/forum/Sources/Subs.php on line 766
Warning: Division by zero in /home/content/B/l/a/Blackthorne519/html/forum/Sources/Subs.php on line 771
Warning: Division by zero in /home/content/B/l/a/Blackthorne519/html/forum/Sources/Subs.php on line 776
Warning: Division by zero in /home/content/B/l/a/Blackthorne519/html/forum/Sources/Subs.php on line 781
Warning: Division by zero in /home/content/B/l/a/Blackthorne519/html/forum/Sources/Subs.php on line 781
So apart from the scuffle with the pages, everything else is looking great! If you need any information I can send you some of my pages through PM?
EDIT Nevermind, I fixed the problem with the replies page. I just still can't get anything on my home page.
hello!
i think there should be an if-clause for the output of
<h2>', $txt['ssiTopic_replies'], ':</h2>
', $return['pageindex'];
when no reply exists...
Edit: i think there is also a bug:
if i set $num_replies to 0 i get following error:
Warning: Division by zero in \Sources\Subs.php on line 773
Warning: Division by zero in \Sources\Subs.php on line 773
Warning: Division by zero in Sources\Subs.php on line 778
Warning: Division by zero in \Sources\Subs.php on line 783
Warning: Division by zero in \Sources\Subs.php on line 788
Warning: Division by zero in \Sources\Subs.php on line 788
Hey Daniel, as usual great minds think alike.
I Have a similar mod released here (http://www.simplemachines.org/community/index.php?topic=161891.0)
If you want to adopt any of the code or features of my mod let me know I don't mind if you use any of my code/ideas.
Sounds like both our mods are headed in similar directions mine doesn't show replies tho which is deffinately a nice feature if that can turned on or off.
Anyway ill check back soon let me know what you're thoughts are maybe could just merge into one project that you or I (or both) maintain..
Doesn't matter who maintains the code to me really just as long as a project similar to our mods is kept alive for future versions of SMF.
Why doesn't this mod support attachments? Is that too hard to implement?
Yeah, the replies thing is a known bug... It does not check if you do not want the replies (number of replies = 0). I'll modify it in the future (when I get some spare time).
Quote from: Vandaahl on May 27, 2007, 08:52:50 AM
Why doesn't this mod support attachments? Is that too hard to implement?
This is only the first
beta version, and only has basic functionality at the moment. I'll work on it more when I have more spare time (all my stuff is done in my spare time, which is very limited at the moment).
Quote from: Daniel15 link=topic=162958.msg1107539#msg1107539
Quote from: Vandaahl on May 27, 2007, 08:52:50 AM
Why doesn't this mod support attachments? Is that too hard to implement?
This is only the first beta version, and only has basic functionality at the moment. I'll work on it more when I have more spare time (all my stuff is done in my spare time, which is very limited at the moment).
Alright, keep up the good work ;)
Quote
Yeah, the replies thing is a known bug... It does not check if you do not want the replies (number of replies = 0). I'll modify it in the future (when I get some spare time).
Good to hear, would you think about adding support for an "extra" variable possibly?
My mod which is similar to this I use a spare value $link as an extra for anything additional I may want to do, it adds alot more flexibility to the array results..
It could be used for anything you're own array of values to be used in the output or whatever.
You could add in limit/length/link/other this way passed thru the extra value, to limit the results if you wanted to show a headline only and a readmore link as an example, then link to the full thing with replies and everything.
That's the main thing I would wish in you're mod if that's a possiblity =)
It may be benifitial if you wanted to keep developing our mods seperately, you never responded to that..
Not sure you're thoughts there..
My Ideal orgiastic combination of mods would possibly be:
ssi_boardNews to grab everything in a specific forum in an array, output links to see the specific stories which links over to either of our mods.
Using either of our mods(or both), the results could just be a larger headline or like the first page or something whatever, then have it go thru displaying limited output for a while untill you reach the end at which point it would hit the end and display replies/comments etc..
Or actually possibly display replies/comments beneath the main post the whole time just limit it's output for headline/fullstory etc..
All thru that one extra field and some well thought out array usage etc.
That would basically generate links(boardNews) and have them link to content(either of our mods) in an extremely automatic and customizable fashion fairly easilly.
Sorry TestMonkey, I didn't have time to read your full post :-[. I'll read over it again when I have more spare time ;)
Does this allow you to reply to a topic without being redirected to the forum?
QuoteMy mod which is similar to this I use a spare value $link as an extra for anything additional I may want to do, it adds alot more flexibility to the array results..
So, what would $link actually do?
QuoteIt may be benifitial if you wanted to keep developing our mods seperately, you never responded to that..
Not sure you're thoughts there..
I'm not sure what to do, actually (I didn't know about yours until you told me about it).
QuoteThat would basically generate links(boardNews) and have them link to content(either of our mods) in an extremely automatic and customizable fashion fairly easilly.
Have you seen my SMFBlog mod? It's kinda the same idea as what you're describing, except designed as a blog.
Quote from: 8105 on June 02, 2007, 01:23:31 AM
Does this allow you to reply to a topic without being redirected to the forum?
No, not at the moment. This mod is a SSI function for when you want to get a topic and its replies, to use it in some code. To see more about SMF's SSI functions, see ssi_examples.php in your SMF installation.
The $link value i pass a url usually you can see a basic example how I use it here:
http://www.irconcepts.net/article_example.phps
which produces:
http://www.irconcepts.net/article_example.php
More or less I just use it for anything extra, in this instance to pass a URL.. But it could be any data really or an array/multi demisnional array.. anything really could be used here a more proper name would be $extra or something honestly.
In reference to you're blog mod no I have not looked at the code itself.
Basically im trying to keep things as simple as possible, mods like these allow me to have full control over how I tie everything in as far as content goes, like using small tools/mods like boardnews and a mod like mine or yours etc. allows someone like me to have more control over the main pages of sites I run.
If you would contact me thru any of the means in my profile sometime may help us both out some in regards to these mods.
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.
How to use a Board as ID instead of a topic as ID?
Is that possible?
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? :(
You may use SSI boardnews which takes from boards...
But I want to show the replies too, that's the point..
*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?
This mod is very cool! You can make pages on your site editable and make your site seem very interactive
is there any manuel install? :(
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'];
*/
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 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']],
is this mod still being developed?
how about a bit of customization/css styling of the output?
and how about attachments?
would it be possible to display the recent replies there??
Thanks for the mod, it works great :)
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.
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.
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, $number, null, $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'], null, null, '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 (http://support.simplemachines.org/function_db/index.php?action=view_function;function=256) 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 (http://www.murraysworld.com/news.php). 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.
Thanks Ryan, I'll test it out more.
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 ?
This still in production ?
Awesome mod , simple but ice for Portals thanks
Hey everyone,
I have successfully taken over development of this mod, and will be releasing the mod for SMF 2.x probably by the end of the weekend, and if there were any bugs, please re-post them as this thread was outdated for more than 120 days.
I will be fixing up bugs in the SMF 1.1.x version, and will be releasing a 2.x version.
Thanks to everyone for continued support on this mod, and thanks to Daniel15 for originally developing this mod, and allowing me to continue development of this mod.
tyty1234
Mod has been updated to version 1.0 everyone! I suggest everyone updates their version, and please report any bugs!
Please read the posts in this topic about such features as replies with boardNews(), and having a different layout then the one that SSI function gives.
tyty1234
OK, I'm one of those people who will waste hours trying to get something to work before I break down and ask for help. I almost consider it a personal failing that I can't figure it out by myself. Well, my hours are up and I have other things to do, so here I am.
This looks like a great mod that should do exactly what I need, however, I can not get it to work. It has installed successfully in my SMF 1.1.10, on both my testbed and live forum (on different hosts, no less). However, the closest I can get to success using variants of ssi_examples.php is an include of my forum with the error message "ssi_topic(): Please specify a topic ID" in nice friendly letters. I have tried dozens of ways to pass a topic ID, some of which seem to make sense and some which are totally off-the-wall, with no joy.
What am I missing?
I'm no dumba$$, but PHP coding is still pretty new to me and I admit to knowing next to nothing in practical terms. FWIW, ssi_examples.php seems to work fine in unmodified form. I'm sure it's something stupidly simple that's wrong....
TIA
-Jim
The proper basic way to use it should be something like this.
<?php
// Get our SSI.
require('SSI.php');
// The topic id we would like to grab from.
$topic_id = 123;
// Return the topic and posts that follow.
ssi_topic($topic_id);
?>
If this is somewhat of what you have, can you show me the code you are using to achieve what it is you want to do?
Quote from: tyty1234 on October 10, 2009, 07:36:02 PM
The proper basic way to use it should be something like this.
<?php
// Get our SSI.
require('SSI.php');
// The topic id we would like to grab from.
$topic_id = 123;
// Return the topic and posts that follow.
ssi_topic($topic_id);
?>
If this is somewhat of what you have, can you show me the code you are using to achieve what it is you want to do?
Thanks for the reply. That is somewhat if what I have, or one of the dozens of variations that I tried. The code provided above results in a blank screen. No output. If I use the modded ssi_examples.php produced by the installation script, I get output up until the modded line, where everything just stops. You can - probably - see if if you look here: http://www.nebraskaghosts.org/smf/ssi_examples.php
(http://www.nebraskaghosts.org/smf/ssi_examples.php)
Here's my ssi_examples.php as modded my the installer, and further modded by moi to add the magic stuff that should point to a real topic in my forums:
<?php
require(dirname(__FILE__) . '/SSI.php');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> << :: SMF SSI.php 1.1 :: >> </title><?php
echo '
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/style.css" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js"></script>
<style type="text/css">
body
{
margin: 1ex;
}';
if ($context['browser']['needs_size_fix'])
echo '
@import(', $settings['default_theme_url'], '/fonts-compat.css);';
echo '
</style>';
?>
</head>
<body>
<h1>SMF SSI.php Functions</h1>
Current Version: 1.1<br />
<br />
This file is used to demonstrate the capabilities of SSI.php using PHP include functions.<br />
The examples show the include tag, then the results of it. Examples are separated by horizontal rules.<br />
<hr />
<br />
To use SSI.php in your page add at the very top of your page before the <html> tag on line 1:<br />
<div style="font-family: monospace;">
<?php require("<?php echo addslashes($user_info['is_admin'] ? realpath($boarddir . '/SSI.php') : 'SSI.php'); ?>"); ?>
</div>
<br />
<hr />
<h3>Recent Topics Function: <?php ssi_recentTopics(); ?></h3>
<?php ssi_recentTopics(); flush(); ?>
<hr />
<h3>Recent Posts Function: <?php ssi_recentPosts(); ?></h3>
<?php ssi_recentPosts(); flush(); ?>
<hr />
<h3>Recent Poll Function: <?php ssi_recentPoll(); ?></h3>
<?php ssi_recentPoll(); flush(); ?>
<hr />
<h3>Top Boards Function: <?php ssi_topBoards(); ?></h3>
<?php ssi_topBoards(); flush(); ?>
<hr />
<h3>Top Topics by View Function: <?php ssi_topTopicsViews(); ?></h3>
<?php ssi_topTopicsViews(); flush(); ?>
<hr />
<h3>Top Topics by Replies Function: <?php ssi_topTopicsReplies(); ?></h3>
<?php ssi_topTopicsReplies(); flush(); ?>
<hr />
<h3>Top Poll Function: <?php ssi_topPoll(); ?></h3>
<?php ssi_topPoll(); flush(); ?>
<hr />
<h3>Top Poster Function: <?php ssi_topPoster(); ?></h3>
<?php ssi_topPoster(); flush(); ?>
<hr />
<h3>Topic's Poll Function: <?php ssi_showPoll($topic); ?></h3>
<?php ssi_showPoll(); flush(); ?>
<hr />
<h3>Show a Topic and its Replies Function: <?php ssi_topic($topic_id); ?></h3>
<?php $topic_id=34; ssi_topic($topic_id); flush(); ?>
<hr />
<h3>Latest Member Function: <?php ssi_latestMember(); ?></h3>
<?php ssi_latestMember(); flush(); ?>
<hr />
<h3>Board Stats: <?php ssi_boardStats(); ?></h3>
<?php ssi_boardStats(); flush(); ?>
<hr />
<h3>Who's Online Function: <?php ssi_whosOnline(); ?></h3>
<?php ssi_whosOnline(); flush(); ?>
<hr />
<h3>Log Online Presence + Who's Online Function: <?php ssi_logOnline(); ?></h3>
<?php ssi_logOnline(); flush(); ?>
<hr />
<h3>Welcome Function: <?php ssi_welcome(); ?></h3>
<?php ssi_welcome(); flush(); ?>
<hr />
<h3>News Function: <?php ssi_news(); ?></h3>
<?php ssi_news(); flush(); ?>
<hr />
<h3>Board News Function: <?php ssi_boardNews(); ?></h3>
<?php ssi_boardNews(); flush(); ?>
<hr />
<h3>Menubar Function: <?php ssi_menubar(); ?></h3>
<?php ssi_menubar(); flush(); ?>
<hr />
<h3>Quick Search Function: <?php ssi_quickSearch(); ?></h3>
<?php ssi_quickSearch(); flush(); ?>
<hr />
<h3>Login Function: <?php ssi_login(); ?></h3>
<?php ssi_login(); flush(); ?>
<hr />
<h3>Log Out Function: <?php ssi_logout(); ?></h3>
<?php ssi_logout(); flush(); ?>
<hr />
<h3>Today's Birthdays Function: <?php ssi_todaysBirthdays(); ?></h3>
<?php ssi_todaysBirthdays(); flush(); ?>
<hr />
<h3>Today's Holidays Function: <?php ssi_todaysHolidays(); ?></h3>
<?php ssi_todaysHolidays(); flush(); ?>
<hr />
<h3>Today's Events Function: <?php ssi_todaysEvents(); ?></h3>
<?php ssi_todaysEvents(); flush(); ?>
<hr />
<h3>Today's Calendar Function: <?php ssi_todaysCalendar(); ?></h3>
<?php ssi_todaysCalendar(); flush(); ?>
<hr />
<h3>Recent Calendar Events Function: <?php ssi_recentEvents(); ?></h3>
<?php ssi_recentEvents(); flush(); ?>
<hr />
<h3>Some notes on usage</h3>
All the functions have an output method parameter. This can either be "echo" (the default) or "array".<br />
If it is "echo", the function will act normally - otherwise, it will return an array containing information about the requested task.<br />
For example, it might return a list of topics for ssi_recentTopics.<br />
<br />
<span onclick="if (getInnerHTML(this).indexOf('Bird') == -1) setInnerHTML(this, getInnerHTML(this) + '<br /><img src="http://www.simplemachines.org/images/chocobo.jpg" title="Bird-san" alt="Chocobo!" />'); return false;">This functionality can be used to allow you to present the information in any way you wish.</span>
<hr />
<br />
<br />
<span style="color: #CCCCCC; font-size: smaller;">
<?php
echo 'This page took ', round(array_sum(explode(' ', microtime())) - array_sum(explode(' ', $time_start)), 4), ' seconds to load.<br />';
?>
*ssi_examples.php last modified on <?php echo date('m/j/y', filemtime(__FILE__)); ?>
</span>
</body>
</html>
And I
have checked, several times, to make sure that 34 is a valid topic.
Maybe this was just a bad idea. I'm starting to come to terms with the fact that I can't seem to get all the
really cool stuff to work.... :)
Regards,
-Jim
Quote from: GhostHunter on October 11, 2009, 12:35:26 AM
Quote from: tyty1234 on October 10, 2009, 07:36:02 PM
The proper basic way to use it should be something like this.
<?php
// Get our SSI.
require('SSI.php');
// The topic id we would like to grab from.
$topic_id = 123;
// Return the topic and posts that follow.
ssi_topic($topic_id);
?>
If this is somewhat of what you have, can you show me the code you are using to achieve what it is you want to do?
Thanks for the reply. That is somewhat if what I have, or one of the dozens of variations that I tried. The code provided above results in a blank screen. No output.
actually, that was my bad. ssi_topic() should be echoed. Thus the code being.
<?php
// Get our SSI.
require('SSI.php');
// The topic id we would like to grab from.
$topic_id = 123;
// Return the topic and posts that follow.
echo ssi_topic($topic_id);
?>
Quote from: tyty1234 on October 11, 2009, 01:07:05 AM
actually, that was my bad. ssi_topic() should be echoed.
That's a great thought, and actually makes sense. Unfortunately, I still get nothing.
Regards,
-Jim
Quote from: GhostHunter on October 11, 2009, 01:30:26 AM
That's a great thought, and actually makes sense. Unfortunately, I still get nothing.
And it dawns on me to look at the logs...
PHP Fatal error: Call to undefined function: () in d:\\nebraskaghosts\\smf\\SSI.php on line 1649
Line 1649 is part of the ssi_topic function in SSI.php. Below is line 1649, along with the first few lines following:
$result = $smcFunc['db_query']('', '
SELECT
t.ID_TOPIC, t.ID_BOARD, t.ID_FIRST_MSG, t.ID_LAST_MSG, t.ID_MEMBER_STARTED, t.numReplies, t.locked, m.ID_MEMBER,m.icon, m.subject,
m.posterTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.real_name, m.posterName) AS posterName, b.name AS board_name
FROM ({db_prefix}topics AS t
INNER JOIN{db_prefix}messages AS m
INNER JOIN {db_prefix}boards AS b)
LEFT JOIN {db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_TOPIC = {int:current_TOPIC}
AND m.ID_MSG = t.ID_FIRST_MSG
AND b.ID_BOARD = t.ID_BOARD
AND FIND_IN_SET({int:full_group}, b.member_groups)',
array(
'full_group' => -1,
'current_TOPIC' => $topic,
)
);
Does that help?
-Jim
Jim, you are on 1.1 and the current release of the mod works for 2.0 only, even if you select 1.1.x in the Version Menu. I have adapted this code to 1.1 (straight port), and if you are interested in this code please reply.
Quote from: darrenbeige on October 11, 2009, 08:11:12 AM
Jim, you are on 1.1 and the current release of the mod works for 2.0 only, even if you select 1.1.x in the Version Menu. I have adapted this code to 1.1 (straight port), and if you are interested in this code please reply.
Well, that explains it! I knew it had to be something simple. Yes, I would like to have the ported code. I'll PM you.
Thanks!
-Jim
Quote from: darrenbeige on October 11, 2009, 08:11:12 AM
Jim, you are on 1.1 and the current release of the mod works for 2.0 only, even if you select 1.1.x in the Version Menu. I have adapted this code to 1.1 (straight port), and if you are interested in this code please reply.
The newest release should be compatible with SMF 1.1.x and 2.x
ETA: I actually found some flaws in the SMF 1.1.x version of the mod that contained 2.x coding. I have fixed in this in the newest release of this mod. (1.1)
Jim, you should now be able to fully use the mod with the current release. :)
Quote from: tyty1234 on October 11, 2009, 05:56:18 PM
I actually found some flaws in the SMF 1.1.x version of the mod that contained 2.x coding. I have fixed in this in the newest release of this mod. (1.1)
Jim, you should now be able to fully use the mod with the current release. :)
Thank you for the response. I installed 1.1 (after uninstalling and deleting 1.0), but still get the same error:
PHP Fatal error: Call to undefined function: () in d:\\nebraskaghosts\\smf\\SSI.php on line 1649
Same results as well, no output. If I use ssi_examples.php, output is normal until the line added by the mod, which generates the error.
I'll warn you, the engineers where I work liked to give me new product to test, because they knew that if it could be broken, I was the one who could break it.... :)
-Jim
Can you attach your SSI.php file please?
Quote from: tyty1234 on October 11, 2009, 11:37:31 PM
Can you attach your SSI.php file please?
By your command.
Found the problem, and it looks like I left $smcFunc in there. I can't believe I let something like that pass me. Updated the mod once again. It should work now.
Quote from: tyty1234 on October 12, 2009, 12:43:23 AM
Found the problem, and it looks like I left $smcFunc in there. I can't believe I let something like that pass me. Updated the mod once again. It should work now.
I've learned that it is not a good idea to do stuff like this when I really should be in bed.... :)
In that vein, I will let you know tomorrow if it works. I have to get up early in the morning to go to my day job, and if I try it now, I know I will be up at least another hour.
Thanks!
-Jim
And it works! It looks like it will do pretty much exactly what I had been wanting. I might change one or two tiny little things, but at this point I'm not going to sweat the small stuff.
This is what I love about this community, you folks are so quick and willing to help. Truly amazing. Thanks a million!
-Jim
Thanks for this useful mod Author.
Quote from: A.SK on October 17, 2009, 09:48:47 AM
Thanks for this useful mod Author.
You can thank the original mod author, Daniel15, a I am just continuing development of the mod, which made it possible to be compatible with SMF 2.x. :)
I decided to try to get myself in trouble again.
I tweaked the code a little, in my fumbling way, to make it look a little more "blog-ish". The aim was to include certain topics from the forums in HTML pages on our web site. I suppose I could have done an actual blog or blog mod of some sort, but I'm trying to keep things as simple as possible for our members and users (some of whom are not very computer savvy).
Anyway, I managed to get it to work. A sample of the result can be viewed at www.nebraskaghosts.org/smf/BlogSample.php . Very minor differences. I offer again my humble thanks to the mod authors for their help and support with this mod. I'm not worthy to code in your shadows, and I beg your forgiveness for tampering with perfection. :)
How hard would it be to include attached images? I just KNOW they are going to ask for that....
-Jim
Attachments? Not sure.
You could have your users include the attachment image link and have it be part of their post or something like that. Or you can use this mod (http://custom.simplemachines.org/mods/index.php?mod=1159).
No biggie. I'm selling it to TPTB as an incentive for web site visitors to look at the actual forum pages. I think that they will buy it.
-Jim
Hi there, thank you guy to have made such useful mod.
But i have problems to use it. First i have it successfully installed in SMF 2.0rc1.2. but then, when i run mysite.com/ssi-example.php i had this error:
Show a Topic and its Replies Function: <?php ssi_topic($topic_id); ?>
Error!
The topic you are looking for appears to be either missing or off limits to you.
then, when i tried:
// Get our SSI.
require('SSI.php');
// The topic id we would like to grab from.
$topic_id = 123;
// Return the topic and posts that follow.
echo ssi_topic($topic_id);
I got this error:
Fatal error: Cannot redeclare ssi_shutdown() (previously declared in /home/veryeuro/public_html/21arte/SSI.php:213) in /home/veryeuro/public_html/21arte/SSI.php on line 215
please help! thanks!
Quote from: neverhurry on November 03, 2009, 05:27:02 PM
Hi there, thank you guy to have made such useful mod.
But i have problems to use it. First i have it successfully installed in SMF 2.0rc1.2. but then, when i run mysite.com/ssi-example.php i had this error:
Show a Topic and its Replies Function: <?php ssi_topic($topic_id); ?>
Error!
The topic you are looking for appears to be either missing or off limits to you.
then, when i tried:
// Get our SSI.
require('SSI.php');
// The topic id we would like to grab from.
$topic_id = 123;
// Return the topic and posts that follow.
echo ssi_topic($topic_id);
I got this error:
Fatal error: Cannot redeclare ssi_shutdown() (previously declared in /home/veryeuro/public_html/21arte/SSI.php:213) in /home/veryeuro/public_html/21arte/SSI.php on line 215
please help! thanks!
Hi there!
Sorry about the late reply, been a little busy lately....but I did release a new version of the mod (1.3). You can try it out, and tell me what errors you get.
Thanks. :)
Thank. I installed the latest 1.3, then when i run the ssi_example.php i got this error, actually the same error i got before:
Topic's Poll Function: <?php ssi_showPoll($topic); ?>
Show a Topic and its Replies Function: <?php ssi_topic($topic_id); ?>
error!
The topic you are looking for appears to be either missing or off limits to you.
try re-downloading the package, and then re-installing it. :)
Thanks to the author.
Is there a way to show the avatar next to the posts?
Quote from: Bijan641 on January 16, 2010, 08:05:28 PM
Is there a way to show the avatar next to the posts?
Set the output method as an array and customize the output how you like it along with user information, see the source code of viewnews.php and other examples in this thread.
Particularly pay attention to:
$news['poster']['link']
From the default ssi_boardNews(); function documentation I assume it's the same here this is what get's pulled:
Quote
poster => Array:
The standard array of poster information - id (member ID or 0 for guests), name (display name or the name the guest entered), href (URL to poster's profile or an empty string for guests), link (link to the poster's profile or just the name if they were a guest)
If nothing else you could get the member's ID and do a custom query of your own to pull the avatar information.
I really appreciate the time that went into this, but it's not working for me and I can't figure out why. In ssi_examples.php, I get the get the "ssiTopic_notfound" error of "The topic you are looking for appears to be either missing or off limits to you.", which is coming from this code:
// No results? That's not good!
if (mysql_num_rows($result) == 0)
fatal_lang_error('ssiTopic_notfound');
So the first query in the ssi_topic function of SSI.php isn't finding the topic I guess? What could be wrong? I am using SMF 1.1.11. I've tried re-installing, using it in code with parameters...etc...nothing seems to work...
$topicNum = 97;
$replies = 15;
$startPost = 1;
$return = ssi_topic($topicNum, $replies, $startPost, 'array'); // Setting something to 'null' will use the default value.
// Loop through each post
foreach ($return['replies'] as $post)
{
echo '
<div style="background-color:#cee2ff; color:#000; border:solid; border-width:thin; border-color:#000; padding:3px;">
<div>
<a href="', $post['href'], '"><b>', $post['subject'], '</b></a>
<div class="smaller">', $post['time'], ' Posted by ', $post['poster']['link'], '</div>
<div>', $post['body'], '</div>
</div>';
// The last post? Let's put the page numbers
if ($post['is_last'])
echo '
', $return['pageindex'];
else
echo '
<br /></div>';
}
http://www.dotswoof.com/theater/t.php - code source
http://www.dotswoof.com/forum/index.php?topic=97.30 - original forum topic
I am having trouble getting this function to work. For some reason, the pagination doesn't work at all and it grabs from the end instead of at the starting position I tell it to. I submitted links to the original topic and the malfunctioning page so you could see for yourself.
Quote from: Sunday Driver on March 09, 2010, 01:32:11 AM
I really appreciate the time that went into this, but it's not working for me and I can't figure out why. In ssi_examples.php, I get the get the "ssiTopic_notfound" error of "The topic you are looking for appears to be either missing or off limits to you.", which is coming from this code:
// No results? That's not good!
if (mysql_num_rows($result) == 0)
fatal_lang_error('ssiTopic_notfound');
So the first query in the ssi_topic function of SSI.php isn't finding the topic I guess? What could be wrong? I am using SMF 1.1.11. I've tried re-installing, using it in code with parameters...etc...nothing seems to work...
Nevermind....figured out what the issue was here.
http://www.dotswoof.com/forum/ssi_examples.php
I'm getting an error on ssi_examples for the ssi_topic function. Also, like I said in my previous post, ssi-topic wont work for me correctly...
Can you attach your SSI.php file?
Here it is!
Also, some more information on the problem:
When I use normal function it actually works, it only gives me problems when i use the array. Basically, when I try to use the replies array, it only gives me the last ten replies, no matter how many i specified while calling the function.
Also, the page index never gets posted.
Thanks a lot for the help. This has been a big problem for me.
Sorry for bumping, I'm just really lost on this right now.
Hi, this isn't working for me either now.. I get this error when trying to install it:
2. Execute Modification ./ssi_examples.php Test failed
1. Add After ./ssi_examples.php Test failed
You probably need to install the code manually, especially if you've already installed other mods on your theme.
./ssi_examples.php
Find: [Select]
<?php ssi_showPoll(); flush(); ?>
Add After: [Select]
<hr />
<h3>Show a Topic and its Replies Function: <?php ssi_topic($topic_id); ?></h3>
<?php ssi_topic(); flush(); ?>
i looked up and down in ssi_examples.php and even used the search, but can't find the showpoll part to put the new code after... any ideas?
Quote from: handyrefuse on April 02, 2010, 11:10:41 AM
./ssi_examples.php
Find: [Select]
<?php ssi_showPoll(); flush(); ?>
Add After: [Select]
<hr />
<h3>Show a Topic and its Replies Function: <?php ssi_topic($topic_id); ?></h3>
<?php ssi_topic(); flush(); ?>
i looked up and down in ssi_examples.php and even used the search, but can't find the showpoll part to put the new code after... any ideas?
Are you using SMF 2.0 RC3? The file has changed dramatically, which I just noticed, so you won't be able to add the code to it. It's not crucial to installation of the mod, so you can simply skip it. :)
ya RC3 ... so i can do the package install and just ignore the error that pops up for that file?
Quote from: handyrefuse on April 02, 2010, 09:05:00 PM
ya RC3 ... so i can do the package install and just ignore the error that pops up for that file?
That's correct. The mod should work as normal.
Should you encounter any bugs/errors, please let me know. Thanks. :)
Quote from: Bijan641 on March 10, 2010, 03:31:03 PM
$topicNum = 97;
$replies = 15;
$startPost = 1;
$return = ssi_topic($topicNum, $replies, $startPost, 'array'); // Setting something to 'null' will use the default value.
// Loop through each post
foreach ($return['replies'] as $post)
{
echo '
<div style="background-color:#cee2ff; color:#000; border:solid; border-width:thin; border-color:#000; padding:3px;">
<div>
<a href="', $post['href'], '"><b>', $post['subject'], '</b></a>
<div class="smaller">', $post['time'], ' Posted by ', $post['poster']['link'], '</div>
<div>', $post['body'], '</div>
</div>';
// The last post? Let's put the page numbers
if ($post['is_last'])
echo '
', $return['pageindex'];
else
echo '
<br /></div>';
}
http://www.dotswoof.com/theater/t.php - code source
http://www.dotswoof.com/forum/index.php?topic=97.30 - original forum topic
I am having trouble getting this function to work. For some reason, the pagination doesn't work at all and it grabs from the end instead of at the starting position I tell it to. I submitted links to the original topic and the malfunctioning page so you could see for yourself.
Bumping my original request for help. Can't seem to figure it out.
Update on the information though. It works when I do the normal echo output, but it doesn't when I try to use the array.
You might want to try the latest version released. Maybe it might help you. If not please let me know and I'll be happy to help. :)
I need to calling avatars on topic replys. I try add this in final while.
loadMemberContext($row['id_member']);
$avatarx = $memberContext[$row['id_member']]['avatar']['image'];
And call this in foreach
',$avatarx,'
But avatars not showing up. I really need help on this. Seems not impossible to me. But i guess, i would be skip something.
Can you help me?
Bump! =)
I'm confused why this isn't made a default feature of SSI.php, it seems like an obvious inclusion.
Either way, I just wanted to thank you for the good work, I used this on a site of mine and it's very useful :)
The reason it's not in SSI.php is because there's already a heckuva lot of stuff in there and the line has to be drawn somewhere.
okay, how can i exclude comments? and secondly i get 404 error for the pagination...
Quote from: Daydreamer on April 13, 2010, 03:26:22 PM
I need to calling avatars on topic replys. I try add this in final while.
loadMemberContext($row['id_member']);
$avatarx = $memberContext[$row['id_member']]['avatar']['image'];
And call this in foreach
',$avatarx,'
But avatars not showing up. I really need help on this. Seems not impossible to me. But i guess, i would be skip something.
Can you help me?
Just thought I'd bump this to point out that while BBCode is parsed, censoring text isn't. You can fix this by just wrapping censortext() around wherever you output the body of the message or replies. :)
Quote from: diontoradan on May 21, 2010, 06:09:54 PM
and secondly i get 404 error for the pagination...
I am also getting this error. I am also unable to put the entire thread in one array so as to create my own pagination. I don't know enough about php and databases to re-write the entire code, but I'm pretty desperate to figure this out.
Putting the ENTIRE topic into an array in order to count the items (I assume this is what you want) is very inefficient. This mod actually does the work for you.
You can use the [reply_count] var to know how many items there are in the topic, to create your pagination :)
OK so I finally was able to get it to work by using the normal echo output and just editing everything the way I want it in the SSI file.
I have a new question now (I know, they never end). How do I go about formatting certain BB-code stuff?
For example, quoted text looks terrible. Also, we allow users to post youtube videos, but we don't want them to be shown when we use ssi_topic.
Is there a way to format the bb-code on output?
The output has BBCode already parsed.
View the source of the output and you'll see that quotes are made up of a few <divs> and a <blockquote> tag. You can just style these with CSS.
I found a few omissions in the code that I needed for my particular application of this mod:
1) While the mod pulls the modified_time for replies, it does not do so for the main post.
2) If a topic cannot be found, you get shunted to your install of SMF with an error.
I modified the mod with the following changes:
***install-1.xml, Line 44; install-2.xml, Line 43:
***Change:
m.posterTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name
***To:
m.posterTime, m.modifiedTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name
***install-1.xml, Lines 53-55; install-2.xml, Lines 56-58:
***Change:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
fatal_lang_error('ssiTopic_notfound');
***To:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
{
if ($output_method == 'echo')
fatal_lang_error('ssiTopic_notfound');
else
return array();
}
***install-1.xml:
Insert this line:
'mod_timestamp' => forum_time(true, $row['modifiedTime']),
AFTER:
'timestamp' => forum_time(true, $row['posterTime']),
***install-2.xml:
Insert this line:
'mod_timestamp' => forum_time(true, $row['modified_time']),
AFTER:
'timestamp' => forum_time(true, $row['poster_time']),
After I make those changes, I re-zip the file and reinstall to the server. Works wonderfully now.
I just wish there was an ssi_subjects() method that allowed you to grab all the message subjects across the forum or for certain boards. Maybe I'll look into adding that functionality to this mod (for my copy anyway) since it sort of fits what this mod does.
I just repackaged it as ssi_topic1.4e if that's OK with the author.
***Updated to include return values***
Quote from: ExcalibursZone on October 06, 2010, 10:55:15 AM
I found a few omissions in the code that I needed for my particular application of this mod:
1) While the mod pulls the modified_time for replies, it does not do so for the main post.
2) If a topic cannot be found, you get shunted to your install of SMF with an error.
I modified the mod with the following changes:
***install-1.xml, Line 44; install-2.xml, Line 43:
***Change:
m.posterTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name
***To:
m.posterTime, m.modifiedTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name
***install-1.xml, Lines 53-55; install-2.xml, Lines 56-58:
***Change:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
fatal_lang_error('ssiTopic_notfound');
***To:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
{
if ($output_method == 'echo')
fatal_lang_error('ssiTopic_notfound');
else
return array();
}
***install-1.xml:
Insert this line:
'mod_timestamp' => forum_time(true, $row['modifiedTime']),
AFTER:
'timestamp' => forum_time(true, $row['posterTime']),
***install-2.xml:
Insert this line:
'mod_timestamp' => forum_time(true, $row['modified_time']),
AFTER:
'timestamp' => forum_time(true, $row['poster_time']),
After I make those changes, I re-zip the file and reinstall to the server. Works wonderfully now.
I just wish there was an ssi_subjects() method that allowed you to grab all the message subjects across the forum or for certain boards. Maybe I'll look into adding that functionality to this mod (for my copy anyway) since it sort of fits what this mod does.
I just repackaged it as ssi_topic1.4e if that's OK with the author.
***Updated to include return values***
For the subjects, you can just use ssi_boardnews and echo what you need from it. If you're planning to get more than a couple subjects and if you only ever want the subjects, you can just make a copy of ssi_boardnews and trim it down. A trimmed down boardnews is how I do this page (http://liquiron.com/?archive). Using the vanilla boardnews it takes over 30 seconds.
yeah, thanks :) I did it basically the same way and it's working pretty well.
I'm using SMF for holding web page content away from the structure (like a CMS) T&R saved me in that respect. Now I can just worry about structure issues while my content providers can worry about content.
can i see demo for this mod?
All the mod does is grab a topic and it's comments (see first entry on first page). It's added to SSI.php and provides you with an echo or an array in much the same way that all the other SSI functions do.
The author of this mod may have a demo visible, but it'd look like a topic in your forum or an array of that content.
Hello, this mod works great on my site. Thanks very much for it.
I just have one feature request:
Can you add support for negative start offset? I would like an easy way to grab the LAST reply in a topic.
For example:
ssi_topic($topic, 1, -1) - grab the last reply
ssi_topic($topic, 2, -2) - grab the last 2 replies
etc...
Thanks!
is it possible to only get the first post without the replies?
and is it possible to get a limited amount of characters for that post
Please, can somebody help to improve this mod by adding the posiblity to show the first attachment picture of the first post? that will be more useful, because the one glance of picture worth thousand words. I tried all night but I failed. I tried to use codes (attachment function) form the SSI.php file, but somehow I made mistake and it shows error. Any help will be highly appreciated!
Hey guys,
I want to apologize for not updating the mod periodically and addressing your errors. I've been real busy and it's been so long since I coded for SMF, but with the release of SMF 2.0, the mod will need to be updated. Before I do that however, if you guys would go here (http://www.tytyweb.net/forum/mod-support/ssi-topics-and-replies/) to report some bugs or errors that you found in the mod so that I can fix those bugs and errors and the next version of this mod can be bug-free and is working smoothly. I promise that I will do my best to update and fix the mod in a timely manner as I have a little free time on my hands.
Thanks,
tyty1234
Version 2.0 has been released! It supports SMF 2.0, but no longer supports SMF 1.1.x forums. Please refer to the OP for what's new in this version. This mod, along with the other mods that I wrote are also available on my site (http://www.tytyweb.net/forum/mod-support/).
If you have this installed on 2.0, it might break when installing the recent 2.0.1 fix/update. Tried using this today and got an 'incompatible files' error message so it looks like some nuts and bolts stuff has changed behind the scenes.
I was reading some of the blog posts and announcements saying that it's now feature locked....however I'm not sure what that means, which means I have to find out. Either that or the way that mods are installed have changed...not sure.
EDIT: Nope, it's just that it's not compatible with SMF 2.0.1 according to the instructions I put in the package_info.xml file. I'll have to go in and adjust this. It should work though. for now, you should be able to use the emulate feature.
Just confirming that 'emulation' works ok and I've managed to get this sorted out. Thanks for the mod.
[EDIT] is there a way to add a "Post Reply/Write Comment" link (top or bottom of the inclusion) or the "quick reply" box to this mod or is that out of the general scope/purpose?
It's possible, but one of the queries would have to be altered within the function.
yes i think the quick reply form is a good idea...
Looking forward for the updates...
need ome help with this. I am trying to get this code to work in a simple portal php block
echo '<div id="content-explorer">
<ul class="yui-nav">
<li class="selected"><a href="#">News</a></li>
<li><a href="#">Video's</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Other</a></li>
</ul>
<div class="yui-content">
<div> ;
<?php ssi_boardNews(8);?>
echo '</div>
<div>;
<?php ssi_boardNews(4);?>
echo '</div>
<div>;
<?php ssi_boardNews(3);?>
echo '</div>
<div>;
<?php ssi_boardNews(10);?>
echo '</div>
<div>
</div>;
ty for ur help
Quote from: Özgür on April 13, 2010, 03:26:22 PM
I need to calling avatars on topic replys. I try add this in final while.
loadMemberContext($row['id_member']);
$avatarx = $memberContext[$row['id_member']]['avatar']['image'];
And call this in foreach
',$avatarx,'
But avatars not showing up. I really need help on this. Seems not impossible to me. But i guess, i would be skip something.
Can you help me?
Yep.. Help us ?
Please can someone explain where the value for 'preview' is set? This code is just showing me the first character of the topic.
$topic_data['first_post']['preview']
Hi Anyone help me i have successfully installed ssi_topic();
It is showing good.
It is showing ASC order but i want to show it reverse order(DESC).
More details -
http://www.simplemachines.org/community/index.php?topic=512121.msg3618295#msg3618295
Sorry for bumping this topic, but this mod still works great with the latest version of SMF (2.0.10)
I'm able to display a certain topic with replies. The documentation of this mod describes that attachments can be displayed in the first post (which is working), but I can't find a solution to display also the attachments in the replies?
Can someone help me with this?
Thank you for offering this excellent code, been using it with AJAX calls everywhere