How to add a module?

Peter Cruickshank <list-UnZd7gj/[email protected]> Wed, 5 Nov 2003 17:41:28 +0000
Newsgroups gmane.comp.cms.phpslash.devel
Message-ID <[email protected]>
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. 

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)

All the debug statements have been removed along the line, so turning debug on 
isnt helping a whole lot.

(BTW I've put some debugs back in and discovered some interesting things:
- block_i::getBlocks runs through an array of all the blocks 6 times (once for 
each column type)
- pslNew('slashDB') is invoked at least 6 times on a page - I guess meaning 
that psl uses that many mySQL connections per page-invokations.) 

What else do I need to do? I'm sure it's something pretty simple I've missed 
out...


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

Thanks in advance!

Peter
-- 
Ummm, well, OK.  The network's the network, the computer's the computer.
Sorry for the confusion.
		-- Sun Microsystems



-------------------------------------------------------
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/