Text Size

Members login

Recommend Print

Creating a drop down select that is displayed to as an image

  • Published by
    Georgios Papadakis
  • Last modified
    29 January 2012
  • Up to date
    Yes
  • Profile concerned
    End user, Webdesigner, Developer
  • Concerns
    Component Plugins
  • Since Version
    1.5.4
  • Voting
    (2 votes)
  • Favourites
    Add to favourites [1 users]

It is possible to create a field that appears as drop down select in item edit form, but in item display it appears as an image.

This is possible without creating (programming) a new field type. For this you will need to

  • place your images in path inside joomla root folder, for example: images/stories/manufacturer/
  • and use as display text for the select field the name of your images without their filename extension

e.g. if your images are: image_name1.jpg, image_name2.jpg, cannon.jpg, hp.jpg, lexmark.jpg,
you can create this output
in your frontend (the html code bellow displays an image)

<img width="80" src="images/stories/manufacturer/cannon.jpg" />
  1. Create a new select field
  2. Set "Remove Space" to YES
  3. Enter as Field elements (Set "Use SQL query" to NO)
    1::image_name1%% 2::image_name2%% 3::cannon%% 4::hp%% 5::lexmark
  4. In prefix text enter:
    <img width="80" src="images/stories/manufacturer/
  5. In suffix text enter:
    " />
NOTE 1: the above is not 100% strict html compliant, since the image does not have a title (alt tag parameter) but it will work in any browser NOTE 2: In above code you can specify width (width="80") and height if you want, but the images are shrinked to the specified width without creating any thumbnails, so take care not to use too big images, and thus add delay to your page, plus if your images are of correct size they will appear better.

Community

ggppdk : Online 199 mins yaK2manD : Online 317 mins xhyman : Online 422 mins algardata : Online 1066 mins netcoupe : Online 27259 mins
Members Online: 5

Latest Comments

Latest Forum Posts

Posted by xhyman - 17/05/2012 18:00
Posted by yaK2manD - 17/05/2012 17:51
Posted by ggppdk - 17/05/2012 17:47
Posted by yaK2manD - 17/05/2012 17:41
Posted by algardata - 17/05/2012 16:45
Posted by yaK2manD - 17/05/2012 14:56