|
|
Rank: Newbie
Joined: 2/20/2008 Posts: 16 Location: Canada
|
This is more of a general Macro question, but think it might be a bug. I have an XSLT that outputs an UL based on two boolean parameters. The XSLT works good and does what I want. I have a macro that calls the XSLT, passes the parameters, and has "Use in Editor" and "Render content in Editor" checked/selected. I want the content editor to be able to add the macro to arbitrary pages. I want the macro to be re-evaluated on every page load (with the same parameters as selected when created). In the content section, I navigate to an arbitrary page, click in the TinyMCE editor to set an insertion point, click the "Insert/Edit Macro" icon on the toolbar. So far, so good. I select the macro and click OK. I check one or more parameters (they are boolean) and click OK. That is when I get the following error: Code: [NullReferenceException: Object reference not set to an instance of an object.] umbraco.macro.MacroContentByHttp(Int32 PageID, Guid PageVersion, Hashtable attributes) +46 umbraco.presentation.tinymce.insertMacro.renderMacro_Click(Object sender, EventArgs e) +843 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Using Umbraco 3.03 (build 31655) I have repeated the test with a "bare" XSLT to see if it was a coding issue, but I think it may be an Umbraco issue. Is this sort of macro-insertion allowed? Or is it a bug...
Dekker www.WoodworkDetails.com
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,066 Location: KY, USA
|
It might be a bug, but it might also be a difficulty in trying to render the macro in the editor. I've seen that with some macros that rely on details that can't be resolved if all the content is not already published. If you turn off the "render in editor", you can still insert the macro in TinyMCE, select the properties, etc. But there will simply be a box in the editor saying the macro goes here but isn't rendered. The macro is still rendered at runtime when a visitor comes to your site. I don't typically render my macros in the editor. I find it is easier to work with the small place-holder for the macro since there's no editing of the macro's output even if you can see it rendered in the RTE. cheers, doug.
MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
|
|
Rank: Newbie
Joined: 2/20/2008 Posts: 16 Location: Canada
|
drobar wrote:If you turn off the "render in editor", you can still insert the macro in TinyMCE, select the properties, etc. But there will simply be a box in the editor saying the macro goes here but isn't rendered. Sorry, I should have mentioned that I tried the variations, including the above. I still get the same error after the final confirmation "OK" to add the macro. Is there a way I can manually insert the macro, perhaps inserting something into the HTML view? It's not a complex set of parameters, and I just want to get this running (even if the bug is not fixed in the GUI).
Dekker www.WoodworkDetails.com
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,066 Location: KY, USA
|
Try adding the macro into a template rather than in the RTE. There's a toolbar button for it, and you can see the HTML markup for the macro, including its properties. When put in a template, there's no rendering, no checks, so it should save just fine. When you bring up a page with the template by visiting your website, does the macro render properly? Any chance you can show us the xslt of the macro? Maybe we can spot something. cheers, doug.
MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
|
|
Rank: Newbie
Joined: 2/20/2008 Posts: 16 Location: Canada
|
Actually, putting it in the template is what I am doing as my current workaround, and it does work nicely, however I am hoping to use this technique elsewhere, where it will not be as convenient to add it to the template. drobar wrote:Any chance you can show us the xslt of the macro? Here is the XSLT: Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]> <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="html" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here --> <xsl:variable name="documentTypeAlias" select="'WSE'"/> <xsl:variable name="domestic" select="/macro/domestic"/> <xsl:variable name="hardwood" select="/macro/hardwood"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul>
<xsl:for-each select="$currentPage/node [ @nodeTypeAlias = $documentTypeAlias and string(data [@alias='umbracoNaviHide']) != '1' and string(data [@alias='domestic']) = $domestic and string(data [@alias='hardwood']) = $hardwood ]"> <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li> </xsl:for-each> </ul>
</xsl:template>
</xsl:stylesheet>
And yes, I even tried Code:<xsl:output method="xml" but it had no appreciable effect. The following is an excerpt of the XML, minus the unformatted text blocks Code:<node id="1204" version="a88fdcf5-11fe-4796-8472-15c503627bc1" parentID="1183" level="5" writerID="0" creatorID="0" nodeType="1151" template="1153" sortOrder="1" createDate="2008-03-17T09:29:39" updateDate="2008-03-17T09:32:45" nodeName="Ash, Black Group" urlName="ash,-black-group" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="WSE" path="-1,1070,1097,1147,1183,1204"> <data alias="commonName">Ash, Black Group</data> <data alias="aka">Black ash, pumpkin ash</data> <data alias="PageTitle">Ash, Black Group</data> <data alias="Description"></data> <data alias="Keywords"></data> <data alias="umbracoNaviHide">0</data> <data alias="scientificName">Fraxinus</data> <data alias="domestic">1</data> <data alias="hardwood">1</data> <data alias="speciesGroup">Ash</data> <data alias="characteristics"> Some text</data> <data alias="location">Some more text</data> <data alias="use">Yup... More text</data> <data alias="bodyText"></data> </node> <node id="1185" version="493ff507-3b33-4e62-a890-08d05836f7db" parentID="1183" level="5" writerID="0" creatorID="0" nodeType="1151" template="1153" sortOrder="2" createDate="2008-03-10T06:59:21" updateDate="2008-03-17T09:28:29" nodeName="Ash, White Group" urlName="ash,-white-group" writerName="Administrator" creatorName="Administrator" nodeTypeAlias="WSE" path="-1,1070,1097,1147,1183,1185"> <data alias="commonName">Ash, White Group</data> <data alias="aka">American white ash, green ash, blue ash, oregon ash</data> <data alias="PageTitle">Ash, White Group</data> <data alias="Description"></data> <data alias="Keywords"></data> <data alias="umbracoNaviHide">0</data> <data alias="scientificName">Fraxinus</data> <data alias="domestic">1</data> <data alias="hardwood">1</data> <data alias="speciesGroup">Ash</data> <data alias="characteristics"> Some text</data> <data alias="location">Some more text</data> <data alias="use">Yup... More text</data> <data alias="bodyText"></data> </node>
Dekker www.WoodworkDetails.com
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,066 Location: KY, USA
|
Hmmm. That all looks good. Three questions... 1. You're trying to insert the macro into the RTE on the page that has a nodeid of 1183, right? 2. What happens if you (temporarily) hardcode the two macro variables to "'1'" instead of passing through the macro params? 3. You say you've got 3.0.3... did you use the binaries, or build from the source? cheers, doug.
MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
|
|
Rank: Newbie
Joined: 2/20/2008 Posts: 16 Location: Canada
|
drobar wrote:1. You're trying to insert the macro into the RTE on the page that has a nodeid of 1183, right? Yes, that is correct. After I posted this message, I just realized you said "RTE". To clarify, I am using the Umbraco "Content" panel to add this text to a document created on a template that has a "Rich Text" context pane. It is the only rich text panel on the tab. drobar wrote:2. What happens if you (temporarily) hardcode the two macro variables to "'1'" instead of passing through the macro params? Unfortunately it does not work... As I mentioned, I even tried to create a dummy XSLT, using the "Table Prototype" template, with no modifications. I created the macro for that, and tried the same steps, with no luck. drobar wrote:3. You say you've got 3.0.3... did you use the binaries, or build from the source? It's actually from the build... branch/tag 31655. I'd like to avoid re-releasing, but if no-one else has the problem, I'll return to the straight 303. I needed an updated build, though, since I'm running it on MS SQL Server, and hence needed the DB provider code. If no-one else can re-produce it, I'll have to delve into the code! But if someone else who is working with the latest-and-greatest (and MS SQL Server) can give it a shot, it would be appreciated!
Dekker www.WoodworkDetails.com
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,066 Location: KY, USA
|
Do bear in mind that the source code is not always 100% stable. You should stick with the pre-compiled binaries if at all possible. I don't understand your last comments. Umbraco runs on MS SQL Server by default. Always has. Its only MySQL support that is added to the code. Is there some reason you needed to compile from source? If so, perhaps you can wait until v305 is out (any day now, I believe) and use it's source as your build platform? cheers, doug.
MVP 2007/2008 - Official Umbraco Trainer for North America - Percipient Studios
|
|
Rank: Newbie
Joined: 2/20/2008 Posts: 16 Location: Canada
|
drobar wrote:Is there some reason you needed to compile from source? At the time when I started fiddling with Umbraco, passwords were stored in the DB in clear text. That is a definite no-no in my books. However, the current build-of-the-day included a fix, so instead of returning to DNN for my CMS, I went with an Umbraco build. As for my comment re: db, For some reason in my mind I had the DB selection reversed... That is one thing the main Umbraco website could use: a "system requirements" page, since I just looked and could not find ANY information related to that. BUT, as for my problem, I think I will wait until 3.0.5, since it will include all the patches I have been working on, and will require the least amount of reverse-engineering to keep my site working. As for the stability of the developer code... Niels really needs to implement NUnit or some similar unit testing mechanism into their check-in cycle, since multiple times, the code has been broken due to simple developer mistakes (though it took me some coding time to uncover them). I have some grand designs of producing some good documentation for Umbraco... Someday ;) That's my other beef with this CMS... But that's a post for another forum.
Dekker www.WoodworkDetails.com
|
|
|
Guest |