Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • cchy1988 3 posts 23 karma points
    Feb 26, 2013 @ 08:54
    cchy1988
    0

    Dynamic banner images

    Hello people,

    I am new to umbraco, so exuse me if this is a dumb question. I've already spent too many hours on google trying to fugure out how to do this simple task, but couldn't get to a right direction.

    Here's what i am trying to do:

    The home page of the website has 3-4 'placeholders' which will display images(banner ads), simple images inside <a> tag. Client should be able to change those images. 

    I'm kind of lost between all those macro, xslt, media types and everything. I was thinking of something like:

    1) there are predefined images for all different plaeholders like 'banner1', 'banner2' etc. Whenver client wants to change the image displayed in the postion of banner1 he/she edit the 'media' file called 'banner1' and uploads a different image

    2) then in the page template those images are included through a macro or something

    That's what i've understood, but dont know how on earth to do that!!

    Any help is greately appreciated!

    Thanks.

  • Hundebol 167 posts 314 karma points
    Feb 26, 2013 @ 09:25
    Hundebol
    0

    Hi, and welcome to Our,

    Like most things in umbraco there are several ways to do, what you are trying to do.

    The easiest way to start, is to add 3-4 "upload" propreties to you Homepage-document type. You could call the properties Image1, Image2, and so on...
    Then you go to you Homepage-node and upload actual images via the upload-mechanism - and then save a publish.
    Now go to you Homepage-template and click the icon for "insert umbraco page field" - from the list, choose "Image1" or whatever you called your property. (this will give you the path to the image)

    You can the wrap the page field into and img tag, and then you have a image on the frontpage. Like so:

    <img src="<umbraco:Item field="mainImage" runat="server" />" />


    best regards

    Brian

  • cchy1988 3 posts 23 karma points
    Feb 28, 2013 @ 07:40
    cchy1988
    0

    Hi, Hundebol thank you so much. I did what you suggested but i've run into one small problem. <img src="<umbraco:Itemfield="mainImage"runat="server"/>" /> gives me something like <img src="7451" /> which i believe is the id of the image node (instead of image's url). I've run into this problem more than once. Few days back i was instaling nivoslider plugin for umbraco, even there i'd get image id's instead of url. So is it something which i am not doing the right way??

  • Hundebol 167 posts 314 karma points
    Feb 28, 2013 @ 08:39
    Hundebol
    0

    Hi,

    You have probably chosen a Media Picker, right? You need to choose an "upload"-control instead - this will give you the full path. Media Pickers gives you the image-id, which is a bit harder to deal with in templates.

  • cchy1988 3 posts 23 karma points
    Feb 28, 2013 @ 09:05
    cchy1988
    0

    yes!! that worked. thanks

  • Hundebol 167 posts 314 karma points
    Feb 28, 2013 @ 09:34
    Hundebol
    0

    Great! And no problem - there are several other ways to do this, but this is the easiest.

    Remember to mark you question solved, to help others find solved problems.

    have a nice day, best regards,
    hundebol 

  • Rik Helsen 670 posts 873 karma points
    Feb 28, 2013 @ 09:37
    Rik Helsen
    0

    advanced suggestion:

    • you can create a folder in your media section for each banner type
    • create a custom media type that has a few fiels:
    1. (checkbox) with the name "Active campaign"
    2. text field 'Hyperlink' with validation for a URL
    3. checkbox "open in new window"  (can appent a "target=blank" property to the hyperlink

    If you then create a little xslt or razor script for each set of banners that'll randomly select an active image from the selected folder, you'll actually have some variation in your website, and your content managers will be able to manage the banner campaigns more easily. Specially if you have to do with multiple languages on your website a solution like this is more interesting.

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft