Trying to build a very basic module

johnbrawn

Joined: 2005-10-05
Posts: 4
Posted: Tue, 2007-05-22 23:24

I have some programming background, but not in php. I'm trying to build a very simple gallery 2 module that creates a sidebar block with up to 3 admin specified urls in it. This will provide links that my users can click to jump out of gallery and into other content on related web servers.

I have a medium sized multi-site installation that require unique url links each. I had created these links in the past by creating a theme (a copy of Matrix) for each site and writing the urls directly into the local/sidebar.tpl files of the themes. However, all my themes broke when I upgraded from 2.1.0 to 2.2.1. So I think it would be easier in the long run to write one module that could be shared between all the multi-sites, that each multi-site can configure for the specific link section that it needs.

I can activate my module, and I can select the "Ext URL" block in the sidebar configuration dialog in the matrix theme. The default entries come up OK.

The part I'm missing is how do I write the module's entries into the database, so that the correct values appear in my .tpl code when gallery renders a page? I suspect I need a some kind of store function in a Callbacks.inc file, but I've just not been able to get it figured out.

How do the database entries for a specific module get written to the db when the admin saves a configuration page?

I've spent a fair bit of time looking through the various developer resources, but I just haven't found a sort of beginners description of how a Callbacks.inc file should work and what the calls / syntax need to be.

I would appreciate any help or pointers you could give me on how this should all work! I welcome collaborators!

Thanks!
John.

AttachmentSize
exturl.zip2.3 KB
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2007-05-23 12:53
 
cowmoo

Joined: 2007-07-18
Posts: 20
Posted: Fri, 2007-07-20 02:24

Downloaded the code attached in the first post, and noticed you've got a small syntax error:

'exturlBlockWint1' => array(
	    'description' => $gallery->i18n('Open New Window'),
	    'type' => 'boolean',
	    'default' => 'true'),

Should be (if I'm not mistaken):

'exturlBlockWin1' => array(
	    'description' => $gallery->i18n('Open New Window'),
	    'type' => 'boolean',
	    'default' => 'true'),

Removed the t from exturlBlockWint1

Just thought I'd mention this (it's given me grief before)

cOwMoO