Hi,
On 16 December 2010 11:15, Harvey Kane <[email protected]> wrote:
> Hi All,
>
> Just a quick question for any Joomla users out there (looking at you
> Jochen). I'm new to Joomla and are doing a reskin job today, which is urgent
> like everything else so my usual approach of reading a book and running
> through tutorials won't work here.
>
> sure.
> I'm needing to customise the various interactive elements (modules) to look
> like what the designer supplied - eg the search form, login form, category
> listing in the sidebar etc.
>
> The design is very specific and I'm not able to skin the module's HTML
> using only CSS - in some cases the modules are outputting tables and other
> markup not needed in the design. For little tweaks I'd normally just fire up
> jquery and hide the bits I don't want or move things around, but that's a
> bit of a hack in this case where the formatting is quite different.
> What's the correct Joomla approach to changing the HTML outputted by a
> module? Is there a clean way I can overlay some replacement HTML that won't
> do bad things when the site is upgraded?
>
If the module is true 1.5 compatible, copy the template file from
modules/mod_module/tmpl/default.php to
templates/template_name/html/mod_module/default.php and customise there.
Some modules are not compatible, quickest long term solution is to
- embrace module with unique html comments in template
- write a system plugin (write 2 files and copy/modify one database line)
- use something like:
jimport('joomla.application.menu');
jimport( 'joomla.plugin.plugin' );
class plgSystemLeftmenueffect extends JPlugin
{
var $_db = null;
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor
for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT
references.
* This causes problems with cross-referencing necessary for the observer
design pattern.
*
* @access protected
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.0
*/
function plgSystemLeftmenueffect(& $subject, $config)
{
parent :: __construct($subject, $config);
}
function onAfterInitialise(){
$document =& JFactory::getDocument();
$document->addScriptDeclaration(
"window.addEvent('domready', function() {
$$('.leftmenu li.parent ul').each(function(el){
var myFx = new Fx.Slide(el);
myFx.hide();
});
$$('.leftmenu li.active ul').each(function(el){
var myFx = new Fx.Slide(el,{duration: 2500});
myFx.slideIn('vertical');
});
});
");
}
function onAfterRender()
{
global $mainframe;
if ($mainframe->isAdmin()) return;
$content =& JResponse::getBody();
$found = substr(
$content,
strpos($content,'<!--leftmenu_start-->'),
strpos($content,'<!--leftmenu_end-->')-strpos($content,'<!--leftmenu_start-->')
);
$content =
substr($content,0,strpos($content,'<!--leftmenu_start-->')).
$found.
substr($content,strpos($content,'<!--leftmenu_end-->'));
JResponse::setBody($content);
}
}
>
> Second question. There is a category menu to show in the sidebar (generated
> by redSHOP), and each item needs a unique graphic (a little icon
> representing the category). Is there a standard way to add an extra field to
> the database, a file upload field to the admin UI, and to read the field in
> the frontend? This one isn't such a biggie as the client will be getting the
> designers to make new graphic should they start adding new categories etc,
> so if it's easier to hard-code the files then that would be acceptable here.
>
No. My solution is to:
- write backend plugin that injects button into backend screen (see above,
same technique)
- write simple backend component that handles the user interface to edit
image)
Simpler version:
- write backend plugin that injects parameter field into Joomla sidebar
(most components have parameters)
- Joomla or component handles parameter saving
>
> Thanks for any help,
>
Let me know if you need more detail.
P.S.: Thanks again for your inspiring "working in Europe" presentation.
>
> Harvey.
>
>
>>>>> "Harvey" == Harvey Kane <[email protected]> writes:
Harvey> What's the correct Joomla approach to changing the HTML
Harvey> outputted by a module? Is there a clean way I can overlay
Harvey> some replacement HTML that won't do bad things when the
Harvey> site is upgraded?
Hacking the module...
As above, not necessary and not the right approach, thanks.
On 16 December 2010 11:39, Paul Bennett <[email protected]> wrote:
> !??
>
> Wait, you can't subclass it or custom theme it?
> If not, is it possible that one module upgrade could damage the whole
> site's layout or theming/templating?
>
> Surely Joomla allows you to use custom themes / templates on module
> templates or site components? (Coming from a SilverStripe / Drupal
> background here so forgive me if I'm drawing parallels for things which
> aren't present in Joomla)
>
> I've dealt with Harvey's Silverstripe code before and he's pretty careful
> to keep things neat, tidy and maintainable so I can understand where he's
> coming from with this one - not all of us want to hack and walk away as
> we're often going to be maintaining these beasts and a clean core codebase
> is often the first step to avoiding maintenance nightmares.
>
> Paul
Berend is not known being a big Joomla fan and given the amount of things I
get him to fix on our Joomla sites that is probably not going to improve.
We have our friendly debates however, his criticisms are sound (albeit
incomplete, ey Berend!)
> P.S.: How to have good password security (for Everyone, Business Owners and
> Web Developers) http://post.ly/1L92U
>
> Kind Regards,
>
> Jochen Daum
>
> Chief Automation Officer
> Automatem Ltd
>
>
>
> Christmas Holidays: 23 Dec, 5pm - 3 Jan, 8am
>
> Phone: 09 630 3425
> Mobile: 021 567 853
> Email: [email protected]
> Skype: jochendaum
> Website: www.automatem.co.nz
> http://twitter.com/automatem
> http://nz.linkedin.com/in/automatem
> http://www.xing.com/go/invite/3425509.181107
> http://www.aucklandbusinessnetworking.co.nz
>
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]