News:

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

Main Menu

SMF SSI Recent Topics module for Mambo and Joomla

Started by krick, January 22, 2009, 12:48:03 PM

Previous topic - Next topic

krick

I've whipped up a barebones Mambo/Joomla module that uses the SMF SSI feature to display your recent forum topics on a Mambo or Joomla site.  It doesn't offer any fancy options, it just does the job.

No bridge is required and I'm not sure that it would work if you did install a bridge.  The only requirement is that SMF is installed into a subdirectory under Mambo/Joomla.

I've tested it with the latest version of Mambo, and I'm fairly certain it will work with Joomla 1.0.x as well.  I have no idea if it works with Joomla 1.5+ but I'd love to have people test it out and let me know.

It installs the normal way.  The only real configuration required is that you tell it what the SMF installation directory is.  Then just select the module location and publish it.


misjka

Hi!

Gosh, this is just what I'm seeking for to my Joomla 1.5/SMF site  :D!

But I don't want my forum to be placed below the Joomla directory but in another directory on the same level as Joomla... Is this possible to achieve, e.g. by giving the absolute path to the forum?
The admin of five forums:
SMF 1.1.4 + TP 0.98

krick

Quote from: misjka on April 01, 2009, 06:20:02 AM
Hi!

Gosh, this is just what I'm seeking for to my Joomla 1.5/SMF site  :D!

But I don't want my forum to be placed below the Joomla directory but in another directory on the same level as Joomla... Is this possible to achieve, e.g. by giving the absolute path to the forum?

I'm pretty sure that my module won't work with 1.5 without modification because it relies on a global variable that I believe only exists in Joomla 1.0...   mosConfig_absolute_path

My mod uses the joomla absolute path, then tacks on the forum subdirectory to build the path to smf's SSI.php file.  I'm sure that it could be easily modified to take an absolute path instead.  I just wanted to make the setup easy for the majority of people.

I'm having issues with my host at the moment, but I'm planning on setting up a 1.5 site in the next few days and I'll get it working.  If you have any interest in writing your own mods, you should take a look at the extremely simple source and see if you can get it working yourself.  There's really not much to it...


<?php
//SMF SSI Recent Topics//
 
defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$smf_dir $params->def'smfdir'"forum" );
$ssipath $mosConfig_absolute_path $smf_dir '/SSI.php';

if(
file_exists($ssipath)) {
require($ssipath);
ssi_recentTopics();
}
else {
  
trigger_error ("Unable to include SMF SSI file: $ssipath"E_USER_ERROR); 
}

?>




krick

Quote from: misjka on April 01, 2009, 06:20:02 AM
Gosh, this is just what I'm seeking for to my Joomla 1.5/SMF site  :D!

But I don't want my forum to be placed below the Joomla directory but in another directory on the same level as Joomla... Is this possible to achieve, e.g. by giving the absolute path to the forum?

I've got a version that works with joomla 1.5 now (see attachment).

It requires an absolute path to the SMF installation directory on your server.

misjka

The admin of five forums:
SMF 1.1.4 + TP 0.98

krick

In case you're curious to see it in action, here's my Joomla 1.5 site (under construction)...

http://www.tankadin.com

misjka

Hi!

This is a great mod :)!
I have two questions, though:

1) Is it hard to achieve a toggle for turning the fields board and date on/off? On my site, these fields take too much space, I'm afraid, since I prefer them to the right.

2) I'm running a Swedish forum (ISO, not UTF-8) and CMS, and as you can see the Monday representation (which contains an umlaut) is miscoded (but not the boards, which may also contain umlauts). How do I correct this?

Thanks!
The admin of five forums:
SMF 1.1.4 + TP 0.98

krick

In order to do what you want, you'd have to use the "array" mode of the functions to get the data from SMF in an array and then write code to parse the array and format it the way you want it to display.

Here's the documentation on the recent topics function...
http://support.simplemachines.org/function_db/index.php?action=view_function;id=515

...and recent posts function...
http://support.simplemachines.org/function_db/index.php?action=view_function;id=514


Here's all the "stock" SSI examples from SMF...
http://www.simplemachines.org/community/ssi_examples.php

And some more info here...
http://docs.simplemachines.org/index.php?topic=400


I'm not really sure what to do about the character encoding issues.  You may need to make sure that your CMS and forum are both the same character set.

misjka

Ah, many thanks! I will dig into this :)!

