Joomla tips and tricks
- STEFi - 2009-12-01 15:48:18
several joomla templates and compoments developer tips and tricks: breadcrumbs navigation inside content component, css list menu separator...
CSS list menu separator
Usual
horizontal menu delimiter is
pipe "|". There is no any feature like this in the
mod_mainmenu in
Joomla 1.5.x. In menu module parameters there is separator value that it is used only in case of rendering menu as a table. It is not clean usage of table anymore. The easiest way to create css separator is use override method inside yours template.
1. Create "html/mod_mainmenu" folder inside your template folder.
complete path to this folder: joomla-home/templates/your-template-name/html/mod_mainmenu/
2. Copy default.php from modules/mod_mainmenu/tmpl to created folder.
3. Edit default.php and change
this:
if ($node->name() == 'ul') {
foreach ($node->children() as $child)
{
if ($child->attributes('access') > $user->get('aid', 0)) {
$node->removeChild($child);
}
}
to
if ($node->name() == 'ul') {
foreach ($node->children() as $child)
{
if ($child->attributes('access') > $user->get('aid', 0)) {
$node->removeChild($child);
}
}
$children_count = count($node->children());
foreach ($node->children() as $child) {
if ($children_index == 0) {
$child->addAttribute('class', 'first');
}
if ($children_index == $children_count - 1) {
$child->addAttribute('class', 'last');
}
$children_index++;
}
}
Breadcrumbs navigation inside content component
Sometime graphic designers became crazy and place breadcrumbs navigation in the middle of content. How to solve it. I use again small trick from
Joomla forum. I disable bradcrumbs module in module manager. And overwrite com_content for rendering breadcrumbs module directly.
My example:
folder:
my-template/html/com_cocntent/section/
file (I made changes only in this template):
blog.php
change:
I need to place navigation after section description... added code on line 31 after endif of description block:
<?php // ls 20091201 - breadcrumbs
$document = &JFactory::getDocument();
$renderer = &document->loadRenderer('module');
$Module = &JModuleHelper::getModule('mod_breadcrumbs');
echo $renderer->render($Module);
?>