Link module title
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Sat Apr 19, 2008 9:37 am
Link module title
Hello,
I'm trying to put a link in main menu module title. Can I achieve that with a simple trick (I didn't see anything in menus options) or an extension ?
I can't use simple multi-level menu (with the parent fonction) with only css design because I need templates/system/html/modules.php file xhtml customisation to add all xhtml elements needed for my already built full css pop-out menu working (especially for IE - always IE : standard multi-levels ul li lists can't achieve that).
I looked at some complete menu extensions like lxMenu which could do that but, as I said, my template is already built (comming from my static html site previous version), so wouldn't like to flush all my cross-browsers-hard-design and have to recode all that from scratch, dealing with someone else's big, full-featured (and "code-full") script just for that little title-link purpose.
Suggestions ? Can some Joomler help a newbie on this Joomla-Planet ?
I'm trying to put a link in main menu module title. Can I achieve that with a simple trick (I didn't see anything in menus options) or an extension ?
I can't use simple multi-level menu (with the parent fonction) with only css design because I need templates/system/html/modules.php file xhtml customisation to add all xhtml elements needed for my already built full css pop-out menu working (especially for IE - always IE : standard multi-levels ul li lists can't achieve that).
I looked at some complete menu extensions like lxMenu which could do that but, as I said, my template is already built (comming from my static html site previous version), so wouldn't like to flush all my cross-browsers-hard-design and have to recode all that from scratch, dealing with someone else's big, full-featured (and "code-full") script just for that little title-link purpose.
Suggestions ? Can some Joomler help a newbie on this Joomla-Planet ?
-
- Joomla! Apprentice
- Posts: 8
- Joined: Sat Apr 19, 2008 9:37 am
Re: Link module title
It's ok.
Someone on Joomla.fr gave me a great tip to add any personal input to the backend.
I simply had a PARAM to the mod_mainmenu.xml ; then I can add my URL in module admin and get it in templates/mytemplate/html/modules.php with $params->get('titleLink'). Fantastic!
Someone on Joomla.fr gave me a great tip to add any personal input to the backend.
I simply had a PARAM to the mod_mainmenu.xml ; then I can add my URL in module admin and get it in templates/mytemplate/html/modules.php with $params->get('titleLink'). Fantastic!
- dorjano
- Joomla! Explorer
- Posts: 432
- Joined: Tue Aug 30, 2005 11:26 am
- Location: Slovenia
- Contact:
Re: Link module title
Hi ollvin
could you be more specific please. I too had once this requirement but I solved it differently. Would be nice if you could describe your solution in more detail.
D.
could you be more specific please. I too had once this requirement but I solved it differently. Would be nice if you could describe your solution in more detail.
D.
Moderator of Slovenian Forum
-
- Joomla! Apprentice
- Posts: 8
- Joined: Sat Apr 19, 2008 9:37 am
Re: Link module title
Ok. Let's be more "specific". (That's for J!1.5, I don't know if this was part of previous versions) Don't pay attention to approximativ labels, that's my own translation (my Joomla! language is French).
Open the file your_joomla_folder/modules/mod_mainmenu/mod_mainmenu.xml where are stored all parameters fields you can find in the right column, in a menu module properties page in Joomla admin (Extensions/Module manager/Your menu).
You can add a <PARAM ...> line anywhere you want with a new name (variable name in the database) and an intelligible label (like "the stuff I did some day", hum...) (each <PARAMS></PARAMS> section is a conterner group of parameters in the admin, like Module parameters, Advanced parmeters...). I choosed to put my own parameter at the end of the first contener because it's displayed first when you open your module page (Be lazy ). Like this :
Save and upload your file and go to a menu module properties in the Module manager : tada! there's a nice field "Title link URL" on the right. Put any URL coming out of your mind in it and save.
By the way, if you are curious, you can go to your database admin, table jos_modules, your_menu line and look at the field params, you can see a line like this one :
(That's Walt Disney's secret postmortem blog... Chht! Don't tell anyone)
Magic ! Your URL is now stored in the database.
So. Let's come back to our J! trick.
Open templates/system/html/modules.php : you can see one function () for each style option available when you insert a <jdoc:include type="modules" name="X" style="Y"/> tag in your index.php template file.
You could modify the XHTML one but it's not really good if you what to keep that normal option for any other purpose than your "title linked" menu.
Let's add a new option.
First we're going to put it in our own my_template folder to be more flexible later, (and J! standard compliant, of course...). Create a html/ folder in your template folder and copy the modules.php file there : templates/my_template/html/modules.php
Open this new copy and delete all function () blocks (they can't be set twice - in system folder and in your_template folder - this causes an error) or keep just the XHTML one to modify it. Give the function an other name. You can add all your esoteric html around <?php ?> place holders and - finally - add the magic place holder <?php echo $params->get('titleLink'); ?> to output your URL in some < a href=""> attribute. Like this :
Save and upload your file.
Then, don't forget to call your menu with the good jdoc tag style in your index.php template file : <jdoc:include type="modules" name="X" style="XHTMLlinkedMenu"/>
Well, uff... Enough details ?
Open the file your_joomla_folder/modules/mod_mainmenu/mod_mainmenu.xml where are stored all parameters fields you can find in the right column, in a menu module properties page in Joomla admin (Extensions/Module manager/Your menu).
You can add a <PARAM ...> line anywhere you want with a new name (variable name in the database) and an intelligible label (like "the stuff I did some day", hum...) (each <PARAMS></PARAMS> section is a conterner group of parameters in the admin, like Module parameters, Advanced parmeters...). I choosed to put my own parameter at the end of the first contener because it's displayed first when you open your module page (Be lazy ). Like this :
Code: Select all
<params>
<param name="menutype" type="mos_menu" default="" label="Menu Name" description="The name of the menu (default is mainmenu)" />
<param name="menu_style" type="list" default="list" label="Menu Style" description="The menu style">
<option value="list">List</option>
<option value="vert_indent">Legacy - Vertical</option>
<option value="horiz_flat">Legacy - Horizontal</option>
<option value="list_flat">Legacy - Flat List</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="startLevel" type="text" default="0" size="5" label="Start Level" description="PARAMSTARTLEVEL" />
<param name="endLevel" type="text" default="0" size="5" label="End Level" description="PARAMSTOPLEVEL" />
<param name="showAllChildren" type="radio" default="0" label="Always show submenu items" description="PARAMSHOWSUBMENUITEMS">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="window_open" type="text" default="" label="Target Position" description="PARAMTARGETPOSITION" />
<!-- HERE IS A BRAND NEW PARAM -->
<param name="titleLink" type="text" default="" label="Title link URL" description="PARAMLINKURL" />
<!-- END OF THE BRAND NEW PARAM -->
</params>
By the way, if you are curious, you can go to your database admin, table jos_modules, your_menu line and look at the field params, you can see a line like this one :
Code: Select all
titleLink=hihihi.com
Magic ! Your URL is now stored in the database.
So. Let's come back to our J! trick.
Open templates/system/html/modules.php : you can see one function () for each style option available when you insert a <jdoc:include type="modules" name="X" style="Y"/> tag in your index.php template file.
You could modify the XHTML one but it's not really good if you what to keep that normal option for any other purpose than your "title linked" menu.
Let's add a new option.
First we're going to put it in our own my_template folder to be more flexible later, (and J! standard compliant, of course...). Create a html/ folder in your template folder and copy the modules.php file there : templates/my_template/html/modules.php
Open this new copy and delete all function () blocks (they can't be set twice - in system folder and in your_template folder - this causes an error) or keep just the XHTML one to modify it. Give the function an other name. You can add all your esoteric html around <?php ?> place holders and - finally - add the magic place holder <?php echo $params->get('titleLink'); ?> to output your URL in some < a href=""> attribute. Like this :
Code: Select all
function modChrome_XHTMLlinkedMenu($module, &$params, &$attribs)
{
if (!empty ($module->content)) : ?>
<div class="TitleLinkedMenu">
<?php if ($module->showtitle != 0) : ?>
<h3><a href="<?php echo $params->get('titleLink'); ?>"><?php echo $module->title; ?></a></h3>
<?php endif; ?>
<div class="TitleLinkedMenuContent">
<?php echo $module->content; ?>
</div>
</div>
<?php endif;
}
Then, don't forget to call your menu with the good jdoc tag style in your index.php template file : <jdoc:include type="modules" name="X" style="XHTMLlinkedMenu"/>
Well, uff... Enough details ?
- dorjano
- Joomla! Explorer
- Posts: 432
- Joined: Tue Aug 30, 2005 11:26 am
- Location: Slovenia
- Contact:
Re: Link module title
wow nice trick! Excellent it works almost perfectly. There is just a little aesthetic issue (see picture). But could be easily avoided with some play with 0 an 1 in
Thanks Ollvin, grate tutorial
Cheers,
Dorjano
Code: Select all
<?php if ($module->showtitle != 0) : ?>
Thanks Ollvin, grate tutorial
Cheers,
Dorjano
You do not have the required permissions to view the files attached to this post.
Moderator of Slovenian Forum
-
- Joomla! Apprentice
- Posts: 8
- Joined: Sat Apr 19, 2008 9:37 am
Re: Link module title
I don't understand why your title is displayed twice. <?php echo $module->title; ?> should output the title (one occurence in my code) and <?php echo $module->content; ?> the... content (links only).
Maybe J! version...
What is the source code for this result ? J! should output links as an unordered list (ul li)...
Maybe J! version...
What is the source code for this result ? J! should output links as an unordered list (ul li)...
- dorjano
- Joomla! Explorer
- Posts: 432
- Joined: Tue Aug 30, 2005 11:26 am
- Location: Slovenia
- Contact:
Re: Link module title
Hmmm. I just use copy-paste from your code. Nothing more and nothing less.
I'm using fresh J! 1.5.2 with the default tempalte ( rhuk_milkyway).
D.
I'm using fresh J! 1.5.2 with the default tempalte ( rhuk_milkyway).
D.
Moderator of Slovenian Forum
-
- Joomla! Apprentice
- Posts: 8
- Joined: Sat Apr 19, 2008 9:37 am
Re: Link module title
Are you sure your menus modules are set on "list" menu style (param in the admin) to output ul content ( <?php echo $module->content; ?> ) ?
Again, what is the source code of this enigmatic display ?
Again, what is the source code of this enigmatic display ?
- dorjano
- Joomla! Explorer
- Posts: 432
- Joined: Tue Aug 30, 2005 11:26 am
- Location: Slovenia
- Contact:
Re: Link module title
As I said, I didn't add nothing more and nothing less. Look at attached pix. List is ON (A), well the only difference it that I use Slovenian transaltion (B).
Look at the code:
mod_mainmenu.xml
and
modules.php
Note: the default rhuk_milkyway tempalte already has this file. I added your code at the end of existing one.
and finally template's index.php (just a modul insertion part)
Look at the code:
mod_mainmenu.xml
Code: Select all
<params>
<param name="menutype" type="mos_menu" default="" label="Menu Name" description="The name of the menu (default is mainmenu)" />
<param name="menu_style" type="list" default="list" label="Menu Style" description="The menu style">
<option value="list">List</option>
<option value="vert_indent">Legacy - Vertical</option>
<option value="horiz_flat">Legacy - Horizontal</option>
<option value="list_flat">Legacy - Flat List</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="startLevel" type="text" default="0" size="5" label="Start Level" description="PARAMSTARTLEVEL" />
<param name="endLevel" type="text" default="0" size="5" label="End Level" description="PARAMSTOPLEVEL" />
<param name="showAllChildren" type="radio" default="0" label="Always show submenu items" description="PARAMSHOWSUBMENUITEMS">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="@spacer" type="spacer" default="" label="" description="" />
<param name="window_open" type="text" default="" label="Target Position" description="PARAMTARGETPOSITION" />
<!-- This is the code I add -Dorjano -->
<param name="titleLink" type="text" default="" label="Naslov modula je ta URL" description="PARAMLINKURL" />
<!-- End of the new code -->
</params>
modules.php
Note: the default rhuk_milkyway tempalte already has this file. I added your code at the end of existing one.
Code: Select all
<?php
/**
* @version $Id: modules.php 9764 2007-12-30 07:48:11Z ircmaxell $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* This is a file to add template specific chrome to module rendering. To use it you would
* set the style attribute for the given module(s) include in your template to use the style
* for each given modChrome function.
*
* eg. To render a module mod_test in the sliders style, you would use the following include:
* <jdoc:include type="module" name="test" style="slider" />
*
* This gives template designers ultimate control over how modules are rendered.
*
* NOTICE: All chrome wrapping methods should be named: modChrome_{STYLE} and take the same
* two arguments.
*/
/*
* Module chrome for rendering the module in a slider
*/
function modChrome_slider($module, &$params, &$attribs)
{
jimport('joomla.html.pane');
// Initialize variables
$sliders = & JPane::getInstance('sliders');
$sliders->startPanel( JText::_( $module->title ), 'module' . $module->id );
echo $module->content;
$sliders->endPanel();
}
// This function was added for showing menu title as a link - by Ollvin FR -Dorjano
function modChrome_XHTMLlinkedMenu($module, &$params, &$attribs)
{
if (!empty ($module->content)) :?>
<div class="TitleLinkedMenu">
<?php if ($module->showtitle != 0) : ?>
<h3><a href="<?php echo $params->get('titleLink'); ?>"><?php echo $module->title; ?></a></h3>
<?php endif; ?>
<div class="TitleLinkedMenuContent">
<?php echo $module->content; ?>
</div>
</div>
<?php endif;
}
?>
Code: Select all
. . .
<div id="area">
<jdoc:include type="message" />
<div id="leftcolumn">
<?php if($this->countModules('left')) : ?>
<!-- The Ollvin code -->
<jdoc:include type="modules" name="left" style="XHTMLlinkedMenu" />
<!-- Original code commented out
<jdoc:include type="modules" name="left" style="rounded" />
-->
<?php endif; ?>
</div>
<?php if($this->countModules('left')) : ?>
<div id="maincolumn">
<?php else: ?>
<div id="maincolumn_full">
<?php endif; ?>
<?php if($this->countModules('user1 or user2')) : ?>
<table class="nopad user1user2">
<tr valign="top">
<?php if($this->countModules('user1')) : ?>
<td>
<jdoc:include type="modules" name="user1" style="xhtml" />
</td>
<?php endif; ?>
<?php if($this->countModules('user1 and user2')) : ?>
<td class="greyline"> </td>
<?php endif; ?>
<?php if($this->countModules('user2')) : ?>
<td>
<jdoc:include type="modules" name="user2" style="xhtml" />
</td>
<?php endif; ?>
</tr>
</table>
<div id="maindivider"></div>
<?php endif; ?>
<table class="nopad">
<tr valign="top">
<td>
<jdoc:include type="component" />
<jdoc:include type="modules" name="footer" style="xhtml"/>
</td>
<?php if($this->countModules('right') and JRequest::getCmd('layout') != 'form') : ?>
<td class="greyline"> </td>
<td width="170">
<jdoc:include type="modules" name="right" style="xhtml"/>
</td>
<?php endif; ?>
</tr>
</table>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
. . .
You do not have the required permissions to view the files attached to this post.
Moderator of Slovenian Forum
-
- Joomla! Apprentice
- Posts: 8
- Joined: Sat Apr 19, 2008 9:37 am
Re: Link module title
Well... I made a test with your code and I think I fixed your problem : simply remove the commented old code. That's a pure J! bug !
It seems J! doesn't see comments and output code when it find a <Jdoc:> tag, even commented. This shouldn't matter : J! output normal code but, as it's commented, browsers don't display it.
But this double occurence strangely makes J! go mad : it also output the the whole second (commented) occurence of the <Jdoc:> in the content part of the first.
Don't ask why...
If you look at the outputed source code in your browser (that's what I meant asking the source code) you see something like this :
I didn't try more tests neither looked at the J! core to understand this bug. Ask the core team if you want.
It seems J! doesn't see comments and output code when it find a <Jdoc:> tag, even commented. This shouldn't matter : J! output normal code but, as it's commented, browsers don't display it.
But this double occurence strangely makes J! go mad : it also output the the whole second (commented) occurence of the <Jdoc:> in the content part of the first.
Don't ask why...
If you look at the outputed source code in your browser (that's what I meant asking the source code) you see something like this :
Code: Select all
<div id="leftcolumn">
<div class="TitleLinkedMenu">
<h3><a href="http://www.editions-theia.com">Livres et musique (Boutique)</a></3
<div class="TitleLinkedMenuContent">
###### Outputing whole rounded version in this content part (this comment wasn't in the code) #####
<div class="module">
<div>
<div>
<div>
<h3>Livres et musique (Boutique)</h3>
<ul id="mainlevel-nav"><li><a href="/joomla/about-joomla" class="mainlevel-nav" >About Joomla!</a></li><li><a href="/joomla/features" class="mainlevel-nav" >Features</a></li><li><a href="/joomla/news" class="mainlevel-nav" >News</a></li><li><a href="/joomla/the-community" class="mainlevel-nav" >The Community</a></li></ul> </div>
</div>
</div>
</div>
###### End of odd output (this comment wasn't in the code) #####
</div>
<div class="TitleLinkedMenu">
###### etc. Other jammed XHTMLlinkedMenu menus come here (this comment wasn't in the code) #####
</div>
###### Then, the commented output (this comment wasn't in the code) #####
<!-- <div class="module">
<div>
<div>
<div>
<h3>Livres et musique (Boutique)</h3>
<ul id="mainlevel-nav"><li><a href="/joomla/about-joomla" class="mainlevel-nav" >About Joomla!</a></li><li><a href="/joomla/features" class="mainlevel-nav" >Features</a></li><li><a href="/joomla/news" class="mainlevel-nav" >News</a></li><li><a href="/joomla/the-community" class="mainlevel-nav" >The Community</a></li></ul> </div>
</div>
</div>
</div>
<div class="module">
###### etc. Other rounded menus come here (this comment wasn't in the code) #####
</div>
-->
</div>
###### End of the leftcolumn (this comment wasn't in the code) #####
- dorjano
- Joomla! Explorer
- Posts: 432
- Joined: Tue Aug 30, 2005 11:26 am
- Location: Slovenia
- Contact:
Re: Link module title
Wohoho! Indeed! You're right, it's unbelievable! I didn't even thought about to check this, then I use Firefox's Web Dev ant there it is. Nice discovery though Ollvin! you should report this bug to the Joomla! team since you discover it. Good job, good job!!! Please DO report this bug!!
Regards,
Dorjano
Regards,
Dorjano
Moderator of Slovenian Forum
- daebat
- Joomla! Explorer
- Posts: 372
- Joined: Tue Jun 05, 2007 7:33 pm
- Location: Atlanta, Ga
Re: Link module title
how can I do this to something other than a menu?
-Daebat
Dictated But Not Read
Dictated But Not Read
- sbinnie
- Joomla! Apprentice
- Posts: 8
- Joined: Wed May 16, 2007 11:17 am
- Location: Richmond Hill, Ontario, Canada
- Contact:
Re: Link module title
I have just written a blog about using Ollvin's concept to create linked titles in Jumi modules. The same can be applied to most Joomla! 1.5 module types.daebat wrote:how can I do this to something other than a menu?
http://www.scottbinnie.com/j15/blog/Lin ... dules.html
-
- Joomla! Apprentice
- Posts: 19
- Joined: Tue Jun 23, 2009 1:43 am
Re: Link module title
If you don't want to make changes to the core file - there are two commercial extensions we offer that can do the trick - Advanced Contexts Manager(full control over modules) and Content Enhancer(enhancing Joomla content in various ways).
-
- Joomla! Apprentice
- Posts: 13
- Joined: Wed Nov 18, 2009 10:45 pm
Re: Link module title
The title of modules is not displayed if "Title link URL" not set.
I added the "else :" and "echo..." lines to the modChrome_XHTMLlinkedMenu function in module.php. Works neatly.
Novices: just replace the whole previously added function in modules.php by this one:
I added the "else :" and "echo..." lines to the modChrome_XHTMLlinkedMenu function in module.php. Works neatly.
Code: Select all
else : // FAB: added because title wasn't displayed if "Title Link URL" is not set.
echo "<h".$headerLevel.">".$module->title."</h".$headerLevel.">";
Code: Select all
function modChrome_XHTMLlinkedMenu($module, &$params, &$attribs)
{
$headerLevel = isset($attribs['headerLevel']) ? (int) $attribs['headerLevel'] : 3;
if (!empty ($module->content)) : ?>
<div class="moduletable<?php echo $params->get('moduleclass_sfx'); ?>">
<?php
if ($module->showtitle) :
if ($params->get('titleLink') !="") :
$destination="";
if ($params->get('titleLinkDestination') ==1) :
$destination=" target=\"_blank\"";
endif;
echo "<h".$headerLevel."><a href=\"".$params->get('titleLink')."\"".$destination.">".$module->title."</a></h".$headerLevel.">";
else : // FAB: added because title wasn't displayed if "Title Link URL" is not set.
echo "<h".$headerLevel.">".$module->title."</h".$headerLevel.">";
endif;
endif;
echo $module->content;
?>
</div>
<?php endif;
}
?>
-
- Joomla! Enthusiast
- Posts: 235
- Joined: Mon Aug 22, 2005 8:56 pm
Re: Link module title
Just discovered a MUCH simpler method to enable links for Module Title bars!!
I just downloaded and installed Sourcerer from nonumber.nl
http://www.nonumber.nl/extensions/sourcerer
In my module title field (from module manager) added this in place of Title Text:
{source}[[a href="http://www.google.com"]]MODULE TITLE NAME[[/a]]{/source}
Then added appropriate css to template.css so the links would display properly.
Presto! Amazing! EASY!!
Not affiliated with NoNumber! but I am a huge fan!!
I just downloaded and installed Sourcerer from nonumber.nl
http://www.nonumber.nl/extensions/sourcerer
In my module title field (from module manager) added this in place of Title Text:
{source}[[a href="http://www.google.com"]]MODULE TITLE NAME[[/a]]{/source}
Then added appropriate css to template.css so the links would display properly.
Presto! Amazing! EASY!!
Not affiliated with NoNumber! but I am a huge fan!!
-
- Joomla! Apprentice
- Posts: 17
- Joined: Wed Apr 13, 2011 9:02 am
Re: Link module title
i use yoo_explorer Template, there is no "<jdoc:include type="modules" name="X" style="Y"/>" tags in my index.php template file.
the index.php code below:
<?php
/**
* @package yoo_explorer Template
* @file index.php
* @version 5.5.7 November 2010
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2010 YOOtheme GmbH
* @license YOOtheme Proprietary Use License (http://www.yootheme.com/license)
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// include config
include_once(dirname(__FILE__).'/config.php');
// load main template file, located in /layouts/template.php
echo $warp->template->render('template');
the index.php code below:
<?php
/**
* @package yoo_explorer Template
* @file index.php
* @version 5.5.7 November 2010
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2010 YOOtheme GmbH
* @license YOOtheme Proprietary Use License (http://www.yootheme.com/license)
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// include config
include_once(dirname(__FILE__).'/config.php');
// load main template file, located in /layouts/template.php
echo $warp->template->render('template');
- RustyJoomla
- Joomla! Explorer
- Posts: 409
- Joined: Wed Aug 01, 2007 12:08 am
- Location: UK
- Contact:
Re: Link module title
How would this work when using the WARP framework as "jdoc include" isn't used in the templates index.php file
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sun Jun 26, 2011 8:14 pm
Re: Link module title
Hi,
I would like to do the same thing as you but instead of a link, I would like to be able to chose an article (like we chose an article when we set a sub-menu to show a simple article). Where I can find the code to able to do that ?
Thank you very much !
Jeff
I would like to do the same thing as you but instead of a link, I would like to be able to chose an article (like we chose an article when we set a sub-menu to show a simple article). Where I can find the code to able to do that ?
Thank you very much !
Jeff
- sbinnie
- Joomla! Apprentice
- Posts: 8
- Joined: Wed May 16, 2007 11:17 am
- Location: Richmond Hill, Ontario, Canada
- Contact:
Re: Link module title
Check the last section and then try the " /layouts/template.php" file.zhizunbao84 wrote:i use yoo_explorer Template, there is no "<jdoc:include type="modules" name="X" style="Y"/>" tags in my index.php template file.
the index.php code below:
<?php
/**
* @package yoo_explorer Template
* @file index.php
* @version 5.5.7 November 2010
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2010 YOOtheme GmbH
* @license YOOtheme Proprietary Use License (http://www.yootheme.com/license)
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// include config
include_once(dirname(__FILE__).'/config.php');
// load main template file, located in /layouts/template.php
echo $warp->template->render('template');
- sbinnie
- Joomla! Apprentice
- Posts: 8
- Joined: Wed May 16, 2007 11:17 am
- Location: Richmond Hill, Ontario, Canada
- Contact:
Re: Link module title
Warp is a Yoo product... there should be a " /layouts/template.php" file to check (see last post)stormit wrote:How would this work when using the WARP framework as "jdoc include" isn't used in the templates index.php file
- sbinnie
- Joomla! Apprentice
- Posts: 8
- Joined: Wed May 16, 2007 11:17 am
- Location: Richmond Hill, Ontario, Canada
- Contact:
Re: Link module title
A quick answer would be that since you are linking to the article, you simply use an article link. However, I think that what you are asking for is a modal link mechanism to select an article from a list of them.jfbeaulieu wrote:Hi,
I would like to do the same thing as you but instead of a link, I would like to be able to chose an article (like we chose an article when we set a sub-menu to show a simple article). Where I can find the code to able to do that ?
Thank you very much !
Jeff
In that case, I suppose it would be possible to put together some kind of kludgy module type to handle it, but I think you would best be served by creating some sort of plugin that has the structure to handle a wider scope of user inputs.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Sun Sep 11, 2011 10:07 am
Re: Link module title
Does anyone have instructions on how to make this hack with joomla 1.7?
-
- Joomla! Apprentice
- Posts: 7
- Joined: Fri Dec 02, 2005 10:28 pm
- Location: Poland
Re: Link module title
[quote="Aly"]Just discovered a MUCH simpler method to enable links for Module Title bars!!
I just downloaded and installed Sourcerer from nonumber.nl
http://www.nonumber.nl/extensions/sourcerer
...
[/quote]
Simple, brilliant and it works:) Thanks.
I just downloaded and installed Sourcerer from nonumber.nl
http://www.nonumber.nl/extensions/sourcerer
...
[/quote]
Simple, brilliant and it works:) Thanks.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Tue Nov 29, 2011 5:49 pm
Re: Link module title
I there a commentary on the wonderful and hard I could take advantage of it Thank youollvin wrote:Ok. Let's be more "specific". (That's for J!1.5, I don't know if this was part of previous versions) Don't pay attention to approximativ labels, that's my own translation (my Joomla! language is French).
Open the file your_joomla_folder/modules/mod_mainmenu/mod_mainmenu.xml where are stored all parameters fields you can find in the right column, in a menu module properties page in Joomla admin (Extensions/Module manager/Your menu).
You can add a <PARAM ...> line anywhere you want with a new name (variable name in the database) and an intelligible label (like "the stuff I did some day", hum...) (each <PARAMS></PARAMS> section is a conterner group of parameters in the admin, like Module parameters, Advanced parmeters...). I choosed to put my own parameter at the end of the first contener because it's displayed first when you open your module page (Be lazy ). Like this :Save and upload your file and go to a menu module properties in the Module manager : tada! there's a nice field "Title link URL" on the right. Put any URL coming out of your mind in it and save.Code: Select all
<params> <param name="menutype" type="mos_menu" default="" label="Menu Name" description="The name of the menu (default is mainmenu)" /> <param name="menu_style" type="list" default="list" label="Menu Style" description="The menu style"> <option value="list">List</option> <option value="vert_indent">Legacy - Vertical</option> <option value="horiz_flat">Legacy - Horizontal</option> <option value="list_flat">Legacy - Flat List</option> </param> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="startLevel" type="text" default="0" size="5" label="Start Level" description="PARAMSTARTLEVEL" /> <param name="endLevel" type="text" default="0" size="5" label="End Level" description="PARAMSTOPLEVEL" /> <param name="showAllChildren" type="radio" default="0" label="Always show submenu items" description="PARAMSHOWSUBMENUITEMS"> <option value="0">No</option> <option value="1">Yes</option> </param> <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="window_open" type="text" default="" label="Target Position" description="PARAMTARGETPOSITION" /> <!-- HERE IS A BRAND NEW PARAM --> <param name="titleLink" type="text" default="" label="Title link URL" description="PARAMLINKURL" /> <!-- END OF THE BRAND NEW PARAM --> </params>
By the way, if you are curious, you can go to your database admin, table jos_modules, your_menu line and look at the field params, you can see a line like this one :(That's Walt Disney's secret postmortem blog... Chht! Don't tell anyone)Code: Select all
titleLink=hihihi.com
Magic ! Your URL is now stored in the database.
So. Let's come back to our J! trick.
Open templates/system/html/modules.php : you can see one function () for each style option available when you insert a <jdoc:include type="modules" name="X" style="Y"/> tag in your index.php template file.
You could modify the XHTML one but it's not really good if you what to keep that normal option for any other purpose than your "title linked" menu.
Let's add a new option.
First we're going to put it in our own my_template folder to be more flexible later, (and J! standard compliant, of course...). Create a html/ folder in your template folder and copy the modules.php file there : templates/my_template/html/modules.php
Open this new copy and delete all function () blocks (they can't be set twice - in system folder and in your_template folder - this causes an error) or keep just the XHTML one to modify it. Give the function an other name. You can add all your esoteric html around <?php ?> place holders and - finally - add the magic place holder <?php echo $params->get('titleLink'); ?> to output your URL in some < a href=""> attribute. Like this :
Save and upload your file.Code: Select all
function modChrome_XHTMLlinkedMenu($module, &$params, &$attribs) { if (!empty ($module->content)) : ?> <div class="TitleLinkedMenu"> <?php if ($module->showtitle != 0) : ?> <h3><a href="<?php echo $params->get('titleLink'); ?>"><?php echo $module->title; ?></a></h3> <?php endif; ?> <div class="TitleLinkedMenuContent"> <?php echo $module->content; ?> </div> </div> <?php endif; }
Then, don't forget to call your menu with the good jdoc tag style in your index.php template file : <jdoc:include type="modules" name="X" style="XHTMLlinkedMenu"/>
Well, uff... Enough details ?
-
- Joomla! Fledgling
- Posts: 3
- Joined: Tue Nov 29, 2011 6:03 pm
Re: Link module title
ollvin wrote:Well... I made a test with your code and I think I fixed your problem : simply remove the commented old code. That's a pure J! bug !
It seems J! doesn't see comments and output code when it find a <Jdoc:> tag, even commented. This shouldn't matter : J! output normal code but, as it's commented, browsers don't display it.
But this double occurence strangely makes J! go mad : it also output the the whole second (commented) occurence of the <Jdoc:> in the content part of the first.
Don't ask why...
If you look at the outputed source code in your browser (that's what I meant asking the source code) you see something like this :I didn't try more tests neither looked at the J! core to understand this bug. Ask the core team if you want.Code: Select all
<div id="leftcolumn"> <div class="TitleLinkedMenu"> <h3><a href="http://www.editions-theia.com">Livres et musique (Boutique)</a></3 <div class="TitleLinkedMenuContent"> ###### Outputing whole rounded version in this content part (this comment wasn't in the code) ##### <div class="module"> <div> <div> <div> <h3>Livres et musique (Boutique)</h3> <ul id="mainlevel-nav"><li><a href="/joomla/about-joomla" class="mainlevel-nav" >About Joomla!</a></li><li><a href="/joomla/features" class="mainlevel-nav" >Features</a></li><li><a href="/joomla/news" class="mainlevel-nav" >News</a></li><li><a href="/joomla/the-community" class="mainlevel-nav" >The Community</a></li></ul> </div> </div> </div> </div> ###### End of odd output (this comment wasn't in the code) ##### </div> <div class="TitleLinkedMenu"> ###### etc. Other jammed XHTMLlinkedMenu menus come here (this comment wasn't in the code) ##### </div> ###### Then, the commented output (this comment wasn't in the code) ##### <!-- <div class="module"> <div> <div> <div> <h3>Livres et musique (Boutique)</h3> <ul id="mainlevel-nav"><li><a href="/joomla/about-joomla" class="mainlevel-nav" >About Joomla!</a></li><li><a href="/joomla/features" class="mainlevel-nav" >Features</a></li><li><a href="/joomla/news" class="mainlevel-nav" >News</a></li><li><a href="/joomla/the-community" class="mainlevel-nav" >The Community</a></li></ul> </div> </div> </div> </div> <div class="module"> ###### etc. Other rounded menus come here (this comment wasn't in the code) ##### </div> --> </div> ###### End of the leftcolumn (this comment wasn't in the code) #####
Very cool thank you