Thanks,
The admin of five forums:
SMF 1.1.4 + TP 0.98

krick

Give the attached version a try.  You can show or hide the board, poster, and/or time.  Plus you can now select the number of topics to show.

I couldn't get the "new" icons working in this version because I didn't have an easy way to figure out the paths to the SMF images.


Orstio

Quote from: krick on May 09, 2009, 05:02:10 PM
Give the attached version a try.  You can show or hide the board, poster, and/or time.  Plus you can now select the number of topics to show.

I couldn't get the "new" icons working in this version because I didn't have an easy way to figure out the paths to the SMF images.

global $boardurl

misjka

Quote from: krick on May 09, 2009, 05:02:10 PM
Give the attached version a try.  You can show or hide the board, poster, and/or time.  Plus you can now select the number of topics to show.

I couldn't get the "new" icons working in this version because I didn't have an easy way to figure out the paths to the SMF images.

Absolutely beautiful :)! Works like a charm :)! Many thanks!

I just have one petite comment: Is there a chance to get a bullet list option, so it will look like the output form e.g. mod_latestnews?
The admin of five forums:
SMF 1.1.4 + TP 0.98

krick

Quote from: Orstio on May 09, 2009, 08:08:58 PM

global $boardurl

By adding "global $boardurl" to the beginning of my code, that brings that PHP variable into scope, even though that variable is declared in the SMF code.  Correct?  This always seemed weird to me that it would work being two separate code bases.

In the SMF code in SSI.php, they reference several variables to build the table...

$scripturl, $settings, $context, and $txt.  I wonder bringing these into scope in my joomla module would make things easier.

The really odd thing is that if I use $txt[525] in my code for the word "by", it works, even though I didn't declare global $txt anywhere in my code.

krick

Quote from: misjka on May 10, 2009, 03:05:46 AM

I just have one petite comment: Is there a chance to get a bullet list option, so it will look like the output form e.g. mod_latestnews?


I've attached a new version to this post.  It gives you the option to output as an HTML list instead of a table.  You should be able to use CSS to get type of list look that you want.  Give it a workout and let me know if you find any issues.

Orstio

QuoteThe really odd thing is that if I use $txt[525] in my code for the word "by", it works, even though I didn't declare global $txt anywhere in my code.

You need to talk to your host about the security issue of leaving register_globals on.  With register_globals off, you need to global each variable you wish to use from any other file or function.

misjka

QuoteI've attached a new version to this post.  It gives you the option to output as an HTML list instead of a table.  You should be able to use CSS to get type of list look that you want.  Give it a workout and let me know if you find any issues.

Ah, works great over here  :D :D!

Many thanks!
The admin of five forums:
SMF 1.1.4 + TP 0.98

krick

#17
Quote from: Orstio on May 11, 2009, 07:37:35 AM
QuoteThe really odd thing is that if I use $txt[525] in my code for the word "by", it works, even though I didn't declare global $txt anywhere in my code.

You need to talk to your host about the security issue of leaving register_globals on.  With register_globals off, you need to global each variable you wish to use from any other file or function.

having...

require(my-absolute-path/forum/SSI.php);

...in my mod must somehow bring $txt in.

EDIT:  That's exactly what is happening.  At the top of SSI.php, there's a bunch of variables pulled in with global....


// We're going to want a few globals... these are all set later.
global $time_start, $maintenance, $msubject, $mmessage, $mbname, $language;
global $boardurl, $boarddir, $sourcedir, $webmaster_email, $cookiename;
global $db_server, $db_name, $db_user, $db_prefix, $db_persist, $db_error_send, $db_last_error;
global $db_connection, $modSettings, $context, $sc, $user_info, $topic, $board, $txt;



Trust me, register globals_is OFF.  I made sure of that before I installed Joomla...

 


JBlaze

Hello, just going through some old support topics. Do you still require assistance with this issue?

If so, please reply with more information about what isn't working.

Additionally, if this is already solved, please mark it solved by clicking 'Mark Topic Solved' at the lower left of your screen.
Jason Clemons
Former Team Member 2009 - 2012

Orstio

Quote from: JBlaze on June 05, 2009, 03:02:54 AM
Hello, just going through some old support topics. Do you still require assistance with this issue?

If so, please reply with more information about what isn't working.

Additionally, if this is already solved, please mark it solved by clicking 'Mark Topic Solved' at the lower left of your screen.

???

If you read the topic, it's not asking for support.  No need to be "solved".

Advertisement: