Copied to clipboard

Flag this post as spam?

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


  • Grant 21 posts 61 karma points
    Oct 20, 2013 @ 08:23
    Grant
    0

    Macros displaying html tags?

    Hey guys, when I use a macro to display for instance an image or body text, my macros display the html tags, ie <p> from rich text editor and <img ... ect...any ideas?

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Oct 20, 2013 @ 09:40
    Chriztian Steinmeier
    1

    Hi Grant,

    If you're using the value-of instruction to output body text (or other WYSIWYG-like fields), you can turn off escaping by adding an attribute, i.e.:

    <xsl:value-of select="$currentPage/bodyText" disable-output-escaping="yes" />
    

    How are you defining the images in the backoffice? And how are you outputting those?

    /Chriztian

  • Grant 21 posts 61 karma points
    Oct 20, 2013 @ 10:05
    Grant
    0

    I am defining them through a wysiwig but I need to know a better way it's essentially a product image.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 20, 2013 @ 20:43
    Dennis Aaen
    0

    Hi Grant,

    I think that Chriztian provides a good solution here.

    But if your product image always in top of the WYSIWYG editor before the text or in the end of the
    text you can add the product image by provide a dedicated field for it on the page. It can be done by add a new property to the documenttype for the page type.

    So if your case is what I just described. Go to the Settings section then find the folder Document Types under that folder find the documenttype that represents the type of page where you add the product information stuff. When done that go the the Generic properties tab click on add new property, Give it an name and It will get an alias to. It could be Product image :-) 

    When you have done that, you have to choose a data type of Media Picker. With the media picker you will be able to choose a picture from the media library. When you want to print the image out to the frontend of your site, you have seval options.It be done by adding some XSLT code or Razor an with these type of files, you can add an macro inside your template as you probably already know.

    But if you are using Umbraco 4.11 or a later version you have the opportunity to use the umbraco:image control to print an image in a template.

    An example to be; You can add width and height attributes, and class and id ect.

    <umbraco:Image runat="server" field="productImage" />

    This will print an image by a field width an alias of product image. The result, of this when is rendered are something like this in the HTML:

    <img src="/media/19/73006.jpg" />

    But as I started my post with I think that Chriztian provides you a good solution. This could be a good alternative, if you product image is printet before or after the text from the WYSIWYG.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft