SMF Version: SMF 1.1.1
I am at a loss as to why this is happening since other SSI.php functions work fine. The following error is shown when I use the ssi_recentTopics() funtion with the $output_method declared (either 'array' or 'echo'). When I use it vanilla or even declare a $limit, it works fine. It also seems that SMF is catching the error since it is displayed within the SMF template all nicely formatted.
QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
AND 1
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIM' at line 13
File: /xxxxxx/xxxxxx/xxxxxx/forum/SSI.php
Line: 360
The closest I have come in searching the board is this post (http://www.simplemachines.org/community/index.php?topic=42822.0), but that hasn't been updated in over a year and it was for 1.1B3.
So far I am also able to pull events and welcome information via SSI.php using the array method.
Thanks in advance for any help that you may be able to provide.
Are you sure you're using the correct syntax? Try this:
<?phprequire_once('forums/SSI.php');$topics = ssi_recentTopics(10, null, 'array'); // (number of topics, array of boards to ignore, return type)print_r($topics);?>
Does this work? If not, do you have any mods installed?
Yep, syntax is correct as far as I understand. A little different than your example, but correct. It is more like:
<?phprequire_once('forums/SSI.php');$smf_topics = ssi_recentTopics($limit = 5, $output_method = 'array');print_r($smf_topics);?>
Yours seems to have worked though, so problem solved. The syntax I used worked on the other functions that I currently have implemented. Nutty I tell 'ya.
If anything, my silliness can be a lesson to others. Thanks a bunch for the shove in the right direction.
In your syntax, you're not passing the output method properly. The second argument is the boards to ignore (set to null in my example), and the third argument is the output method. Also, the variable names should not be there. So, that line should look like:
$smf_topics = ssi_recentTopics(5, null, 'array');
I saw it listed that way in the SSI FAQs elsewhere in the forums. It is in the correct format now, though. Now I am happily sorting through the arrays putting what I want where I want.