PDA

View Full Version : Joomla 1.5 module with parameter passing


Retep
04-21-2008, 12:01 AM
Hi,
Over the past few weeks I've been attempting to develop a fuller EPC module integration with Joomla 1.5 and I think I've suceeded. However, the version I have at the moment is still a prototype and needs a little work to finish it off to make it more fool proof, but I'm offering it here in case anyone is interested in taking it to the next level. Note: This isn't for the fainthearted just yet - don't go installing this on anything other than an experimental basis, and there is definitely no guarantee that it won't screw anything up.

I was hoping that I could run EPC directly within the Joomla framework, but there's obviously an incompatibility between the 2 applications and so I've ended up placing EPC inside an iFrame wrapper. The problem is that the iFrame sets up a different scope to the Joomla framework and you can't directly access any of the useful variables that the rest of the framework enjoys.

After a bit of effort I was able to develop a mechanism to pass parameters across the iFrame boundary. This means that passing any variable such as $template, $TOC or $LIST can now be done relatively easily.

One of the main issues I found is that the calendar directory (and everything in it) needs to be installed under the calendar module directory. The install file will create a new directory mod_ezcal under joomla/modules/ and calendar will have to be located (at least at present) in joomla/modules/calendar (or similar). If there's a way to force joomla to accept another directory I haven't found it - maybe someone with better ideas could solve that.

I've also modified: joomla/administrator/components/com_modules/controller.php by adding

$params->set('ModuleId',$row->id);

immediately following:
// get params definitions
$params = new JParameter( $row->params, $xmlfile, 'module' );

in the edit function around line 491. BTW - This is optional if you don't mind inserting the module ID manually in the setup screen.

I've found that getting the paths right can be a challenge - there are several files that may need to be touched: mod_ezcal.php, epcwrapper.php and calendar.php. I think the paths for the 1st 2 are reasonably robust but the ones in calendar.php took a while to get right.

So the steps are:

install the attached zip file from the module manager
move/install EPC in the newly created directory
update the controller.php file (if you want to).
update the url/directory variables.Let me know if it works out, particularly if I've forgotten to include anything here of importance, but in the end please treat this as a prototype. If nothing else this should give someone food for thought as there may be better ways of doing this.

310

Peter