PDA

View Full Version : Use PPPro, Classifieds, Review as a PHPNUKE module. How?


batmon
September 1st, 2004, 11:35 AM
Hi,

I did some searches on this forum but I don't see any info about how to set all three applications as PHPNUKE modules. Some ppl talking about using iframe. I would like to try that but there is no instructions on how to do that. I did try add the following codes to index.php

on the very top:

if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
die ("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));

$pagetitle = "- $module_name";
global $bgcolor2, $sitename, $prefix, $db, $module_name;
include("header.php");
OpenTable();


at the end:

CloseTable();
printfooter();
include("footer.php");


It works on the first page such as http://www.housingideas.com/modules.php?name=PPClassifieds but every page after does not work. I guess I can add the same "header" and the "footer" to each PHP file, but the main thing is all the links inside the pages, they all point to http://www.housingideas.com/modules/PPClassifieds/xxx.php, not http://www.housingideas.com/modules.php?name=PPClassifieds&file=xxx, etc. Can you tell me how to make all three applications work as Nuke modules? Since many people already ask, can you post some procedures on how to make this work? Thank you.

batmon
September 1st, 2004, 01:22 PM
Okay, I found out a bit. I only try this with Classifieds for now...

What I did is just edit the header-inc.php file and add this in there


if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
die ("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));

$pagetitle = "- $module_name";
global $bgcolor2, $sitename, $prefix, $db, $module_name;
include("header.php");
OpenTable();


This will make all PPClassifieds pages work like module, so this is a good news!!

I haven't figure out how to add footer tho... I need "footer-inc.php" added with


CloseTable();
include("footer.php");


Now, I have to somehow make all the URL links works as Nuke module. Any thoughts on what's the best mod to do this? Basically I need to change all the URL links from something like

http://www.housingideas.com/modules/PPClassifieds/showproduct.php?product=1

to

http://www.housingideas.com/modules.php?name=PPClassifieds&file=showproduct&product=1

batmon
September 1st, 2004, 01:37 PM
Okay... I made NUKE footer works now too...

Here is what I did. go to pp-inc.php and find function printfooter( $headers = "yes" ) {

in this function, there is a line says print "</body></html>";, a line before return;

Change print "</body></html>"; to

if ($Globals['vbversion'] == "nuke") include "footer-inc.php";
else print "</body></html>";


I guess for the URL links inside, we need to create some kinda function call, is it? Can any of the developer give me some ideas before I did all the changes? Thank you.

batmon
September 1st, 2004, 02:36 PM
I guess no one is home today... sounds like I am just talking to myself...

This is what I did to make all the links in PPClassifieds work with PHPNUKE module. I need to change all the {$Globals['maindir']}/index.php tho...

However, I wrote a small function to make PPClassifieds still detect if you are using PHPNUKE or not. If you are using other authenications, then the link will still work correctly.

First, I add a function in pp-inc.php file

function url_link( $url_path ) {
global $Globals;
if ($Globals['vbversion'] == "nuke") {
$url_path = str_replace(".php", "", $url_path);
$url_link = "modules.php?name=PPClassifieds&file=".$url_path;
}
else $url_link = $Globals['maindir']."/".$url_path;
return( $url_link );
}

Then, on all the PHP files, instead of
{$Globals['maindir']}/index.php, you need to use the function call.

For example a link like,

<a href=\"{$Globals['maindir']}/index.php\">

now should change/replace to

<a href=\"".url_link("index.php")."\">

This is a bit of work. PhotoPost developer... can you add this to your next version so PHPNUKE users do not have to do this change on every new releases??

Now you can say PhotoPost works as PHPNUKE module now!! Do I get any rewards on this?? B=0

Feel free to let me know if you have any questions. Now I have to go through all the href links and mod it...

thanks.

Chuck S
September 1st, 2004, 03:01 PM
Well we only discuss the unmodified code of our products on the support forum

You can discuss the how to's of your mods on the hack site http://www.photopostdev.com

I visited your site and I can tell you whatever you have done does not work at all. You indeed do have the module working for the index however the rest of the program does not work.

batmon
September 1st, 2004, 03:06 PM
What do you mean the rest does not work? I know I still need to change the a href link inside, I haven't done that yet...

for example, this does not work

http://www.housingideas.com/modules/PPClassifieds/showproduct.php?product=1

But this does

http://www.housingideas.com/modules.php?name=PPClassifieds&file=showproduct&product=1

right?


I just haven't got to all of them yet. Please read my post since I do spend time try to help out. Thank you.

Chuck S
September 1st, 2004, 03:21 PM
well I am just pointing on the obvious. You said in your post above you got it all working yet when I visited none of the links worked.

As I stated if you want to post what you did you can do so at photopostdev.com

batmon
September 1st, 2004, 03:45 PM
I have no idea why you so unhappy about this. I changed most of the links and maybe you can try it out now. There are still some links need to be changed.

As I said, if you can add this to the future versions, that will be nice. Thank you.

Chuck S
September 1st, 2004, 03:55 PM
No one here is unhappy.

I have posted twice you can post code modification on the hack site. Code modifications are not discussed here. You initial post was to ask how to alter your code. I referred you to the hack site. We do not support alterations to code on the support forum.

You may sign in to the members area and post a suggestion if this is what your attempting to do in the photopost suggestions forum.

We do not track suggestions in the general forum

batmon
September 1st, 2004, 04:13 PM
I still don't get it. Try to make the header works, then the footer works, then the URL links and I post what I found here to share with others. I already login as member and I thought "general discussion" is a member only forum... I was excited about what I can make it work with Nuke and all I am getting from you is "I can tell you whatever you have done does not work at all." or post it somewhere else... I thought trying to make it work with PHPNUKE module is a good thing, isn't it? Don't you guys wanna look into that?

If I post in http://www.photopostdev.com, are you guys wanna help to make this work since I am a paid member?


Well we only discuss the unmodified code of our products on the support forum

You can discuss the how to's of your mods on the hack site http://www.photopostdev.com

I visited your site and I can tell you whatever you have done does not work at all. You indeed do have the module working for the index however the rest of the program does not work.

Chuck S
September 1st, 2004, 04:59 PM
This is a support forum where we help users who have issues with the the UNALTERED distributions of our programs who are seeking support. We do not discuss or support code alterations here.

If you for instance go to VBulletin Support and ask in a support forum how to hack for instance country flags or something into your VB forum. They are going to point you to the VB Hack site. This is nothing abnormal. This is the same thing I am doing.

You may as I suggested post a suggestions in the suggestions forum of example "Hey Guys how about looking into Nuke Module Support"

However your asking us as you have in this thread to help hack your install so it will work as a module I pointed you to a hack site where hacks are discussed.

batmon
September 1st, 2004, 08:17 PM
Great, please tell me how to make PPPro, PPClassifieds and PPReviews work with PHPNUKE as module. I saw some posts but didn't tell much, or please give me some pointers.

Thank you.

Michael P
September 1st, 2004, 08:34 PM
I'm not sure how to make it work as a module, although we've put in change as recommended by users who have. Information from users doing this is greatly appreciated and we'll do what we can to help; but I dont run phpnuke or know much about it.

batmon
September 1st, 2004, 09:18 PM
thanks. Just want you to know that I just bought all 3 software yesterady and just start using it this morning. All I am doing is trying to set it up to work with my PHPNUKE, that's all. It's not like I am trying to hack it or something.

Yes, it's my pleasure to share with you all what I found, that's why I post what I did here and hoping that you can add them to the new release to make them work better with PHPNUKE. I mean I am buying software to use it, not mod it for fun. :-p It will be super nice if I don't have to change anything and just install it to make it work with NUKE. :D

I am more then happy to test it out for you. Please let me know what I can do to help, thank you.

Chuck S
September 1st, 2004, 09:27 PM
As I have stated and Michael did as well if you figure it out you may let us know the changes you made so we can in the future try and do module support

FYI if you alter your coding as you have been doing to get it to work as a module it is considered hacking. Thus the suggestion to post on the hack site

Our Software works with Nuke as we advertise. It uses the Nuke user database so a user has one login to both programs.

Michael P
September 1st, 2004, 11:13 PM
I think one of the issues that needs to be worked out is the forward() function in pp-inc.php; I removed all the forwards and replaced them with this improved function which tries to call photopost as a module; only nobody has told me the format of a module call.

If you look at this function, you might see what needs to be done - or at the least, tell me what the URLs are suppose to look like and I'll try to help you make the proper changes.

Chuck S
September 2nd, 2004, 08:09 AM
The format is this

http://www.domain.com/modules.php?name=photopost&file=showphoto&photo=1

Basically the name is the program name and every file call is just the filename no extention.

This is more than a forward change.

If you truly wanted to make Photopost Module compatible EVERY link needs to be changed throughout the program. Below is an example of a part of pmenu in showphoto 458-460

if ( $usercomment == 1 && $Globals['allowpost'] == "yes" ) {
$pmenu .= "<a href=\"{$Globals['maindir']}/comments.php?photo=$id\">{$Globals['pp_lang']['post']}</a>";
}

would be

if ( $usercomment == 1 && $Globals['allowpost'] == "yes" ) {
if ( $Globals['vbversion'] == "nuke" && $Globals['module'] == "yes" ) {
$pmenu .= "<a href=\"{$Globals['vbulletin']}/modules.php?name=photopost&file=showphoto&photo=$id\">{$Globals['pp_lang']['post']}</a>";
} else {
$pmenu .= "<a href=\"{$Globals['maindir']}/comments.php?photo=$id\">{$Globals['pp_lang']['post']}</a>";
}

Basically the entire program and every link needs to be written to that format posted above for module support

Michael P
September 2nd, 2004, 08:58 AM
Ah, okay, I can see what you mean. Making all the links conditional for PN would be an excessive overhead for everyone else (given the small percentage of PN users). I'll have to give it some thought.

batmon
September 2nd, 2004, 02:41 PM
Yeah, that's why I am thinking maybe you can do a function call to change the link around based on what user is using PP with.

So I add small function call in pp-inc.php

function url_link( $url_path ) {
global $Globals;
if ($Globals['vbversion'] == "nuke") {
$url_path = str_replace(".php", "", $url_path);
$url_path = str_replace("?", "&amp;", $url_path);
$url_link = "modules.php?name=PPClassifieds&file=".$url_path;
}
else $url_link = $Globals['maindir']."/".$url_path;
return( $url_link );
}

and instead of

"<a href=\"{$Globals['maindir']}/comments.php?photo=$id\">

maybe we can use something like this in the future

url_link("comments.php?photo=$id")

This way, if user using NUKE, then it will change to the NUKE link. Else, it will use standard link. I try to keep it as much unchanged on your codes as possible...

about forward(), I do see you have codes for postnuke, but not PHPNUKE. I add the followings after the "if ( $Globals['vbversion'] == "postnuke" )" to make the forward() works for PHPNUKE

elseif ( $Globals['vbversion'] == "nuke" ) {
$redirect = str_replace(".php", "", $redirect);
$redirect = str_replace("?", "&amp;", $redirect);
$redirect = "modules.php?name=PPClassifieds&file=".$redirect;
}

batmon
September 2nd, 2004, 02:48 PM
or we can do what omegatron says, but with a function call will be easier. Just wrap the URL with a function call. Now it will work with PostNuke, PHPNuke or any other module based CMS. All we have to do is modify the function call a bit to fit the needs. Hope this help.

$pmenu .= "<a href=\"{$Globals['maindir']}/comments.php?photo=$id\">{$Globals['pp_lang']['post']}</a>";

$pmenu .= url_link("<a href=\"{$Globals['maindir']}/comments.php?photo=$id\">")."{$Globals['pp_lang']['post']}</a>";

Chuck S
September 2nd, 2004, 02:52 PM
Either way Batmon as Michael stated the overhead of adding a conditional switch's everywhere is not good.

The work load in this basically involves changing every single link in our program and I dont rightly know that a forward call on every single link in the program is the best thing to do. In fact with any program the less forwards their are the better.

The Developer will weigh out the pro's and con's based on the percentage of Nuke customers

batmon
September 2nd, 2004, 03:02 PM
Great, thanks. Just want you to know that the forward() call and the url_link() is different. I am just hoping that you can use the idea of forward() that you guys already did, and apoply the same idea to change the links dynamically. This will make the PP product line more comp. with other CMS. Hoping that this one time deal "link changes" will make all the future versions much easier to enhance.

I think the reason that PHPNUKE and POSTNUKE users not using PhotoPost is because they don't really work together?? If we can fix this then I am sure your market share will be even bigger than now.

Just my two cents...

mlucek
September 20th, 2004, 03:59 PM
The Developer will weigh out the pro's and con's based on the percentage of Nuke customers

I think the reason that PHPNUKE and POSTNUKE users not using PhotoPost is because they don't really work together?? If we can fix this then I am sure your market share will be even bigger than now.

Guys, it's a classic Catch-22 situation.

There are not very many *nuke customers because PP et.al. provides little integration outside of user authentication, for the *nuke and other CMS's. AND the PP folks provide little support for *nuke CMS's (and others like Mambo) because there's not many *nuke customers.

One follows the other.

If all it takes to make PP, etc. work natively with the *nuke's/other CMS's are some sort of URL rewrite/forward function (which is what the *nukes do anyway) and the related code changes + header/footer related too, then it's a one-time thing. I suspect it would only take < 1 day to make these changes, probably much less (Batmon - how long did it take you ?) I doubt if there's much more PHP server overhead in handling another if statement. Though there's probably a better way for that function then to use str_replace. The PP code already uses a strcat function to build the URL. Can look at the *nuke or gallery source code to see what they do. Then if there are any other CMS changes, they're pretty much isolated to that function.

The open source Gallery (http://gallery.menalto.com) project does just that - it detects if it's running standalone, or embedded (e.g. phpNuke or PostNuke) and modifies the url's on-the-fly accordingly.

One guy has PP running as a PostNuke module at:

www.anointed.net

I believe he's using URL rewrites via Apache and some minor code includes to accomplish the same thing.

There are numerous folks that I know of (me included & I've already purchased PP, but haven't deployed it yet because of lack of integration - not fond of FRAMES) that would love to use PP in their *nuke sites. There's talk about that on the PostNuke, phpNuke and Mambo forums and probably a few others that I'm not aware of. I'm not a fan of Gallery's layout so am looking to move away from that. Folks not happy with Gallery are moving to the opensource Coppermine (http://coppermine.sourceforge.net/) gallery which is pretty darn good alternative and pretty darn nice looking too.

Soooooo, Michael/omegatron, whattu think ? Certainly can't hurt to give it a try ? I'll be happy to alpha/beta test if for you. The old movie line: Build it and they will come. There are literally 100's of 1000's of *nuke sites out there.