But, if I try to put the same directly in the HTML (using that feature of the editor), the "<umbraco:Item field="newestEval32Version" runat="server"></umbraco:Item>" gets stripped out.
I suspect I need to modify the editor settings (somewhere) but have no clue where.
Do you mean you're trying to add the umbraco:item syntax to a rich text field, part of a document? If so, then yes indeed, it will be stripped out (that's the nature of tinymce and the way it's configured in umbraco - it tends to strip out invalid html)
Could you tell us a bit more about what you're trying to do?
You cannot use the umbraco:item tag in the HTML Editor. This will not get parsed. However you can use Macro'swith xslt or usercontrols to display data and there is a select box on the macro which allows you to use the macro in the editor (Select from pull-down and fill in the parameters)
I would like to incorporate an Umbraco item(s) in the text of a page. My wish is for the earlier example to render "Current Version: 4.9.0" (no quotes) when the value of the Umbraco item is "4.9.0" (no quotes).
I have no idea on how to create a macro or user control (as Richard suggests). So, an example wwould be great.
I guess if I get one example, then I could modify it for other items(?).
Otherwise, is there any way to tell tinymce that the code is valid?
Here's how to create a macro and display a property from the current document being viewed on the frontend:
-Go to developer section, right click xslt node and select create from the context menu. Select 'Clean' from template dropdown and check 'Create macro' as well. Enter a name for the xslt file (without extension) and hit Ok.
-Copy 'n' paste next little xslt snippet underneath "<!-- start writing XSLT -->":
Current version is:<xsl:value-of select="$currentPage/data [@alias = 'newestEval32Version']" />
-Save your xslt.
-Expand the macro node and find the macro with "same name" as your xslt. Check 'use in editor' as Richard has already suggested.
-Go to your rich text editor field and click on the 'insert macro' button on the toolbar. Select your macro from the list.
-Save and publish your work.
-Browse your page -> you should get your version info on your page now
I tried that and get the "Current version is:" but not the version number. I know the value is in that variable because it works in the template but not on a page that uses the macro.
I can try that but I think the issue is that the item is not "connected" to the page I'm trying to use it on. I will test that notion. But, I think I need to get the info from another page somehow in the macro. Will be back after I try that.
-Expand the macro node in the developer section, select your macro and go to 'Parameters' tab. Add a new parameter (alias is what will be used to reference it) of type number (for simplicity). Make sure to mark 'Show' and save your work.
-Go back to where you're using the macro on, remove it, and re-insert it using the 'insert macro' dialog. Select macro from list, and click Ok. you should be able now to enter the value for the numerical parameter. Enter the id of the node that has the newestEval32Version property!
-Change xlst
Current version is:<xsl:value-of select="umbraco.library:GetXmlNodeById($nodeId)/data [@alias = 'newestEval32Version']" />
NEWBIE: Umbraco item in a page
Thanks in advance for the help.
I need to use an umbraco item in a page.
This works fine in a template:
<div>
<p style="font-size:10px; line-height:normal;margin-left:50px">Current Version: <umbraco:Item field="newestEval32Version" runat="server"></umbraco:Item></p>
</div>
But, if I try to put the same directly in the HTML (using that feature of the editor), the "<umbraco:Item field="newestEval32Version" runat="server"></umbraco:Item>" gets stripped out.
I suspect I need to modify the editor settings (somewhere) but have no clue where.
Robert,
Do you mean you're trying to add the umbraco:item syntax to a rich text field, part of a document? If so, then yes indeed, it will be stripped out (that's the nature of tinymce and the way it's configured in umbraco - it tends to strip out invalid html)
Could you tell us a bit more about what you're trying to do?
Looking forward to your info
Cheers,
/Dirk
Hi Robert,
You cannot use the umbraco:item tag in the HTML Editor. This will not get parsed. However you can use Macro'swith xslt or usercontrols to display data and there is a select box on the macro which allows you to use the macro in the editor (Select from pull-down and fill in the parameters)
Cheers,
Richard
Thanks for the quick replies--much appreciated.
I would like to incorporate an Umbraco item(s) in the text of a page. My wish is for the earlier example to render "Current Version: 4.9.0" (no quotes) when the value of the Umbraco item is "4.9.0" (no quotes).
I have no idea on how to create a macro or user control (as Richard suggests). So, an example wwould be great.
I guess if I get one example, then I could modify it for other items(?).
Otherwise, is there any way to tell tinymce that the code is valid?
Hi Robert,
Here's how to create a macro and display a property from the current document being viewed on the frontend:
-Go to developer section, right click xslt node and select create from the context menu. Select 'Clean' from template dropdown and check 'Create macro' as well. Enter a name for the xslt file (without extension) and hit Ok.
-Copy 'n' paste next little xslt snippet underneath "<!-- start writing XSLT -->":
Current version is:<xsl:value-of select="$currentPage/data [@alias = 'newestEval32Version']" />
-Save your xslt.
-Expand the macro node and find the macro with "same name" as your xslt. Check 'use in editor' as Richard has already suggested.
-Go to your rich text editor field and click on the 'insert macro' button on the toolbar. Select your macro from the list.
-Save and publish your work.
-Browse your page -> you should get your version info on your page now
Hope this helps.
Regards,
/Dirk
Thanks, Dirk.
I tried that and get the "Current version is:" but not the version number. I know the value is in that variable because it works in the template but not on a page that uses the macro.
What should I look for next?
Robert,
Can you add following snippet in your xslt file:
above or below the xsl:value-of statement.
What output do you get then?
I can try that but I think the issue is that the item is not "connected" to the page I'm trying to use it on. I will test that notion. But, I think I need to get the info from another page somehow in the macro. Will be back after I try that.
Robert,
Ok, let's make some changes to the system:
-Expand the macro node in the developer section, select your macro and go to 'Parameters' tab. Add a new parameter (alias is what will be used to reference it) of type number (for simplicity). Make sure to mark 'Show' and save your work.
-Go back to where you're using the macro on, remove it, and re-insert it using the 'insert macro' dialog. Select macro from list, and click Ok. you should be able now to enter the value for the numerical parameter. Enter the id of the node that has the newestEval32Version property!
-Change xlst
and add a parameter
'alias' should be replaced with the alias you've entered when creating the parameter on the macro. Above snippet should be entered below the
Run again and let us know how that works out!
Cheers,
/Dirk
Perfect! Thanks again for the help. I hope someone else benefits from this thread--I knew it could be done.
Now, I know how to take advantage of many other items we're storing.
I tried to give Dirk's very helpful post a vote but only get a yellow box with a "close" on it.
is working on a reply...