Joomla! Discussion Forums



It is currently Fri Nov 27, 2009 9:05 am (All times are UTC )

 




Post new topic Reply to topic  [ 63 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Main Menu Image Links
Posted: Wed Feb 06, 2008 12:29 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Sep 09, 2005 10:03 am
Posts: 6
hi
first great work on joomla 1.5.
whats the media upload component you are using to enable the multiple selection of files?

i was just playing around a little bit and wondered why it isn't possible to create just image links only within the menu manager

so i started to have a look at the whole mainmenu module.
i tested it within an project of mine and it does good work.

the changes are within the 3 files:

/modules/mod_mainmenu/legacy.php line 144
Code:
code to be replaced:
if ($params->get('menu_images'))
   {
      $menu_params = new stdClass();
      $menu_params = new JParameter($mitem->params);

      $menu_image = $menu_params->def('menu_image', -1);
      if (($menu_image <> '-1') && $menu_image) {
         $image = '<img src="'.JURI::base(true).'/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>';
         
         if( $params->get('menu_images_link') ){
            $txt = '<a href="'.$mitem->url.'" class="'.$menuclass.'" '.$id.'>'.$image.'</a>';
         } else {
           if ($params->get('menu_images_align')) {
              $txt = $txt . ' ' . $image;
           } else {
              $txt = $image . ' ' . $txt;
           }
          }
      }
   }


/modules/mod_mainmenu/mod_mainmenu.php line 41
Code:
code to be added:
$params->def('menu_images_link', 0);


/modules/mod_mainmenu/mod_mainmenu.xml line 58
Code:
code to be added:
   <param name="menu_images_link" type="radio" default="0" label="Menu Icon Link" description="Link on Images Instead of Text">
          <option value="0">No</option>
      <option value="1">Yes</option>
   </param>


i think this solution would be great if it will be within the next package :)
what are your thoughts about this?

edit:
i just found out that this is only working on legacy list can't find the point to add it to list view.
im currently working on it.

greets


Last edited by mSalcher on Wed Feb 06, 2008 12:52 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Wed Feb 06, 2008 1:00 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Oct 05, 2005 7:25 am
Posts: 1012
Location: Amsterdam
I think this is a ver nice thing to have.
May be this can be placed on the Joomla 1.5 wishlist :)

_________________
Joomla Bug Squad

Note: Sending me private messages for personal support, without this been requested, would lead to ignoring any of your posts in future!


Top
   
 
Posted: Tue Mar 11, 2008 12:21 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Mar 11, 2008 12:02 pm
Posts: 10
Location: Porto, Portugal
Fantastic work mSalcher. Definitely it should be added to the next Joomla editon!!!!

I was wondering if you could help me with the other mainmanu issue. When we choose as a Main Menu Type an Alias which creates a Link to an existing Menu Item, there are no advanced options which would allowed us to set an image to that menu. Do you know how to add this options to that functionality??

Best

Sylwia.

_________________
...when i was born the doctor said - "there is something wrong inside that baby head" ...


Top
  E-mail  
 
Posted: Tue Mar 11, 2008 4:27 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Sep 09, 2005 10:03 am
Posts: 6
hi thx for the commendation.

hm if i get it right, you would like to create an alias for an already existing item.
that means you will have one item ( e.g. Content ) accessable over 2 different menu links?
this is not a good idea, cause google will indicate this as double content and therefore you
get an bad pagerank.

but i can have a look at it.

regards


Top
  E-mail  
 
Posted: Tue Mar 11, 2008 6:25 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Mar 11, 2008 12:02 pm
Posts: 10
Location: Porto, Portugal
no problem :)

I don't know if you already discovered that functionality, but joomla aloud to create alias to already existing items and it works pretty fine. You can find it when you want to create a new item in some menu and while choosing a Menu Type, the last position is Alias. The point is that this option doesn't have "Parameters Advanced", so i thought, since you already discovered how to add an option to "Parameters Advanced" in other menu type, maybe it will be easier for you to discover also this. The stuff which is especially missing there (for me) is the option of image (icon) link, the same what you add above.

And about the google pagerank... well... I think it must be this way in this specific example. The company want exactly the same page, so... let's see.

Anyway... thanks for help.

Best

_________________
...when i was born the doctor said - "there is something wrong inside that baby head" ...


Top
  E-mail  
 
Posted: Tue Mar 18, 2008 5:11 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Mar 18, 2008 4:59 pm
Posts: 7
Thank you for sharing this!

Here is what I did to get this working in "non legacy mode"...

change in modules/mod_mainmenu/helper.php
line 51
Code:
             if (array_key_exists($row->parent, $ids)) {
add 1 line:
                $row->ionly = $params->get('menu_images_link');
                $menu->addNode($row);


line 295
Code:
if ($iParams->get('menu_image') && $iParams->get('menu_image') != -1) {
         $image = '<img src="'.JURI::base(true).'/images/stories/'.$iParams->get('menu_image').'" alt="" />';
add 3 lines:
         if($tmp->ionly){
            $tmp->name = null;
         }
      } else {
         $image = null;
      }


at least this worked for me...

<edit>
maybe I should mention that these changes must be made in ADDITION to the changes above :)
</edit>


Last edited by nk111 on Wed Mar 19, 2008 7:48 am, edited 1 time in total.

Top
  E-mail  
 
Posted: Wed Mar 19, 2008 12:07 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Mar 11, 2008 12:02 pm
Posts: 10
Location: Porto, Portugal
Thx a lot. I will check it in themorning.

Best ;-)

_________________
...when i was born the doctor said - "there is something wrong inside that baby head" ...


Top
  E-mail  
 
Posted: Sun Mar 30, 2008 6:15 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Jan 17, 2008 9:34 am
Posts: 8
what changed in 1.5.2?.
I was using this when I was building a site with 1.5.1, worked great.
Then when trying to get event list to work, I clicked load sample to basicly see a example of how it would look, and well. it completely deleted the directory I was working in, the entire subdirectory with the site in it was deleted (bummer)

