Log in | Register | Lost password

Bottom
Image Linked to a Category List
  • Posted: 30.12.2005, 00:23
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Hi,

    I am trying to link an image to a category list on user input form.
    So on a user input form there would be a category field with say list of countries, user selects country name from the list and that gets stored in the database. The category value would be displayed in template together with the associated country flag pulled from the local directory.

    It would be great if someone could help with this.

    Thanks
  • Posted: 30.12.2005, 08:20
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    1) Create country category. Make sure the value field for each category is "dk", "uk", "d" or similar country codes.

    2) Upload country images named "dk.gif", "uk.gif" etc.

    3) Add image tag in template:

    <img src="imagedir/<!--[$pub.country.value]--"/>

    Check Pagesetter manual for $pub.country.value notation - I'm not sure about the "value" name.
  • Posted: 30.12.2005, 13:59
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    very easy indeed. Note the below code for a template I have. "icon" is the field name for a list. The list contains the names of the icons (and gifs)
    cat = cat.gif
    dog = dog.gif
    and so on...

    Rather than using "value" you have to use "title" and you must specify the image extension after the name otherwise it won't work and will not validate...

    Code

    <img src="/themes/qcp/images/<!--[$icon.title]-->.gif" alt="icon" />




    edited by: RemShowdown, Dec 30, 2005 - 02:59 PM
  • Posted: 30.12.2005, 21:36
     
    Converted
    rank:
    12
    registered:
     March 2009
    Status:
    offline
    last visit:
    Posts:
    0
    Thanks a lot to both of you, with "title" property that works just fine.

    Happy New Year to all. :-)

Template courtesy of Designs By Darren.