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?
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.
This willprint an imageby a field width an alias ofproduct image. The result, of this when is rendered are something like this in the HTML:
<imgsrc="/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.
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?
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.:
How are you defining the images in the backoffice? And how are you outputting those?
/Chriztian
I am defining them through a wysiwig but I need to know a better way it's essentially a product image.
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.
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:
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
is working on a reply...