so I came back to joomla.org to get the install again, saw they had a new version so i got that, proceeded to rebuild the site, (lucky my template that I was working on was saved on hd) when I went to get the menu working, I used this code again, and well, its not working the same.
I use a horizontal menu along the top, and I have to fit within a specific width to allow allvideos reloaded to be on the top of the page aswell (site for a band).
and I get 2 difrent problems.
first if I set the menu as horizontal I get a stupid gradient red to black around my image and and makes the link area about 2.5 times larger (not allowing me to fit all my options up there.
second problem is, If i set it as list, it displays both text and image with a boarder around the image

Never had the problem in 1.5.1 but cant get around it in 1.5.2

http://www.reclusiveproductions.com/Neg ... e&Itemid=1


Top
  E-mail  
 
Posted: Sun Apr 13, 2008 4:17 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Sun Apr 13, 2008 4:00 pm
Posts: 1
This piece of code was exactly what I was looking for. Unfortunately there appears to be a little bug in it, whereby it does not respect the "On Click, Open in" options on the "Menu Item: [Edit]" screen (Joomla 1.5 screen) .

What the code does now is always navigate to the link set on the image in the same browser window. You can no longer open the link in a new window (with or without navigation)

To fix this, in place of this line of code

$txt = '<a href="'.$mitem->url.'" target="_blank" class="'.$menuclass.'" '.$id.'>'.$image.'</a>';

inside the

if( $params->get('menu_images_link') ){

statement, I added the following switch statement instead

switch ($mitem->browserNav)
{
// cases are slightly different
case 1 :
// open in a new window
$txt = '<a href="' .$mitem->url. '" target="_blank" class="' .$menuclass. '" ' .$id.'>'.$image.'</a>';
break;

case 2 :
// open in a popup window
$txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->url . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\" " . $id . ">".$image."</a>\n";
break;

case 3 :
// don't link it
$txt = '<span class="' . $menuclass . '" ' . $id . '>' .$image. '</span>';
break;

default : // formerly case 2
// open in parent window
$txt = '<a href="' . $mitem->url . '" class="' . $menuclass . '" ' . $id . '>' .$image. '</a>';
break;
}

which I lifted from a few lines above in the legacy.php file and slightly modified.

Hopefully this will save someone else some time if they run into the same situation.

cyrus

ps there's probably a better way to code this or integrate it in but I'm not a PHP coder. I just pieced this together from the other code I saw when I figured out how it was working.


Top
  E-mail  
 
Posted: Wed Jul 23, 2008 3:46 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Mon Jul 02, 2007 2:02 am
Posts: 33
How about different images for different templates? Ie. A beach hut for an image of "home" menu item for a page with a beach template, and then an image of a castle for "home" menu item in another page with another template.

Is this possible?


Top
  E-mail  
 
Posted: Sun Oct 05, 2008 1:34 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 5760
Location: New York
Everytime you create a new link you can assign an image to it just like you can assign a template to it.

_________________
Read your words before posting and think about how other people will read them.
Be polite. Be kind. Be constructive. Say thank you.
Freedom-Equality-Trust-Community-Collaboration-Usability
http://opensourcematters.org/index.php?Itemid=134


Top
   
 
Posted: Fri Oct 24, 2008 6:59 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Jun 05, 2008 9:01 pm
Posts: 18
Thanks to both nk111 and mSalcher:
nk111 wrote:
Thank you for sharing this!

Here is what I did to get this working in "non legacy mode"...

<edit>
maybe I should mention that these changes must be made in ADDITION to the changes above :)
</edit>


It appears to me that these improvements (both the "legacy mode" and the "non-legacy mode") are indeed included in 1.5.7. EXCEPT that the addition (/modules/mod_mainmenu/mod_mainmenu.php line 41) of
Code:
$params->def('menu_images_link', 0);

is NOT there in 1.5.7. Is that intentional?

Nevertheless, it appears to me that the helper.php code is still not working correctly in 1.5.7 (with or without the suggested line 41 in mod_mainmenu.php).

Here's my problem: I have menu_images and menu_images_link both turned on and images assigned to some mainmenu top level menus (Sections). The radio buttons to turn these on are in the "Other Parameters" panel of the mod_mainmenu Module page in the BackEnd. This is working fine on the Home Page. Trouble is: on any other page, the mainmenu displays as though both menu_images and menu_images_link were off.

More specifically, in /modules/mod_mainmenu/helper.php at line 297, the "if" statement
Code:
      if ($params->get('menu_images') && $iParams->get('menu_image') && $iParams->get('menu_image') != -1)

succeeds when I'm on the Home page, while it fails on all other pages. Furthermore, even if I try to work around that, no matter what I do, the values
Code:
$params->get('menu_images')
and
$params->get('menu_images_link')

in helper.php get evaluated correctly (1) for the Home page and incorrectly (0) for all other pages.

I can't see any reason why this mainmenu code should act differently on the Home page from other pages. I really need a fix, so it works on all pages the way it works on the Home page. Help!


Top
  E-mail  
 
Posted: Sat Oct 25, 2008 2:09 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Jun 05, 2008 9:01 pm
Posts: 18
Solved my own problem here. What I failed to realize was that a different instance of the mainmenu module is in control on the non-Home pages. I have a submenu in the left column that displays the Categories, for example, when I'm on a Section page. I had failed to turn on menu_images and menu_images_link in the Module editor for that instance. All better now.


Top
  E-mail  
 
Posted: Wed Jun 24, 2009 10:52 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Feb 26, 2008 3:57 pm
Posts: 34
didnt work for me in joomla 1.5.11

saying a parse error


Top
  E-mail  
 
Posted: Wed Jun 24, 2009 9:27 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 5760
Location: New York
What doesn't work? This functionality is included in the core now.

_________________
Read your words before posting and think about how other people will read them.
Be polite. Be kind. Be constructive. Say thank you.
Freedom-Equality-Trust-Community-Collaboration-Usability
http://opensourcematters.org/index.php?Itemid=134


Top
   
 
Posted: Thu Jun 25, 2009 6:06 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Jan 08, 2009 8:39 am
Posts: 6
Location: Romania
mcsmom wrote:
What doesn't work? This functionality is included in the core now.

can you be more specific? I'm just started with joomla (Joomla! 1.5.11 Production/Stable [ Vea ] 03-June-2009 03:30 GMT) and I'm trying to convert my static site and I have a horizontal image-menu. I tried a lot of combinations with the internal links (although I need it to be external) but to no avail. the only result I get is
| clickable text [not-clickable-image} | clickable text [not-clickable-image} | etc
whereas I need
| [clickable image] | [clickable image] | etc
some are internel links, some are external links.
thanks


Top
   
 
Posted: Mon Jun 29, 2009 7:01 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Jan 08, 2009 8:39 am
Posts: 6
Location: Romania
I managed to solve my problem using the following module: http://extensions.joomla.org/extensions ... 55/details
works pretty nice, dont' forget to set the background color properly when you use transpareny ;)


Top
   
 
Posted: Fri Jul 03, 2009 8:44 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Nov 30, 2005 7:19 am
Posts: 8
mcsmom I also do not see how this function is included in the core. When I place an image into the menu and choose to make it linkable, the menu text is still there.

I am looking to make an image menu with different style for inactive, active and rollover. From what I see I will be able to use an transparent gif for the image and using css be able to give each menu item a different beackground for hover and active. Problem is that the text for the menu item is still there like "home" and "contact" . So far I haven't been able to figure out how to get rid of it. : ( Any help would be appreciated.

If i use the module mentioned above, it doesnt look like there is an active style for the menu images. So if contact is the active page... you cant have an image of "contact" in red and the others in white. I need a way where the active link is a different color than the rest.

Josh


Top
  E-mail  
 
Posted: Fri Jul 03, 2009 2:58 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 5760
Location: New York
You may have somehting in your overrides forcing the text then.
If i add an image to a menu item and then go to the module and say show image and make image linkable i get just the image.

_________________
Read your words before posting and think about how other people will read them.
Be polite. Be kind. Be constructive. Say thank you.
Freedom-Equality-Trust-Community-Collaboration-Usability
http://opensourcematters.org/index.php?Itemid=134


Top
   
 
Posted: Fri Jul 03, 2009 6:20 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 5760
Location: New York
Ha! I looked in IE7 and see the problem. Can you please make a report in the issue tracker.

_________________
Read your words before posting and think about how other people will read them.
Be polite. Be kind. Be constructive. Say thank you.
Freedom-Equality-Trust-Community-Collaboration-Usability
http://opensourcematters.org/index.php?Itemid=134


Top
   
 
Posted: Sun Jul 05, 2009 2:47 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Nov 30, 2005 7:19 am
Posts: 8
Actually for me, you were right. There were two modules using the same menu and I think that was causing a problem. Also it only works in list mode. Not in legacy list, horizontal, or flat. Worked fine in ie7 and ff. Now I am wondering what bug you found ; )

