TROOZERS talking joomla!
Now that I have the new look and version running, I will go through all the stories and make sure they are relevant and indicate which version of Mambo they are for!
 
Home arrow Joomla arrow Hacks arrow troozFlash Module and Hack
Spacer
spacer
Talking Joomla Spacer Spacer
Troozers
troozFlash Module and Hack
Monday, 15 November 2004

hack iconTo be honest I wasn't quite sure where to file this article; module development or hack?  It is both, as I have had to add extra functionality to the mambo core to provide some functionality for my modules parameters, which were not previously available.

The module I have developed is called troozFlash, for want of a better name, which allows the administrator to define which content item they want displayed in the module area - a bit like newsflash but without the randomisation (a customisation asked for).

The hack?  Well, to enable parameters within a module you need to define these within an XML file along with the module script.  The mambo core does provide some pre-defined drop down lists, such as categories, but not one listing the content items available within the site. 

The following describes how to enable this, which can be downloaded as a hack here, and as a module here.

/path-to-mambo/includes/mamboxml.php
On line 316, before "function _form_jos_category", enter the code highlighted in yellow;

/**
* @var string The name of the form element
* @var string The value of the element
* @var object The xml element for the parameter
* @return string The html for the element
*/
        function _form_jos_content( $name, $value, &$node ) {
                global $database;
                                                                                                                            
            $database->setQuery( "SELECT id AS value, title AS text FROM #__content WHERE state=1 ORDER BY title" );
                $options = $database->loadObjectList();
                array_unshift( $options, mosHTML::makeOption( '0', '- Select Content Item -' ) );
                return mosHTML::selectList( $options, "params[$name]", "class='inputbox'", 'value', 'text', $value );
        }
                                                                                                                            
        function _form_jos_category( $name, $value, &$node ) {
                global $database;

 

This allows a developer to include a dropdown of published content items within a modules parameter file, like the following example;

/path-to-mambo/modules/mod_yourmodulename.xml

 

                <param name="contentid" type="jos_content" default="0" label="Content item" description="A content item" />
                <param name="image" type="radio" default="0" label="Show images" description="Display content item images">
                        <option value="1">Yes</option>
                        <option value="0">No</option>
                </param>

 

 

That's it, all of the above allows you to display a specific content item  within your module area, or if you are a developer, to display your published content items within a modules parameters (as shown below).

mod_troozflash parameters


These are now available within the downloads page, or linked within this article.  Hopefully someone will find a use for this; if you do, drop me a line

 
< Prev   Next >
Spacer
Latest News
Partner Sites
jh design! banner

 RocketTheme Banner

Projects Completed
Amazon Ad
Bottom
Copyright © 2006, Andy Stewart. All Rights Reserved. Joomla! design by jh! design
Spacer Footer