having the default macro message in WYSIWYG contain the name of the macro it's displaying
does anyone know how i can include the macro name in the default message a macro displays when it doesn't display content in the wysiwyg editor?
now it's always a box with "No macro content available for WYSIWYG editing"
I'd like to see this become something like:
"Control: ProductionSearchNL.ascx - No macro content available for WYSIWYG editing" "XSL: NavigationFromSource.xsl - No macro content available for WYSIWYG editing"
Me too - I've been wanting to do this since I first saw that orangey dotted box in my editor :-)
I just think I've nailed it - create a new XSLT file and paste the following complete code into it - just replace the ***YOUR-MACRO-ALIAS-HERE*** with the alias of your macro:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY macroAliasParam "umb_macroAlias">
<!ENTITY umbMacroResult "/umbraco/macroResultWrapper.aspx">
<!ENTITY myMacroAlias "***YOUR-MACRO-ALIAS-HERE***">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="isRenderingForEditor" select="umbraco.library:RequestQueryString('¯oAliasParam;') = '&myMacroAlias;' and umbraco.library:RequestServerVariables('SCRIPT_NAME') = '&umbMacroResult;'" />
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$isRenderingForEditor">
<xsl:call-template name="RenderMacroForEditor" />
</xsl:when>
<xsl:otherwise>
<p>
This is a test macro!
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="RenderMacroForEditor">
<p>
This is a custom macro we coded for you, our favorite client!
(Obviously we'll put your logo here!)
</p>
</xsl:template>
</xsl:stylesheet>
Save it and go on to edit the Macro, where you enable the Use in editor and Render content in editor settings. Save that and find a page to test your new macro on...
You should see the contents of the named template when you're in the editor, and the contents of the otherwise instruction on the published website.
having the default macro message in WYSIWYG contain the name of the macro it's displaying
does anyone know how i can include the macro name in the default message a macro displays when it doesn't display content in the wysiwyg editor?
now it's always a box with "No macro content available for WYSIWYG editing"
I'd like to see this become something like:
"Control: ProductionSearchNL.ascx - No macro content available for WYSIWYG editing"
"XSL: NavigationFromSource.xsl - No macro content available for WYSIWYG editing"
All suggestions are more than welcome!
Kind regards,
Rik
Don't think it can be done without 'hacking/modifying' the core code. But I do like your idea (+1)
Ideally, a macro could have a 'design' mode (just as plain asp.net controls) which could be used to set the content for the rte.
Can you log this issue on Codeplex? You'll get my vote!
Cheers,
/Dirk
Me too - I've been wanting to do this since I first saw that orangey dotted box in my editor :-)
I just think I've nailed it - create a new XSLT file and paste the following complete code into it - just replace the ***YOUR-MACRO-ALIAS-HERE*** with the alias of your macro:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> <!ENTITY macroAliasParam "umb_macroAlias"> <!ENTITY umbMacroResult "/umbraco/macroResultWrapper.aspx"> <!ENTITY myMacroAlias "***YOUR-MACRO-ALIAS-HERE***"> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:variable name="isRenderingForEditor" select="umbraco.library:RequestQueryString('¯oAliasParam;') = '&myMacroAlias;' and umbraco.library:RequestServerVariables('SCRIPT_NAME') = '&umbMacroResult;'" /> <xsl:template match="/"> <xsl:choose> <xsl:when test="$isRenderingForEditor"> <xsl:call-template name="RenderMacroForEditor" /> </xsl:when> <xsl:otherwise> <p> This is a test macro! </p> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="RenderMacroForEditor"> <p> This is a custom macro we coded for you, our favorite client! (Obviously we'll put your logo here!) </p> </xsl:template> </xsl:stylesheet>
Save it and go on to edit the Macro, where you enable the Use in editor and Render content in editor settings. Save that and find a page to test your new macro on...
You should see the contents of the named template when you're in the editor, and the contents of the otherwise instruction on the published website.
/Chriztian
thanks a lot for this suggestion, i'll take a closer look when i'm less busy ;)
is working on a reply...