Copied to clipboard

Flag this post as spam?

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


  • Darren Wilson 238 posts 646 karma points
    Oct 26, 2011 @ 23:43
    Darren Wilson
    0

    Images display as ID

    Hi,

    Sorry, another question!

    I've added a Media Picker property to my document type. I want the image to be displayed but on the Media Library ID of the item is displaying - here's the text I've used to call the image:

    <umbraco:Item field="image" runat="server"></umbraco:Item>

    I'm pretty new to this - is this the right line of code. Please forgive my ignorance.


    Thanks in advance

    Darren

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Oct 26, 2011 @ 23:52
    Jan Skovgaard
    0

    Hi Darren

    In order to fetch the image you need to use the GetMedia extension in XSLT.

    Normally when using XSLT extensions you would need to create a XSLT based macro, which should then be placed in your template in order to render the image. But you can also use inline xslt directly in your template.

    You can see some samples on how to use inline XSLT in this wiki post: http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/inline-xslt - There's actually also an example of the syntax to show the image for a current page.

    You can read more about the GetMedia extension and it's usage here: http://our.umbraco.org/wiki/reference/umbracolibrary/getmedia

    Hope this helps.

    /Jan

  • Darren Wilson 238 posts 646 karma points
    Oct 27, 2011 @ 00:00
    Darren Wilson
    0

    Great, Yan. I'll give this a try.

    Whilst I'm on - I've accidentally deleted something from my basic starter kit that's causing a run time error. It was a <form></form> type thing towards the bottom. A little knowledge can be dangerous! Any ideas?

    Is there somewhere where these files can be downloaded so I can keep a copy on my hard drive - this will prevent me deleting things in the future!

    Darren

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Oct 27, 2011 @ 00:03
    Jan Skovgaard
    0

    Hi Darren

    You're welcome.

    Could you perhaps post the full error message you're seeing now?

    Perhaps it's a serverside form that has been deleted, which maybe needs to be there?

    /Jan

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Oct 27, 2011 @ 00:06
    Lee Kelleher
    1

    Hi Darren,

    With displaying an image, there's a little trick (if you are using the uComponents package? If so you'll need to activate the Media XsltExtension):

    <umbraco:Item runat="server" Field="image" Xslt="ucomponents.media:GetImageHtml({0})" XsltDisableEscaping="true" />

    Otherwise, follow Jan's advice about GetMedia.

    Cheers, Lee.

  • Darren Wilson 238 posts 646 karma points
    Oct 27, 2011 @ 00:10
    Darren Wilson
    0

    Hi Yan,

    I deleted it from the starterkit master file - here's the error…

    Server Error in '/' Application.


    Runtime Error

    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>

    </configuration>


    And here's the Starterkit Master code:

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"[]>
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head id="head" runat="server">
        
      
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title><asp:placeholder runat="server"><umbraco:Item runat="server" field="pageName" /> - <umbraco:Item runat="server" field="siteName" recursive="true" /></asp:placeholder></title>
       
        <link rel="stylesheet" types="text/css" href="/css/style.css" />  
        <link rel="stylesheet" types="text/css" href="/css/pro-dropline.css" />
       
      
      <umbraco:Macro Alias="BlogRssFeedLink" runat="server"></umbraco:Macro>
        
    </head>
      <body>
      
      <div class="container" align="center">
      <div class="header"></div>
      <div class="menu" style="float:left">
        <div class="nav">
        <div class="table">
        <ul class="select"><umbraco:Macro Alias="umbTopNavigation" runat="server" /></ul>
        </div>
      </div>
      </div>
      
      

      
        
        <div id="main">
          
    </div>
        
        <asp:ContentPlaceHolder id="footerPlaceHolder" runat="server">
        <div id="footer">My footer standard text here</div>
        </asp:ContentPlaceHolder>
        </div>
      </body>
    </html>
    </asp:content>

  • Darren Wilson 238 posts 646 karma points
    Oct 27, 2011 @ 00:49
    Darren Wilson
    0

    Hi Yan,

    I figured this out:

    <form id="RunwayMasterForm" runat="server">
               <asp:contentplaceholder id="cp_content" runat="server"></asp:contentplaceholder>
              </form>

    Not sure what this does, but I won't be deleting it again!


    Darren

  • Darren Wilson 238 posts 646 karma points
    Oct 27, 2011 @ 01:12
    Darren Wilson
    0

    Hi Jan,

    This works a treat:

    You can see some samples on how to use inline XSLT in this wiki post: our.umbraco.org/.../inline-xslt - There's actually also an example of the syntax to show the image for a current page.

    You can read more about the GetMedia extension and it's usage here: our.umbraco.org/.../getmedia

    Thanks again!

    Darren

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies