Copied to clipboard

Flag this post as spam?

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


  • bob singh 47 posts 126 karma points
    Apr 26, 2013 @ 10:13
    bob singh
    0

    Making an Image link to a local page

    Hi,

    I am new to Umbraco so please excuse me as I am going to ask a very basic question.

    I have installed the latest 6.0.3 Umbraco with the business template and the umedia templates.

    I need to make an image link to an internal webpage.

    Could someone show me some code on how this is done in an anchor tag and also xslt

    I already know that the image will be uploaded using the Upload Type

    But what do I use to allow the user to link to an existing page on the website and show that link and also make an image click to the page.

    Thanks!

  • Rich Green 2246 posts 4008 karma points
    Apr 26, 2013 @ 10:27
    Rich Green
    0

    Hey Bob,

    You can either use the Upload Control or the media picker, then also on your DocType create a property called imageLink of type Content Picker.

    You then use these two values to display an image and a link however you like, via XSLT or Razor

    Rich

  • bob singh 47 posts 126 karma points
    Apr 26, 2013 @ 10:52
    bob singh
    0

    Hi rich,

    Thanks for your quick response.

    I have done what you have said and have decided to use the following code staright into the template to create a dynamic link

    Image...

    This works and sends the user to the selected page http://listerivf.whclpreview.com/1107  but it shows an id in the url, is there any way I can get the page name to show in the URL i.e http://listerivf.whclpreview.com/egg-donors.aspx

    Thanks!

     

     

  • Rich Green 2246 posts 4008 karma points
    Apr 26, 2013 @ 11:15
    Rich Green
    0

    Hey Bob,

    Yes, you need to use NiceUrl instead of jsut the ID, I can't see your code, I think it got messed up by the editor.

    Rich

  • bob singh 47 posts 126 karma points
    Apr 26, 2013 @ 11:21
    bob singh
    0

    Hi Rich,

    Apologies, the code looks like this -

    <a href="<%= umbraco.presentation.nodeFactory.Node.GetCurrent().GetProperty("imageLink").Value %>">
              <umbraco:Image runat="server" field="au1" width="302" height="215" class="thumbnail" /></a>
  • bob singh 47 posts 126 karma points
    Apr 26, 2013 @ 11:41
    bob singh
    0

    Got it!

    <a href='<umbraco:Item runat="server" field="imageLink" xslt="umbraco.library:NiceUrl({0})" />' >More info</a>

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft