Oct 07, 2008, 02:35 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1] 2 3   Go Down
  Print  
Author Topic: SMF with modx from newbie to newbie  (Read 23684 times)
0 Members and 3 Guests are viewing this topic.
Brocoli
Jr. Member
*
Posts: 15


« on: Apr 19, 2007, 04:15 PM »

  Hi everyone,

Here the way I have installed SMF in order to get it well integrated inside modx website (Apache needed for Friendly URLs).

Step 1: Downloads
You need to download:
- modx 0.9.2 or higher (tested with 0.9.5 below)
- SMF 1.1.1 or higher (tested with 1.1.2 below)
- SMF_Forum_Integration_1.0 connector from modx ressources website ("SMF_module.zip or .tgz" can be downloaded here: http://modxcms.com/forums/index.php/topic,3565.0.html)

Step 2: Installations
Install modx in the normal way
Install SMF in the normal way (in "/forum" directory for example)
Install SMF_Forum_Integration_1.0 in the normal way

Step 2.1: Friendly URLs
Friendly URLs inside modx must be activated:
In modx manager -> Tools -> Configuration -> Friendly URLs -> Select yes
Rename the file "/ht.access" to ".htaccess"

Step 3: Creation of the forum modx page
Inside modx manager, create a new snippet (for exemple 'forumsnippet') with following code:
Code:
<?php
include_once($modx->config['base_path'] . '/forum/index.php');
return ;
?>


Then create a new html page named for exemple "Forum" and enter an alias name (for exemple: "forum") that contain the previous snippet:
Code:
[[forumsnippet]]

Step 4: Modifying forum index.php file
Replace the file "/forum/index.php" by the one joined in this post: Rename "index_php.txt" to "index.php" and put it in "/forum/" (use diff to see the differences if wanted).

Step 5: Preview
When you type in Firefox the url to the forum page (like http://yoursite/forum.html), you should see the forum inside the template of your web site but not very well displayed.
If not, then you have an error. You need to try again from step 1.

Step 6: Forum template
To integrate perfectly the forum inside your website, you should create a template of SMF (see SMF documentation to do it).
When it is done, you need to modify the "index.template.php" file as the one joined in this post (make diff to the "index.template.php" default theme to see the differences):

Then you need to set this new theme as the default one for your forum: In modx manager -> Modules -> SMF Connector -> Administration Center, Go to the forum and then you should see the forum page and the forum menu. Install the new theme (see SMF documentation to do it) and make it the default one.

Step 7: Modifying forum php source code
You need to modify some source code of SMF as following:

Directing the link to the forum modx page instead of index.php forum page:
In the file "/forum/Sources/QueryString.php", (replace 'index.php' by the alias name of the forum page ('forum.html' for exemple))
Code:
function cleanRequest()
{
global $board, $topic, $boardurl, $scripturl, $modSettings;

// Makes it easier to refer to things this way.
// $scripturl = $boardurl . '/index.php';
$scripturl = $boardurl . '/forum.html';
In the file '/forum/Settings.php', remove '/forum' at the end of:
Code:
$boardurl = 'http://yoursite'; # URL to your forum's folder. (without the trailing /!)

Removing the copyright alert message:
In the file "/forum/Sources/Subs.php", (do not forget the space character at the end of following "Powered by ")
Code:
function theme_copyright($get_it = false)
{
...
$forum_copyright = preg_replace('~(<a href="http://www.simplemachines.org/"[^>]+>Powered by )</a>~', '$1' . $match[1] . '</a>', $forum_copyright);
...

Step 8: Synchronize users
Now add the already modx users to the SMF users by doing:
In modx manager -> Modules -> SMF Connector -> Synchronize Users

Step 9: The end !
That's all...

Do not forget to logout from SMF Connector (In modx manager -> Modules -> SMF Connector -> Logout (at right side)) when you want to test from your website otherwise, you'll see the forum as if you'll be connected as the admin of the forum.

It should work.  Smiley

* index.template.php.txt (28.91 KB - downloaded 498 times.)
* index_php.txt (16.16 KB - downloaded 561 times.)
« Last Edit: May 05, 2007, 03:29 PM by Brocoli » Logged
rthrash
Foundation
*
Posts: 9,269



WWW
« Reply #1 on: Apr 19, 2007, 04:19 PM »

Thanks so much for a great overview. Smiley
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
pixelchutes
Coding Team
*
Posts: 801



WWW
« Reply #2 on: Apr 21, 2007, 10:51 AM »

  Hi everyone,

Here the way I have installed SMF in order to get it well integrated inside modx website.
...
That's all...

It should work.  Smiley

@Brocoli,

Wow! Thanks for the detailed tutorial. I have tried this before (briefly; not following these directions) and I recall receiving a few errors, sometimes only the first time you log into the forum, etc.

It sounds like, if following these instructions, that this implementation is totally error-free? Can't wait to try it out.

What about session timeouts? I thought I also read somewhere issues pertaining to Web Login session vs. SMF session not being in synch... any insight there?
Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
shtuck
Jr. Member
*
Posts: 12


« Reply #3 on: Apr 23, 2007, 11:01 AM »

my forum is not a subdirectory of my cms folder, but rather a separate folder in my servers root directory

is it still possible for me to get this to work?
Logged
pixelchutes
Coding Team
*
Posts: 801



WWW
« Reply #4 on: Apr 23, 2007, 11:42 AM »

my forum is not a subdirectory of my cms folder, but rather a separate folder in my servers root directory

is it still possible for me to get this to work?

@shtuck,

If your "CMS folder" was "yourdomain.com/modx/", pretty sure you could still use this if your forum was "yourdomain.com/forum/". Provided your paths are referenced correctly this should be possible, even though /forum isn't a subdir to /modx.

I would imagine the more common setup would be MODx installed to www root (e.g. yourdomain.com/ ) with /forum installed within.
« Last Edit: Apr 23, 2007, 12:08 PM by pixelchutes » Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
shtuck
Jr. Member
*
Posts: 12


« Reply #5 on: Apr 23, 2007, 11:59 AM »

thanks, ill keep trying to get it working
Logged
pixelchutes
Coding Team
*
Posts: 801



WWW
« Reply #6 on: Apr 23, 2007, 12:09 PM »

thanks, ill keep trying to get it working

Looking at the code, you'll need to modify this much (at least):

<?php
return include_once($modx->config['base_path'] . '/forum/index.php');
?>

... Since your /forum doesn't exist within $modx->config['base_path'], you'll need to modify the path so this include() doesn't fail. IMO, I would consider moving the forum to your www root (same folder as your CMS)...Of course, that is provided you can do so without impacting other processes.
« Last Edit: Apr 23, 2007, 12:11 PM by pixelchutes » Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
shtuck
Jr. Member
*
Posts: 12


« Reply #7 on: Apr 23, 2007, 02:51 PM »

i have managed to move the forum into my Modx folder and sync all the users, however when i click the link for the forum instead of it appearing in my layout i get the following error

Code:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
 
PHP error debug
  Error: filemtime() [function.filemtime]: open_basedir restriction in effect. File(/Load.php) is not within the allowed path(s): (/home/jackal/:/usr/lib/php:/usr/local/lib/php:/tmp)
  Error type/ Nr.: Warning - 2
  File: /home/jackal/public_html/shtuck/forum/Sources/Load.php
  Line: 2135
  Line 2135 source: $key = md5($boardurl . filemtime($sourcedir . '/Load.php')) . '-SMF-' . $key;

you can view the site here

any help would be greatly appreciated

thanks
Logged
pixelchutes
Coding Team
*
Posts: 801



WWW
« Reply #8 on: Apr 23, 2007, 03:50 PM »

Looks like a permissions issue. What are the file permissions (CHMOD) of your /forum and /forum/Sources directories?
Logged

Mike Reid - www.pixelchutes.com
MODx Team Member / Contributor
[Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
________________________________
Where every pixel matters.
shtuck
Jr. Member
*
Posts: 12


« Reply #9 on: Apr 23, 2007, 05:50 PM »

both 755, does that sound about right?

sorry, im not too sure what it should be
« Last Edit: May 01, 2007, 08:17 PM by shtuck » Logged
Brocoli
Jr. Member
*
Posts: 15


« Reply #10 on: Apr 24, 2007, 04:39 PM »

Code:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
 
PHP error debug
  Error: filemtime() [function.filemtime]: open_basedir restriction in effect. File(/Load.php) is not within the allowed path(s): (/home/jackal/:/usr/lib/php:/usr/local/lib/php:/tmp)
  Error type/ Nr.: Warning - 2
  File: /home/jackal/public_html/shtuck/forum/Sources/Load.php
  Line: 2135
  Line 2135 source: $key = md5($boardurl . filemtime($sourcedir . '/Load.php')) . '-SMF-' . $key;

I think the variable $sourcedir = '' and it is not OK.

I have noticed that the file "index_php.txt" joined in my first post was empty !  Undecided  I have updated it.

So you need to do the following action specified in my first post :
Replace the file "/forum/index.php" by the one joined in this post: Rename "index_php.txt" to "index.php" and put it in "/forum/" (use diff to see the differences if wanted).
« Last Edit: Apr 24, 2007, 04:49 PM by Brocoli » Logged
shtuck
Jr. Member
*
Posts: 12


« Reply #11 on: Apr 25, 2007, 08:56 AM »

after following those steps i now just get a blank page when i click on my forum link

http://www.shtuck.com
Logged
Brocoli
Jr. Member
*
Posts: 15


« Reply #12 on: Apr 25, 2007, 12:16 PM »

A blank page means that you have a php error somewhere...

To debug, could you add some "echo 'something'" in the file /forum/index.php in order to see exactly where is the problem coming from ?

Code:
echo 'beginning of the file'
...

echo 'debug1';
require(dirname(__FILE__) . '/Settings.php');
echo 'debug2';
// And important includes.
require_once($sourcedir . '/QueryString.php');
echo 'debug3';
require_once($sourcedir . '/Subs.php');
echo 'debug4';
require_once($sourcedir . '/Errors.php');
echo 'debug5';
require_once($sourcedir . '/Load.php');
echo 'debug6';
require_once($sourcedir . '/Security.php');
echo 'debug7';
...
Logged
shtuck
Jr. Member
*
Posts: 12


« Reply #13 on: Apr 25, 2007, 12:28 PM »

still getting a blank page with that code in the php file
Logged
Brocoli
Jr. Member
*
Posts: 15


« Reply #14 on: Apr 25, 2007, 02:15 PM »

Inside modx manager, remove the call to the snippet in the html page named "forum" (if you call it like this).

Retry, you should see an empty page (=just the template).

If not, then the error doesn't come from the forum...
Logged
Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!