Firefox PHP

System for embedding Phorum in other applications (early preview)

Posted by Maurice Makaay 
Re: System for embedding Phorum in other applications (early preview)
February 07, 2006 09:41PM
I figure that out and that is exactly what I did to get it going. I ended up change the admin to adminx then everything work when sync.

I did copy the embed templage to the template folder and set the embed template to be the default template. I was able to see phorum when I click on the phorum link from Mambo but that is as far as I can get it to work.

I got two problems:
. The connector default to [localhost] but since my Mambo is in the folder so the phorum did not show until I hard code Mambo folder in the connector then it will show the forum of phorum.
. The second problem is when I click on a post to see the text I get the "missing style" message and I thinkg it failed due to the "query string" pass between Mambo and phorum and phorum did not see the "list,2" then it fail. I think the failure is due to the query string is only past to phorum as "list" not "list,2" so Phorum don't have the info to display the right item.

What do you think?

ps: I added these code to the connector so that it will work also when my install is in a folder rather than at the root

On line 50:
$sPath = parse_url($_SERVER['PHP_SELF']);
if ($sPath['path']) $fpath=$sPath['path'];

// Store the Mambo script URL< which can be used for building URL's.
global $option, $Itemid;
$mambo_url = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")
? "["]; : "["];) .
$_SERVER["HTTP_HOST"] .
$fpath.
"/index.php?option={$option}&Itemid={$Itemid}";
$GLOBALS["PHORUM"]["mambo_url"] = $mambo_url;

Thanks

[opensourceCMS.com]
[ongetc.com]
Chanh Ong



Edited 2 time(s). Last edit at 02/07/2006 10:14PM by chanh.
Re: System for embedding Phorum in other applications (early preview)
February 08, 2006 04:39AM
Mambo in a subdirectory is one of the things that I was wondering about. I think this will fix this situation, so I added the change to the package.

One of the changes that I did yesterday, is printing out the content that was retrieved from Phorum when certain page elements cannot be found. So if you use the new package, you'll be able to see what Phorum did output along with the "missing style" message. That will make it much easier to identify the problem.

As always, the updated package is in the first posting.

Edit: I found a problem in your code, which makes the URL for Mambo expand. The "index.php" part of the URL is included in parse_url's path, so the index.php should not be included in building the URL. I rolled a new package 0.0.6 for this.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 02/08/2006 07:46AM by mmakaay.
Re: System for embedding Phorum in other applications (early preview)
February 08, 2006 09:32PM
Any thought on my test site yet? I'll work on this now, hope I can figure out the problem. :)
Re: System for embedding Phorum in other applications (early preview)
February 09, 2006 12:52AM
Ok, got it to work, my little modification to the run_phorum.php is the one causing this whole problem.

I'm starting to grasp this whole embed_phorum module. Honestly this is the best idea, because for first timer user like me, I don't know the whole phorum system work in detail, so with this module, basicallt that eliminates the need for me to learn the in depth about phorum first so that I can integrate it on third party system. So this really is a great mod.

Thanks Maurice.

More questions to come, when I'm starting to integrate this with MODx users system. :D
Re: System for embedding Phorum in other applications (early preview)
February 09, 2006 03:13AM
Great to hear that things are getting to function for you wendy!


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: System for embedding Phorum in other applications (early preview)
February 09, 2006 09:11AM
Wendy,

Good job getting the phorum mods to work with MODx!

[opensourceCMS.com]
[ongetc.com]
Chanh Ong
Re: System for embedding Phorum in other applications (early preview)
February 09, 2006 09:23AM
Maurice,

I finally able to load your latest mods and test this morning and please see the text below since I can not attach the screenshot because it is bigger than the allow limit.

embed_phorum module error: page element "style" is missing in the templates. Did you select the correct template for this forum? The output that we did get is the following:
Test Forum : Phorum 5 The fastest message board....ever.
This is a test forum. Feel free to delete it or edit after installation.
Goto: Forum List•New Topic•Search• Log In
Current Page: 1 of 1
Subject Posts Started By Last Post
Test Message 2 Phorum Installer 02/08/2006 07:55PM
Last Post by adminx
Current Page: 1 of 1
Options:

Any idea what might cause this?

PS: I also made a little change in phorum.php like below
$PHORUM_DIR = "../phorum";

I view the source and it seems to me that the mods does not have the complete path to the template and that is what cause the "style" error. Please see below:
<link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="[localhost]; />
<title>Phorum :: Test Forum</title>

<img src="templates/default/images/logo.png" alt="The fastest message board....ever." width="170" height="42" />

What do you think?

Thanks

[opensourceCMS.com]
[ongetc.com]
Chanh Ong



Edited 2 time(s). Last edit at 02/09/2006 09:32AM by chanh.
Re: System for embedding Phorum in other applications (early preview)
February 09, 2006 09:52AM
The $PHORUM_DIR is used to chdir() to the directory where Phorum is installed. From there on, all code runs from that path. This is how Phorum expects it and apparently Phorum can produce some output here. So this is all okay.

It only seems that phorum is using the default templates instead of the embed_phorum template. This is a result of some changes in hook methods in the connector class which I made for some extra flexibility. This has caused the fixed setting of the template to use to be in the wrong method :( I didn't notice this myself, because I setup the forums in the admin interface with the embed_phorum templates as well, so for me this fixed settings did not have to be the right method.

Way to fix: add the following method to the connector.php for mambo:
    function hook_common_post_user()
    {
        // We use a hard-coded template for this connector.
        $GLOBALS["PHORUM"]["template"] = "embed_phorum";
        $GLOBALS["PHORUM"]["default_template"] = "embed_phorum";
    }
That code is currently in hook_common_pre(), so you can remove it from there.

Edit: new function name is hook_common_post_user() instead of the earlier proposed hook_common().


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 02/09/2006 06:50PM by mmakaay.
Re: System for embedding Phorum in other applications (early preview)
February 09, 2006 02:30PM
Maurice,

Downloaded this mod yesterday and used it with a new phorum integration to be completed today. Thanks so much!! This is exactly what I have been needed.

I did things a little differently for two reasons:

a. I already had our templates all set up based on the martha_with_settings template dissurion created.

b. This site is an asp site (which can be overcome obviously), so I used your syncuser.php page and in my own sync/login script.

My version logs in the user to the host site as well as phorum. I had modified the templates to disallow registration, so basically both systems are synced but still work seperately.

I plan on using your mod in my next integration and using it as designed.

Thanks so much!

P.S. If anyone is interested in doing something like this (don't know why you would be) I can paste some genaric code up.



Edited 1 time(s). Last edit at 02/10/2006 12:27AM by kevwit.
Re: System for embedding Phorum in other applications (early preview)
February 09, 2006 05:03PM
Good to hear kevwit! If you run into problems integrating with embed_phorum, please let me know. I'm only solving those issues that I run into, so I might easily be missing something.

Mind that there are some little problems left with <img> tags used in the code, if you do not use a <base href> in your page to use the phorum directory as the base. The smileys mod won't work properly and if you use images in the template that could go wrong as well. This can all be overcome by tweaking stuff, but I'd rather implement some generic solution. The only thing that might work is trying to find the <img> tags in the Phorum output and rewriting relative image paths to the real path.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login