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".

john.nordquist

Finally an SSI latest topics module!  Looks great but in my site it busts out of the theme and board template when you click a topic.  Th eodd part is that the url it sends is the same as if within SMF and does not bust out of the theme/css. 

Probably I'm not making sense...

www.dailykenoshan.com to see what I mean.. 

john.nordquist

Oops, I was wrong..

Looks like the module is not for wrapped or bridged versions.. my bad..

In SMF, the recent topic list looks for ItemID

hxxp:dailykenoshan.com/index.php [nonactive]?option=com_smf&Itemid=58&topic=53682.msg60190#new

The module is obviously for standalone and I didn't see that...
hxxp:dailykenoshan.com [nonactive]/smf/index.php?topic=53682.msg60189;topicseen#new

sorry.. 

Not much of a coder, but I'll try to modify it for (unlawfully)bridged implementation...

dellio

#22
I have a problem following recent comments out of small box please help

Tanshaydar

Hi
My forum is ISO-8859-9 and my Joomla 1.5.x is UTF8.
When I try to use it, characters are broken. Any way to fix it?

krick

Quote from: Tanshaydar on December 02, 2009, 10:39:54 AM
Hi
My forum is ISO-8859-9 and my Joomla 1.5.x is UTF8.
When I try to use it, characters are broken. Any way to fix it?

I'm dealing with this problem myself.  I have Joomla 1.5 UTF-8 *AND*  SMF 1.1.11 UTF-8 and I'm still seeing the problem.

So far, the only fix I've come up with is wrapping the subject and user name with the utf8_encode() function like this...

utf8_encode( $post['subject'] )

and

utf8_encode( $post['poster']['link'] )

I hope this helps.

Tanshaydar

I fixed it with these kind of string encoder and replacer methods.
Thanks.

Frantix

Old topic but thought I'd ask one question... I'm doing a wrapper and while this works great, how would I include it to open inside the wrapper?  I'm killing the header of SMF and including the relevant items as Joomla menu items, which will work great but not if the SSI calls open in blank page. :( I read the code and I think I'm ready to create other modules that I want on the front page of Joomla but that's holding me back atm.  Thanks for this module tho, helps a great deal on doing the others. :)
Success breeds complacency. Complacency breeds failure. Only the paranoid survive. -Andy Grove

Kindred

opening smf inside the joomla/mambo wrapper is asking for trouble. The wrapper uses iframes, which means that the session data may not work
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Frantix

Thanks for the response Kindred.  Not what I hoped for since it would be nice to have things fit seamlessly with the Joomla template I'm moving to...may just look at converting to PHPBB since there are "sanctioned" bridges and completely integrated themes but I hate doing that after all these years on SMF.  :-\
Success breeds complacency. Complacency breeds failure. Only the paranoid survive. -Andy Grove

Kindred

personally, I have yet to find anything that Joomla does which one of the portal mods (or other mods) can not do internally to SMF.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Hj Ahmad Rasyid Hj Ismail

I totally agree with Kindred. Portal Mods on SMF is much more better than Joomla/Mambo etc...

Frantix

#31
I'm not lazy (or indicating that you think I'm lazy about things), I've done a lot of modifications and done a lot of work on just about every CMS and Blog ... I'm just wondering if you can you point me in the right direction?  I've been using SMF and Joomla for almost 5 years so I'm not being combative, I just have the old stuff working together and want some direction to something else... I have a Rockettheme membership that runs out soon that I've used for other sites and really like the theme I have chosen to update my radio station that's also 5 years old so even if there's a moderate fee, I'm fine with it... I just want to move in a direction that works well and I can give a seamless look to.  I'm using SMF Gallery, so that's a bonus for SMF and not having to sort things out and move 400 images to Gallery2 or something else.  I just want a nice clean, uniform look for the site that's been missing as well as adding the ability to something like an Amazon store in the future for the music I play.  BTW, the current site is www.radiovietnam.net [nofollow].

Thanks for any help you can provide. :)

BTW the site is using an old version but I've upgraded it to 1.11 and the current 2.0 versions on my test site so I know either version of SMF works fine other than re-adding the gallery (that I've not tried but is compatible) and I modified a theme from whenever to work with what I have on the site, so I'm not scared of CSS files or modifying code, I just don't want to make it a huge undertaking. :)
Success breeds complacency. Complacency breeds failure. Only the paranoid survive. -Andy Grove

Kindred

Never thought you were lazy. :)

yes, I switched from Joomla/SMF/Gallery2  ... I am now using SMF with EZportal, SMF Articles and Aeva Media...
The best thing, IMO, is that it all works, cleanly with any SMF theme that I pick... allowing the users a choice of 4 different color combinations (whereas, with Joomla, I was fixed at a single theme, and that one required a fair amount of tweaking to show cleanly together)

http://www.40konline.com/community


Again, much of it is a matter of preference.

I think that Nao has the Avea Media on his site linked to paypal, because he controls the download of the zip file for his paid version of Avea Media through Aeva Media.

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Frantix

Thanks for the reply, Kindred. I've been a bit busy so not had the chance to get back out here.  I'm taking a look at EZportal now.  The only thing I've not liked about a lot of the portal layout a  lot of times are very defined as left, center, right with the header bar the same (which I know are all restrictions of using the forum theme).  Obviously that's a cosmetic issue and not what's under the hood but the difficult part is sometimes the cosmetics. :)  I want a clean theme modern looking layout. 

I may have found one that I can work on changing the color scheme.  It actually looks good with EZportal and very smooth and flowing.  8)  So we'll see how that goes as well as the EZportal experiment for a few weeks.
Success breeds complacency. Complacency breeds failure. Only the paranoid survive. -Andy Grove

bouza_marcos

OK... thanks a lot for this module... I was looking for ours and ours for a solid solution. I don´t want a bridge (cause it seems to wasn´t be live for a couples of YEARS) and that solution was perfect by now...

In other thing, can you tell me how we can load another instance of the module for (in ex) topBoards function, or for a login module that redirect to the forum url/folder....¿?¿?¿?¿?

It would be very usefull for us...

Thanks again... +10

Kindred

look at ssi_examples.php on your own site and make your own modules using the SSI functions.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

fsoica

Quote from: krick on April 26, 2010, 04:54:10 PM
Quote from: Tanshaydar on December 02, 2009, 10:39:54 AM
Hi
My forum is ISO-8859-9 and my Joomla 1.5.x is UTF8.
When I try to use it, characters are broken. Any way to fix it?

I'm dealing with this problem myself.  I have Joomla 1.5 UTF-8 *AND*  SMF 1.1.11 UTF-8 and I'm still seeing the problem.

So far, the only fix I've come up with is wrapping the subject and user name with the utf8_encode() function like this...

utf8_encode( $post['subject'] )

and

utf8_encode( $post['poster']['link'] )

I hope this helps.

didn't work for me....
i also have I have Joomla 1.5 UTF-8 and SMF 1.1.13 UTF-8
any alternative ?

Advertisement: