Re: How to add a module?

Joe Stewart <[email protected]> Wed, 5 Nov 2003 17:49:21 -0600
Newsgroups gmane.comp.cms.phpslash.devel
Message-ID <[email protected]>
On Wed, Nov 05, 2003 at 03:08:01PM +0000, Peter Cruickshank wrote:
> I'm trying to add a new module to phpSlash 0.8alpha and I need some help... 
> 
> This is what I've done so far.
> 
> 1. Copied the glossary files to use as a basis for my new module (called 
> House)
> - /public_html/glossary.php -> property.php
> - /public_html/admin/glossaryAdmin.php  -> propertyAdmin.php
> - /include/modules/glossary/  -> house/
> 
> (You might be able to work out what the application's for...)
> 
> 2. Edited the code to use House.class instead of Glossary.class
> 
> 3. Edited config.ini.php
>  - Added a new module House = house
>  - Set jpcache.enable = false so I'm looking at live pages
> 
> 4. Added new menu items
> $menuitem[] = array(
>    'name'   => "House",
>    'link'   => $_PSL['rooturl'] . "/property.php",
>    'perm'   => "nobody",
>    'module' => "House"
> );
> 
> and (for admin menu)
> 
> $menuitem[] = array(
>    'name'   => "House",
>    'link'   => $_PSL['adminurl'] . "/propertyAdmin.php",
>    'perm'   => "glossary",
>    'module' => "House"
> );
> 
> 
> This was enough for the admin screen to work (ie the glossary admin screen 
> appears, since I have made no changes to the code), but there was nothing for 
> the main page (property.php).
> 
> After a little thinking and digging around, I did a bit more:
> 
> 5. Created a House section
> 
> 6. Added a new module block
> - Owned by section: House
> - Order number = 90
> - column = center
> - box_type = contentsonly
> - module = House 
> ** Incidentally, the code went berserk when I missed the module paremeter, 
> adding c200 copies of the new module block. I will track this down and submit 
> a fix.
> 
> ...Still nothing. Konqueror helpfully tells me that the connection to the host 
> is broken (which is a lie - it's only that something's going wrong with the 
> page).
> 
> If I remove the link between the House block at the House section, I get a 
> page with an empty center column, so I am fairly sure that the issue is with 
> generating the content to go into the House-module block. 
> 

Sounds like maybe modules/house/index.php is goofy.

> I can't see how to pin it down though.
> - I have put a debug line in modules/house/index.php - it is never reached
> - debug on propery.php shows module.current == "block" (if I force it to 
> 'house' I get the glossary search page, but nothing else)
> 

Ah.  so the index page may be ok.  

> All the debug statements have been removed along the line, so turning debug on 
> isnt helping a whole lot.
> 
> What else do I need to do? I'm sure it's something pretty simple I've missed 
> out...
> 
> 

Don't have much time now but here's a few thoughts.

Looks like you found the way it's mostly setup.

The glossary.php/property.php are not imperative anymore.  The site should
work with:

	http://localhost/phpslash-0.8alpha/public_html/index.php?module=House

If this doesn't work, look at the module/house/index.php code.

If it works, look at property.php,  you can change the section to
something else that seems to work to test.  

Instead of using the House section you can also use ary['module'] =
'House'; instead.  You should get all the blocks for the home page with
the House module in the center.  This is what the admin page does.

By default the public page modules call modules/modulename/index.php.  The
admin pages call modules/modulename/admin.php.

The index page can bring them up like:

index.php?module=modulename&page=admin

The form code in the existing index.php and admin.php hasn't been modified
to work though.  This is what the changes to poll.php, glossary.php
accomplished.

> The benefit of helping me - I will write this up as a how-to for the website 
> once everything's working. Unless there is one already, and I've missed it...
> 

No, there are a few different examples in the example code.

> Thanks in advance!
> 

hope there is something in there.

Joe

> Peter
> 
> 


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/