ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruth Hoffman <rhoff...@aesolves.com>
Subject Re: AW: Re: Using CMS Elements in FTL
Date Fri, 25 Mar 2011 17:51:34 GMT
Hi Carsten:
Here's a snippet (BeanShell, I'm afraid - but it shouldn't be to hard to 
convert) I use to display a single blog entry/article on my website. 
Note, you need the contentId. That comes from the user selecting from a 
list of articles and then passing that back via request parameter. Also, 
I created the view-entity ContentDataResourceElectronicTextView that 
joins the content -> data resource -> electronic text records together.

     GenericValue thisBlog = 
delegator.findOne("ContentDataResourceElectronicTextView",
             UtilMisc.toMap("contentId", article), false);
    .... stuff left out....
     context.put("blog", thisBlog);
     return;

In the Freemarker template:

<#assign renderedContent = StringUtil.wrapString(blog.textData) />

I think I describe in pretty good detail how the OOTB OFBiz content data 
model works in the RSS document I did some time ago:

  http://www.myofbiz.com/ecommerce/products/PROMOTIONS/p_PUB-RSS0710

Regards,
Ruth

On 3/25/11 1:15 PM, c.schinzer@googlemail.com wrote:
> Hi Ruth,
>
>
> Thanks for that bit. Any groovy script you would be able to point me to in order to understand
how the lookup would work?
>
> Regards
>
>
> Carsten
> Gesendet mit BlackBerry® Webmail von Telekom Deutschland
>
> -----Original Message-----
> From: Ruth Hoffman<rhoffman@aesolves.com>
> Date: Fri, 25 Mar 2011 12:54:35
> To:<user@ofbiz.apache.org>
> Reply-To: user@ofbiz.apache.org
> Subject: Re: Using CMS Elements in FTL
>
> Hi Carsten:
> Are you referring to ElectronicText.textData?
>
> Usually content -  like email body values -  is either in an
> ElectronicText.textData record pointed to by a
> DataResource.dataResourceId and/or Content.dataResourceId or in a disk
> file somewhere and the DataResource.dataResourceId points to that location.
>
> To get the content and have Freemarker render it (and not just put up
> literal values), you can use something like:
>
>
> <#assign renderedContent = StringUtil.wrapString(blog.textData) />
>
>
> Where blog was placed into the context via a Groovy data prep script.
>
> Is that what you are looking for?
>
> Regards,
> Ruth
>
>
>
> On 3/25/11 12:27 PM, Carsten Schinzer wrote:
>> All,
>>
>>
>> I am trying to customize the E-Mails and PDFs generated by OFBiz to contain
>> managed content (like e.g. an opening text addressing the user and explaning
>> the terms of the offer / order etc. or a closing remark including a greeting
>> and a signature).
>>
>> I see that most of these contents -- especially the Formatting Object ones
>> -- are handled and created using FTL parts.
>> How would I thus reference a piece of managed content? Do I need to load it
>> using a groovy script? Does anyone know a place where this is already done
>> in the OFBiz framework?
>>
>> Any hint would be greatly appreciated.
>>
>> Thanks a lot in advance.
>> Cheers
>>
>>
>> Carsten
>>

Mime
View raw message