Outputting values of an Info placeholder from within a render spot
Hi Everyone, SUMMARY To make a long story short, I am attempting to output the values of an info placeholder of a particular set of (master) pages from within a render spot in a separate content class. If this is enough information for you, then you can skip all the gory details. If you need more info, here it is: DETAILED DESCRIPTION OF PROBLEM 1. Every night, we run an automatic publishing job which uses the Navigation Manager to traverse the entire navigation structure of our site and build (and then publish) a single XML file based on the Google Sitemaps protocol (http://en.wikipedia.org/wiki/ Google_Sitemaps). 2. Everything functions fine except for the elements of the Google Sitemaps protocol, which is supposed to contain the date on which each page in the site was last modified. 3. The obvious way to do this would be to add a line within the render spot such as: <%!! Context:CurrentIndex.Page.Elements.GetElement(inf_modification_date).GetHtml() !! %> where inf_modification_date represents an Info placeholder of type “Page: Modification Date”. 4. The problem is, as I’m sure many of you already know, the above line of code will not work because GetElement().GetHtml() does not work with Info placeholders, it only works with Standard Field and a limited range of other types of placeholders. (When called on an Info tag, it renders the empty string.) ATTEMPTED SOLUTION 1. I though I would outsmart the CMS by adding to the master page, RQL which dumps the contents of inf_modification_date into a Standard Field placeholder named “stf_modification_date”, which could then be accessed from the render spot. I added the following piece of code to the master page’s template: <% ‘ only function SetElementValue is shown here; functions that it calls are omitted here for the sake of brevity function SetElementValue( pageguid, elementname, value ) XMLData = "" &_ "" &_ "" &_ "" &_ "" resultXML = sendXML(XMLData) resElementGUID = getElementGUID( resultXML, "ELEMENT", "eltname", elementname ) XMLData = "" &_ "" &_ "" &_ "" &_ "" &_ "" resultXML = sendXML(XMLData) end function setpublished = SetElementValue( ”<%inf_page_guid%>”, ”stf_modification_date”, ”<%inf_modification_date%>”) %> 2. The problem here is that, while this does indeed dump the contents of inf_modification_date into stf_modification_date, it only does so when the page is accessed in SmartEdit, due to the render spot (separate from the above-mentioned render spot) that the code is wrapped in. Therefore, it will not dump the contents if, for instance, the page is modified from within SmartTree, though admins may need to do this. (Without this render spot, the ASP code will be passed on to the published page, which is unacceptable. I also tried to wrap the code in pre-execute blocks instead of the render spot, but then the code seemed not to be executed at all.) 3. There is another problem as well: Even when the code does execute (at the time the page is accessed in SmartEdit), stf_modification_date receives the value of inf_modification_date *before* inf_modification_date receives its new value. Thus, the value of stf_modification_date will always lag behind by one iteration. For example, if I modify a given page 2 times, once at 4:12 PM and at again at 4:22 PM, then, when I am done with these two modifications, stf_modification_date will hold the value “4:12 PM”, and not the value “4:22 PM”, as would be expected (or at least hoped for). If I then access the page a third time in SmartEdit (say, at 4:35PM), as soon as I navigate to the page in SmartEdit to edit it, stf_modification_date will receive the old value of inf_modification_date (“4:22 PM”), and then, only afterwards, will inf_modification_date will receive its new value (“4:35 PM”). Therefore, this does not seem like a viable option. CONCLUSION It seems that, somehow, I must get the value of inf_modification_date directly from within the (first) render spot. Any ideas? Can I embed RQL calls into the render spot? Is there only a LiveServer solution to this problem (perhaps importing inf_modification_date and then using a query or a target dynament to build the Google Sitemmaps XML)? Are there other solutions that you can think of? Any insights and suggestions are much appreciated. Thanks in advance, Michael Klosner -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.
Re: Outputting values of an Info placeholder from within a render spot
Hi Michael, i have exactly the same problem. I'd like to use a date in the google sitemap. Unfortunately it is not possible to access info elements via render tags. There is a note in the German Navigation Manager documentation on page 51 --> PageElementList Elements. I would not suggest to look for liveserver solution, as it could reduce the performance of your system, if you have many pages. A possible solution could be to code a script that runs once a night and get all relevant master pages from the system, looks at the modification date of all its child pages and writes the newest date to a standard field of the master page. This is what i like to do, but i have not yet started :) Regards, Stefan Popp On Jul 1, 6:57 pm, "mbyisra...@gmail.com" wrote: > Hi Everyone, > > SUMMARY > To make a long story short, I am attempting to output the values of an > info placeholder of a particular set of (master) pages from within a > render spot in a separate content class. > > If this is enough information for you, then you can skip all the gory > details. If you need more info, here it is: > > DETAILED DESCRIPTION OF PROBLEM > 1. Every night, we run an automatic publishing job which uses the > Navigation Manager to traverse the entire navigation structure of our > site and build (and then publish) a single XML file based on the > Google Sitemaps protocol (http://en.wikipedia.org/wiki/ > Google_Sitemaps). > 2. Everything functions fine except for the elements of the > Google Sitemaps protocol, which is supposed to contain the date on > which each page in the site was last modified. > 3. The obvious way to do this would be to add a line within the render > spot such as: > > <%!! > Context:CurrentIndex.Page.Elements.GetElement(inf_modification_date).GetHtml() > !! > %> > > where inf_modification_date represents an Info placeholder of type > “Page: Modification Date”. > 4. The problem is, as I’m sure many of you already know, the above > line of code will not work because GetElement().GetHtml() does not > work with Info placeholders, it only works with Standard Field and a > limited range of other types of placeholders. (When called on an Info > tag, it renders the empty string.) > > ATTEMPTED SOLUTION > 1. I though I would outsmart the CMS by adding to the master page, RQL > which dumps the contents of inf_modification_date into a Standard > Field placeholder named “stf_modification_date”, which could then be > accessed from the render spot. I added the following piece of code to > the master page’s template: > > > > valueb="Int:1"> > > > <% > ‘ only function SetElementValue is shown here; functions that it calls > are omitted here for the sake of brevity > > function SetElementValue( pageguid, elementname, value ) > XMLData = "" &_ > "" &_ > "" &_ > "" &_ > "" > resultXML = sendXML(XMLData) > resElementGUID = getElementGUID( resultXML, "ELEMENT", "eltname", > elementname ) > XMLData = "" &_ > "" &_ > "" &_ > "" &_ > "" &_ > "" > resultXML = sendXML(XMLData) > end function > > setpublished = SetElementValue( ”<%inf_page_guid%>”, > ”stf_modification_date”, ”<%inf_modification_date%>”) > %> > > > > > > > 2. The problem here is that, while this does indeed dump the contents > of inf_modification_date into stf_modification_date, it only does so > when the page is accessed in SmartEdit, due to the render spot > (separate from the above-mentioned render spot) that the code is > wrapped in. Therefore, it will not dump the contents if, for instance, > the page is modified from within SmartTree, though admins may need to > do this. (Without this render spot, the ASP code will be passed on to > the published page, which is unacceptable. I also tried to wrap the > code in pre-execute blocks instead of the render spot, but then the > code seemed not to be executed at all.) > > 3. There is another problem as well: Even when the code does execute > (at the time the page is accessed in SmartEdit), stf_modification_date > receives the value of inf_modification_date *before* > inf_modification_date receives its new value. Thus, the value of > stf_modification_date will always lag behind by one iteration. For > example, if I modify a given page 2 times, once at 4:12 PM and at > again at 4:22 PM, then, when I am done with these two modifications, > stf_modification_date will hold the value “4:12 PM”, and not the value > “4:22 PM”, as would be expected (or at least hoped for). If I then > access the page a third time in SmartEdit (say, at 4:35PM), as soon as > I navigate to the page in SmartEdit to edit it, stf_modification_date > will receive the old value of inf_modification_date (“4:22 PM”), and > then, only afterwards, will inf_modification_date will receive its new > value (“4:35 PM”). > > Therefore, this does not seem like a viable option. > > CONCLUSION > It seems that, somehow, I must get the value of inf_modif
Re: Outputting values of an Info placeholder from within a render spot
OK, let me ask the question a different way: Does anybody know how (if it is possible at all) to integrate Render Tags and RQL within a content class that is called by the Navigation Manager as a Navigation Area? My latest attempt is below, which does not work correctly: while the output of the render tags appears as it should, no output appears from the ASP code at all. _ http://www.example.com/cms/<%!! Escape:HtmlEncode(Context:CurrentIndex.GetUrl()) !!%> <% curIndexGuid = <%!! Context:CurrentIndex.Id !!%> function sendXML(XMLString) sErrors = "" set XMLDom = Server.CreateObject("RDCMSAspObj.RDObject") set RQLObject = Server.CreateObject("RDCMSServer.XmlServer") sendXML = RQLObject.Execute(XMLString, sErrors) RQLObject = NULL end function function getElementAttribute( pageguid, nodename, attname, attvalue, resAtt ) XMLData = "" &_ "" &_ "" &_ "" &_ "" resultXML = sendXML(XMLData) Set xmlDoc = CreateObject("msxml2.DOMDocument") xmlDoc.loadXML(resultXML) Set ElemList = xmlDoc.getElementsByTagName(nodename) For counter = 0 To (ElemList.length - 1) if ElemList.item(counter).getAttribute(attname) = attvalue then elementValue = ElemList.item(counter).getAttribute(resAtt) end if Next ElemList = NULL xmlDoc = NULL getElementValue = elementValue end function Response.Write( getElementAttribute(curIndexGuid, "ELEMENT", "name", "info_modified", "value") ) %> monthly 5 <%!!Escape:Newline!!%> <%!!Escape:Newline!!%> -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.
RE: Outputting values of an Info placeholder from within a render spot
You have to keep in mind the order of processing: first Render Tags, then pre-execute. Your pre-executing section should be entirely contained with your blocks. You look like you are closing and then reopening the block which won't work. I've edited your code below - but haven't tested those edits :-) Also, I'm not sure how the nested render spot with the page guid will work. You may have to create an separate info element just for that. And to top it all off, I've never used info elements which contained the Session variables for loginguid and sessionkey in pre-executing blocks with RQL. I'd be interested in hearing how that works. Chad Killingsworth Assistant Director of Web & New Media Missouri State University -Original Message- From: reddot-cms-users@googlegroups.com [mailto:reddot-cms-us...@googlegroups.com] On Behalf Of mbyisra...@gmail.com Sent: Friday, July 09, 2010 11:11 AM To: RedDot CMS Users Subject: Re: Outputting values of an Info placeholder from within a render spot OK, let me ask the question a different way: Does anybody know how (if it is possible at all) to integrate Render Tags and RQL within a content class that is called by the Navigation Manager as a Navigation Area? My latest attempt is below, which does not work correctly: while the output of the render tags appears as it should, no output appears from the ASP code at all. _ http://www.example.com/cms/<%!! Escape:HtmlEncode(Context:CurrentIndex.GetUrl()) !!%> <% curIndexGuid = <%!! Context:CurrentIndex.Id !!%> function sendXML(XMLString) sErrors = "" set XMLDom = Server.CreateObject("RDCMSAspObj.RDObject") set RQLObject = Server.CreateObject("RDCMSServer.XmlServer") sendXML = RQLObject.Execute(XMLString, sErrors) RQLObject = NULL end function function getElementAttribute( pageguid, nodename, attname, attvalue, resAtt ) XMLData = "" &_ "" &_ "" &_ "" &_ "" resultXML = sendXML(XMLData) Set xmlDoc = CreateObject("msxml2.DOMDocument") xmlDoc.loadXML(resultXML) Set ElemList = xmlDoc.getElementsByTagName(nodename) For counter = 0 To (ElemList.length - 1) if ElemList.item(counter).getAttribute(attname) = attvalue then elementValue = ElemList.item(counter).getAttribute(resAtt) end if Next ElemList = NULL xmlDoc = NULL getElementValue = elementValue end function Response.Write( getElementAttribute(curIndexGuid, "ELEMENT", "name", "info_modified", "value") ) %> monthly 5 <%!!Escape:Newline!!%> <%!!Escape:Newline!!%> -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en. -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.
Re: Outputting values of an Info placeholder from within a render spot
Hi Chad, Thanks for your input, it is greatly appreciated. A couple of responses from my (forced) experience with this issue: --- COMMENT: "Your pre-executing section should be entirely contained with your blocks. You look like you are closing and then reopening the block which won't work. I've edited your code below - but haven't tested those edits :-)" RESPONSE: When I enclose the pre-executing section in the blocks, the ASP code does not execute at all. Instead, all of the code (including the line "<%") is copied, wholescale, on to the published page. Strange ... it seems that overrides even pre-execute blocks. I am beginning to get the impression that pre- execute blocks are not valid at all within a content class that is executed by the Navigation Manager as a Navigation Area. If it were just a regular content class containing render tags and pre-executing code, then I believe it would work (it has in the past.) When the pre-executing section is not enclosed in the blocks (as in the code above), the code does not result in any output. Even when I tested it with a single line of ASP code outside of the block, i.e.: <% Response.write "Hello world" %> nothing happened, and the area where the output should have appeared was blank. So, damned if I do and damned if I don't (enclose in block.) --- COMMENT: "Also, I'm not sure how the nested render spot with the page guid will work. You may have to create an separate info element just for that." RESPONSE: When the ASP code was wrapped inside the block, the nested page guid worked fine, but (as noted above) the ASP code never executed, it was just copied onto the published page. When the ASP code was not wrapped inside the block (as in the code above), as mentioned, the ASP did not execute at all, and blank space appeared where the output should have been. --- COMMENT: "And to top it all off, I've never used info elements which contained the Session variables for loginguid and sessionkey in pre- executing blocks with RQL. I'd be interested in hearing how that works." RESPONSE: Hmmm ... maybe that's the problem. How do you usually get the loginguid and sessionkey in such a case? Michael Klosner -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.
RE: Outputting values of an Info placeholder from within a render spot
Forced experience is about par for the course with RQL. You may need to move your block marks OUTSIDE of the render spot. So it looks something like: <% script code %> I'm fairly certain I have that working on templates. Although I'd have to go digging through them to find out for sure. As for the LoginGUID and SessionKey - well typically RQL which runs at the Pre-Execute stage doesn't have access to those values at all. So you have traditionally been stuck with logging in a dummy account. Most of our RQL runs as either a command line batch job or as AJAX calls withing SmartEdit (for things like target container assignment). Chad Killingsworth Assistant Director of Web & New Media Missouri State University -Original Message- From: reddot-cms-users@googlegroups.com [mailto:reddot-cms-us...@googlegroups.com] On Behalf Of mbyisra...@gmail.com Sent: Friday, July 09, 2010 2:26 PM To: RedDot CMS Users Subject: Re: Outputting values of an Info placeholder from within a render spot Hi Chad, Thanks for your input, it is greatly appreciated. A couple of responses from my (forced) experience with this issue: --- COMMENT: "Your pre-executing section should be entirely contained with your blocks. You look like you are closing and then reopening the block which won't work. I've edited your code below - but haven't tested those edits :-)" RESPONSE: When I enclose the pre-executing section in the blocks, the ASP code does not execute at all. Instead, all of the code (including the line "<%") is copied, wholescale, on to the published page. Strange ... it seems that overrides even pre-execute blocks. I am beginning to get the impression that pre- execute blocks are not valid at all within a content class that is executed by the Navigation Manager as a Navigation Area. If it were just a regular content class containing render tags and pre-executing code, then I believe it would work (it has in the past.) When the pre-executing section is not enclosed in the blocks (as in the code above), the code does not result in any output. Even when I tested it with a single line of ASP code outside of the block, i.e.: <% Response.write "Hello world" %> nothing happened, and the area where the output should have appeared was blank. So, damned if I do and damned if I don't (enclose in block.) --- COMMENT: "Also, I'm not sure how the nested render spot with the page guid will work. You may have to create an separate info element just for that." RESPONSE: When the ASP code was wrapped inside the block, the nested page guid worked fine, but (as noted above) the ASP code never executed, it was just copied onto the published page. When the ASP code was not wrapped inside the block (as in the code above), as mentioned, the ASP did not execute at all, and blank space appeared where the output should have been. --- COMMENT: "And to top it all off, I've never used info elements which contained the Session variables for loginguid and sessionkey in pre- executing blocks with RQL. I'd be interested in hearing how that works." RESPONSE: Hmmm ... maybe that's the problem. How do you usually get the loginguid and sessionkey in such a case? Michael Klosner -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en. -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.
Re: Outputting values of an Info placeholder from within a render spot
For what it's worth - if you're going to this much trouble why not just write a custom render tag that takes parameters for the info placeholder and the guid of the page? main.config in the "ASP" directory contains mappings for object loaders (the bit to the left of the colon, e.g. Guid: Bool: Context: etc). Make one up and add it in. I suggest calling it "Info:". Create a .Net DLL project, reference Reddot.CMS.Rendering.DLL from the "GAC" directory. Inherit your class from "ObjectLoaderBase". Use .NET Reflector to examine the other loaders in Reddot.CMS.Rendering.DLL to see how they work if you want sample code. Reddot.CMS.Rendering.Objects.ContextLoader::GetObject() is a particularly revealing method. It's interesting to see the not so often used loaders, render tags, properties and methods too - this is how you discover those "undocumented" features. Gotta love .Net HTH. Regards, Richard Hauer 5 Limes Pty Limited www.5Limes.com.au On Jul 10, 6:19 am, "Killingsworth, Chad A" wrote: > Forced experience is about par for the course with RQL. > > You may need to move your block marks OUTSIDE of the > render spot. So it looks something like: > > > <% script code %> > > > > I'm fairly certain I have that working on templates. Although I'd have to go > digging through them to find out for sure. > > As for the LoginGUID and SessionKey - well typically RQL which runs at the > Pre-Execute stage doesn't have access to those values at all. So you have > traditionally been stuck with logging in a dummy account. > > Most of our RQL runs as either a command line batch job or as AJAX calls > withing SmartEdit (for things like target container assignment). > > Chad Killingsworth > Assistant Director of Web & New Media > Missouri State University > > > > -Original Message- > From: reddot-cms-users@googlegroups.com > [mailto:reddot-cms-us...@googlegroups.com] On Behalf Of mbyisra...@gmail.com > Sent: Friday, July 09, 2010 2:26 PM > To: RedDot CMS Users > Subject: Re: Outputting values of an Info placeholder from within a render > spot > > Hi Chad, > > Thanks for your input, it is greatly appreciated. A couple of > responses from my (forced) experience with this issue: > > --- > > COMMENT: "Your pre-executing section should be entirely contained with > your blocks. You look like you are closing and then > reopening the block which won't work. I've edited your code below - > but haven't tested those edits :-)" > > RESPONSE: > > When I enclose the pre-executing section in the blocks, the > ASP code does not execute at all. Instead, all of the code (including > the line "<%") is copied, wholescale, on to the > published page. Strange ... it seems that overrides even > pre-execute blocks. I am beginning to get the impression that pre- > execute blocks are not valid at all within a content class that is > executed by the Navigation Manager as a Navigation Area. If it were > just a regular content class containing render tags and pre-executing > code, then I believe it would work (it has in the past.) > > When the pre-executing section is not enclosed in the > blocks (as in the code above), the code does not result in any output. > Even when I tested it with a single line of ASP code outside of the > block, i.e.: > > <% > Response.write "Hello world" > %> > > nothing happened, and the area where the output should have appeared > was blank. > > So, damned if I do and damned if I don't (enclose in > block.) > > --- > > COMMENT: "Also, I'm not sure how the nested render spot with the page > guid will work. You may have to create an separate info element just > for that." > > RESPONSE: > > When the ASP code was wrapped inside the block, the nested > page guid worked fine, but (as noted above) the ASP code never > executed, it was just copied onto the published page. > > When the ASP code was not wrapped inside the block (as in > the code above), as mentioned, the ASP did not execute at all, and > blank space appeared where the output should have been. > > --- > > COMMENT: "And to top it all off, I've never used info elements which > contained the Session variables for loginguid and sessionkey in pre- > executing blocks with RQL. I'd be interested in hearing how that > works." > > RESPONSE: Hmmm ... maybe that's the problem. How do you usually get > the loginguid and sessionkey in such a case? > > Michael Klosner > > -- > You re
Re: Outputting values of an Info placeholder from within a render spot
Chad - Tried your latest suggestion and it did not work. It seemed to have exactly the same effect as leaving the pre-execute block outside the but within the block, i.e. ASP code did not seem to execute at all and there was blank space where the output would have been had the code executed. Any other ideas? Richard - This sounds like an interesting idea and a nice challenge. I will look into that as one possibility. - mbyisrael2 -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.
Re: Outputting values of an Info placeholder from within a render spot
Richard ... in the end, way to complicated and not worth the measly return in functionality for all that work. Any other ideas? At this point, I have decided to do it through LiveServer until / unless I can come up with a CMS solution. - mbyisrael2 -- You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group. To post to this group, send email to reddot-cms-us...@googlegroups.com. To unsubscribe from this group, send email to reddot-cms-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.