Josh


Top
  E-mail  
 
Posted: Sun Jul 05, 2009 5:17 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 5760
Location: New York
LOL yeah it definitely does not work in legacy menu styles, but you should not be using them if you can help it.

_________________
Read your words before posting and think about how other people will read them.
Be polite. Be kind. Be constructive. Say thank you.
Freedom-Equality-Trust-Community-Collaboration-Usability
http://opensourcematters.org/index.php?Itemid=134


Top
   
 
Posted: Mon Jul 20, 2009 1:32 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Tue Jul 07, 2009 2:02 am
Posts: 7
I am trying to get my menu images working WITHOUT having the text hyperlinks still next to the image so I've been reading this post and trying to edit my helper.php file. I have tried everything suggested and I still have text hyperlinks next to my images and they are the only way to get to the "pages" they are supposed to lead to. The images do not link anywhere. Can someone please help me figure out how to make this happen?
I know you'll probably need to see files so please let me know which you need to see and I will post them.
The preview so you can see how the images look right now (which by the way, they also need to be re-sized so they look terrible right now!) is http://berkshirecoupon.com/joomla/
By the way, I'm obviously new to Joomla. When the site is complete, does the url need to still include "joomla" or do I need to do something so that it doesn't have to?
Thank you in advance!


Top
  E-mail  
 
Posted: Sun Jul 26, 2009 3:03 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 5760
Location: New York
But does it work in Fire Fox?

_________________
Read your words before posting and think about how other people will read them.
Be polite. Be kind. Be constructive. Say thank you.
Freedom-Equality-Trust-Community-Collaboration-Usability
http://opensourcematters.org/index.php?Itemid=134


Top
   
 
Posted: Mon Jul 27, 2009 9:51 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Mon Jul 27, 2009 9:49 am
Posts: 1
Yea, I see the code in the new version, but it doesn't work properly.

OS X w/Firefox


Top
  E-mail  
 
Posted: Tue Jul 28, 2009 4:36 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Thu Aug 18, 2005 8:43 pm
Posts: 5760
Location: New York
Make sure you went to the menu module and told it to use linkable images. This is not in the menu item, but in the actual module.

_________________
Read your words before posting and think about how other people will read them.
Be polite. Be kind. Be constructive. Say thank you.
Freedom-Equality-Trust-Community-Collaboration-Usability
http://opensourcematters.org/index.php?Itemid=134


Top
   
 
Posted: Fri Aug 14, 2009 12:16 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Sep 10, 2008 2:43 pm
Posts: 33
Location: Ankiniz, France
Hello,

From J! 1.5.9 this solution is somehow integrated in, right ?

Anyway, what I'm looking for is to have my menu with HTML code containing title="Name of the link" filled up, to use the onmouse over tip effect.
Actually it would be rather simple to override output or core hack, modifying code to add that tag. Now, where it is tricky is that I do not know how to call with J! framework the "Name of the link" (I mean the one by which linked are sorted in menu item list on J!'s back-end).

To summarize, code's currently like this :
Code:
<a href="http://********/forum" target="_blank"><img src="/images/stories/ds_chope.png" alt="forum" align="left">

I would like it like this :
Code:
<a href="http://********/forum" title="Join the forum !" target="_blank"><img src="/images/stories/ds_chope.png" alt="forum" align="left">

(Adding title="Join the forum !" in)

In which file and with which framework method shall I do that ?
(Running J! 1.5.14)

Thank you very much in advance for your support !

_________________
A bullet may have your name on it, but shrapnel is addressed "to whom it may concern".


Top
  E-mail  
 
Posted: Wed Aug 19, 2009 9:30 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Online

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7689
Location: Europe
Mod Note: Bump post deleted, please do not bump your posts.

Did you try a layout overwrite?

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Wed Aug 19, 2009 10:06 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Sep 10, 2008 2:43 pm
Posts: 33
Location: Ankiniz, France
Thanks for your answer and sorry for the bump.

Well... I ain't mind using layout overdrive. But I have no clue how to call the link name with J! framework.

This is the reason of my main question :
In which file and with which framework method shall I do that ?

_________________
A bullet may have your name on it, but shrapnel is addressed "to whom it may concern".


Top
  E-mail  
 
Posted: Wed Aug 19, 2009 1:29 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Online

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7689
Location: Europe
Which Menu Style are you using?

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 63 posts ]  Go to page 1, 2, 3  Next

Quick reply

 



Who is online

Users browsing this forum: uglykidjoe and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group