Hi Lakshmi, I put up a page on the wiki for you with some of the code that we've successfully used to create new pages and populate them with some default text. Hopefully it will help you sort out all the necessary steps to do this:
http://www.magnolia.info/wiki/Wiki.jsp?page=CreatingPagesWithCode Best, Sean On 8/28/07 12:47 AM, "Nagalakshmi.G" <[email protected]> wrote: > > Hi Thomas, > > Thanks for your response. I found out that the problem was with the name > of my web page. From the rssfeed url there where special characters like > (.'empty space) etc.I replaced all the special characters by a '-' in my > custom code. > Because under website whenever we create a new page with the name of > page having spl charaters, it replaces the spl charaters with a '-' > > But when I open the page I can see the page properties,edit,new bar > etc...but the content alone is not reflected. > When I click on edit tab of my contentparagragh that I added, > I get the following error in the console: > > ERROR info.magnolia.cms.taglibs.Include Include.java(doEndTag:181) > 28.08.2007 10:50:02 Unable to render paragraph in page > /Projects/DML/RssIn/---------------------------------------/contentParag > raph/0: templatePath not set. > > I tried with > > md.setProperty("mgnl:template", "MediaTemplate"); > md.setTemplate("MediaTemplate"); > myPage.updateMetaData(); > > Now I don't know how to set the templatePath. Any idea? > > Regards, > Lakshmi. > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Sent: Monday, August 27, 2007 1:42 PM > To: [email protected] > Subject: Re: [magnolia-user] Add web page nodes thru code > > Hi Lakshmi > > I just scanned very quickly your mail and noted the following: > > whenerver I created pages through custom code I found it to be > necessary to update the metadata: > > myPage.updateMetaData(); > > before save. > > This might not realy solve your issue - but you might give it a shot. > > Cheers, T > > > > > > > On 27.08.2007, at 07:19, Nagalakshmi.G wrote: > >> >> Hi all, >> >> I am working on RSS feeds. I have my own Rss class that gets >> information >> from particular url. I have to get the content from website and add it >> to my website under website menu in magnolia(3.0). I have added a node >> to website menu, set the template (my own template that has just the >> controls(property) text and image), >> >> >> Node channelContent = rssFeeds.addNode(webPageName,"mgnl:content"); >> Node >> chParagraph=channelContent.addNode >> ("contentParagraph","mgnl:contentNode" >> ); >> Node chContent=chParagraph.addNode("0","mgnl:contentNode"); >> chContent.setProperty("text", buffer.toString()); /*set the 'text' >> field >> in my template with the content from rss page*/ >> >> session.save(); >> HierarchyManager hm = MgnlContext.getHierarchyManager("website"); >> Content myPage = hm.getContent("Projects/DML/RssIn/"+ webPageName); >> MetaData md = myPage.getMetaData(); >> md.setProperty("mgnl:template", "MediaTemplate"); >> md.setTemplate("MediaTemplate"); >> md.setTemplateType("jsp"); >> myPage.save(); >> >> >> The webpage is added under the folder but when I open it I cannot see >> the content I added under 'text' property. It says 'resource not >> found'. >> When I create a page from 'new page' option in UI,it works,but when I >> add a node thru my code, it doesn't show the page contents. >> >> I made the sure that the JCR Browse (menu) of my page added thru code >> and the one added from Website UI resemble each other. But still am >> not >> able to see the contents of page added thru code. ('Resoruce not found >> error' on page when I open it) >> >> Where I going wrong or what am I missing in setting any property >> for the >> page? >> >> >> Pls help if anybody knows, am new to magnolia just started working >> on it >> 2 weeks ago. >> >> Thanks in Advance, >> Lakshmi >> >> This e-mail and any files transmitted with it are for the sole use >> of the intended recipient(s) and may contain confidential and >> privileged information. >> If you are not the intended recipient, please contact the sender by >> reply e-mail and destroy all copies of the original message. >> Any unauthorized review, use, disclosure, dissemination, >> forwarding, printing or copying of this email or any action taken >> in reliance on this e-mail is strictly >> prohibited and may be unlawful. >> >> ---------------------------------------------------------------- >> for list details see >> http://documentation.magnolia.info/docs/en/editor/stayupdated.html >> ---------------------------------------------------------------- > > > ---------------------------------------------------------------- > for list details see > http://documentation.magnolia.info/docs/en/editor/stayupdated.html > ---------------------------------------------------------------- > > This e-mail and any files transmitted with it are for the sole use of the > intended recipient(s) and may contain confidential and privileged information. > If you are not the intended recipient, please contact the sender by reply > e-mail and destroy all copies of the original message. > Any unauthorized review, use, disclosure, dissemination, forwarding, printing > or copying of this email or any action taken in reliance on this e-mail is > strictly > prohibited and may be unlawful. > > ---------------------------------------------------------------- > for list details see > http://documentation.magnolia.info/docs/en/editor/stayupdated.html > ---------------------------------------------------------------- ---------------------------------------------------------------- for list details see http://documentation.magnolia.info/docs/en/editor/stayupdated.html ----------------------------------------------------------------
