News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SSI Topic and Replies

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

Previous topic - Next topic

tyty1234

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
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

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
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

GhostHunter


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

tyty1234

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?
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

GhostHunter

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


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 &lt;html&gt; tag on line 1:<br />
<div style="font-family: monospace;">
&lt;?php require(&quot;<?php echo addslashes($user_info['is_admin'] ? realpath($boarddir '/SSI.php') : 'SSI.php'); ?>&quot;); ?&gt;
</div>
<br />

<hr />

<h3>Recent Topics Function: &lt;?php ssi_recentTopics(); ?&gt;</h3>
<?php ssi_recentTopics(); flush(); ?>

<hr />

<h3>Recent Posts Function: &lt;?php ssi_recentPosts(); ?&gt;</h3>
<?php ssi_recentPosts(); flush(); ?>

<hr />

<h3>Recent Poll Function: &lt;?php ssi_recentPoll(); ?&gt;</h3>
<?php ssi_recentPoll(); flush(); ?>

<hr />

<h3>Top Boards Function: &lt;?php ssi_topBoards(); ?&gt;</h3>
<?php ssi_topBoards(); flush(); ?>

<hr />

<h3>Top Topics by View Function: &lt;?php ssi_topTopicsViews(); ?&gt;</h3>
<?php ssi_topTopicsViews(); flush(); ?>

<hr />

<h3>Top Topics by Replies Function: &lt;?php ssi_topTopicsReplies(); ?&gt;</h3>
<?php ssi_topTopicsReplies(); flush(); ?>

<hr />

<h3>Top Poll Function: &lt;?php ssi_topPoll(); ?&gt;</h3>
<?php ssi_topPoll(); flush(); ?>

<hr />

<h3>Top Poster Function: &lt;?php ssi_topPoster(); ?&gt;</h3>
<?php ssi_topPoster(); flush(); ?>

<hr />

<h3>Topic's Poll Function: &lt;?php ssi_showPoll($topic); ?&gt;</h3>
<?php ssi_showPoll(); flush(); ?>
<hr />

<h3>Show a Topic and its Replies Function: &lt;?php ssi_topic($topic_id); ?&gt;</h3>
<?php $topic_id=34ssi_topic($topic_id); flush(); ?>


<hr />

<h3>Latest Member Function: &lt;?php ssi_latestMember(); ?&gt;</h3>
<?php ssi_latestMember(); flush(); ?>

<hr />

<h3>Board Stats: &lt;?php ssi_boardStats(); ?&gt;</h3>
<?php ssi_boardStats(); flush(); ?>

<hr />

<h3>Who's Online Function: &lt;?php ssi_whosOnline(); ?&gt;</h3>
<?php ssi_whosOnline(); flush(); ?>

<hr />

<h3>Log Online Presence + Who's Online Function: &lt;?php ssi_logOnline(); ?&gt;</h3>
<?php ssi_logOnline(); flush(); ?>

<hr />

<h3>Welcome Function: &lt;?php ssi_welcome(); ?&gt;</h3>
<?php ssi_welcome(); flush(); ?>

<hr />

<h3>News Function: &lt;?php ssi_news(); ?&gt;</h3>
<?php ssi_news(); flush(); ?>

<hr />

<h3>Board News Function: &lt;?php ssi_boardNews(); ?&gt;</h3>
<?php ssi_boardNews(); flush(); ?>

<hr />

<h3>Menubar Function: &lt;?php ssi_menubar(); ?&gt;</h3>
<?php ssi_menubar(); flush(); ?>

<hr />

<h3>Quick Search Function: &lt;?php ssi_quickSearch(); ?&gt;</h3>
<?php ssi_quickSearch(); flush(); ?>

<hr />

<h3>Login Function: &lt;?php ssi_login(); ?&gt;</h3>
<?php ssi_login(); flush(); ?>

<hr />

<h3>Log Out Function: &lt;?php ssi_logout(); ?&gt;</h3>
<?php ssi_logout(); flush(); ?>

<hr />

<h3>Today's Birthdays Function: &lt;?php ssi_todaysBirthdays(); ?&gt;</h3>
<?php ssi_todaysBirthdays(); flush(); ?>

<hr />

<h3>Today's Holidays Function: &lt;?php ssi_todaysHolidays(); ?&gt;</h3>
<?php ssi_todaysHolidays(); flush(); ?>

<hr />

<h3>Today's Events Function: &lt;?php ssi_todaysEvents(); ?&gt;</h3>
<?php ssi_todaysEvents(); flush(); ?>

<hr />

<h3>Today's Calendar Function: &lt;?php ssi_todaysCalendar(); ?&gt;</h3>
<?php ssi_todaysCalendar(); flush(); ?>

<hr />

<h3>Recent Calendar Events Function: &lt;?php ssi_recentEvents(); ?&gt;</h3>
<?php ssi_recentEvents(); flush(); ?>

<hr />

<h3>Some notes on usage</h3>
All the functions have an output method parameter.  This can either be &quot;echo&quot; (the default) or &quot;array&quot;.<br />
If it is &quot;echo&quot;, 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=&quot;http://www.simplemachines.org/images/chocobo.jpg&quot; title=&quot;Bird-san&quot; alt=&quot;Chocobo!&quot; />'); 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

tyty1234

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);

?>

My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

GhostHunter

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

GhostHunter

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

darrenbeige

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.

GhostHunter

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

tyty1234

#50
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. :)
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

GhostHunter

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


tyty1234

Can you attach your SSI.php file please?
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

GhostHunter


tyty1234

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.
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

GhostHunter

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

GhostHunter


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

Sudhakar Arjunan

Thanks for this useful mod Author.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

tyty1234

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. :)
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

GhostHunter


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

Advertisement: