Hi Ruben,

Thanks for your reply. I'm not sure I understand your response properly. The 
JSP template would only be written once by a developer. However, the content 
author will be able to change their content using different variables when ever 
they want.

For example, lets assume it's coming into xmas period and content authors 
(without any assistence from developers) want to change the welcome message to 
say something about xmas. They would click edit on the welcome paragraph of the 
page which would pop up a dialog. Assume the dialog is based on a the WYSIWYG 
control. Inside the textarea they would change the content to be something like:

<p>Hi ${nickname} - Season's greetings! Your account balance is currently 
${accountBalance}. Click here to spend that balance on a present!</p>


In the template based on solution (1) below it might look something like this:

------------------
welcomeMessage.jsp
------------------
<div>
        <xyz:paramterisedOut nodeDataName="wysiwyg" />
</div>
------------------

Does that explain things further?

Cheers,

Brent



-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Ruben Reusser
Sent: Thursday, 12 November 2009 2:37 PM
To: Magnolia User-List
Subject: Re: [magnolia-user] Injecting Variables into Text Content


Brent,

You could use the jsp templating module and allow the content developers 
to use jsp tags or you could modify the jsp templating a bit and convert 
your own tag language to the actual jsp tags that would have to be at 
that place. The jsp then only has to be refreshed once a content dev 
changes the actual node.

Ruben

Brent McArthur wrote:
>
> G'day Magnolians,
>
> It's been a while since I've emailed to this list. I've been busy 
> demoing and presenting Magnolia to some of our clients. The feedback 
> is awesome.
>
> A question that has come up a number of times from our clients is with 
> respect to blending text retrieved from a database with text entered 
> via a content author. Similar to the way the forms module works in 
> that confirmation emails and thank you pages can embed content 
> submitted through the form in emails or pages (see 
> http://demoauthor.magnolia-cms.com/demo-project/service/contact.html, 
> Edit Form Settings -> Confirmation E-Mail).
>
> I wanted to get some feedback on the best way to do this. In our case, 
> we'll always be using JSP templates - not Freemaker. Imagine I have a 
> magnolia based website where the customers can log into. After logging 
> in we want to display a page that contains a welcome paragraph such as:
>
> <p>Hi ${nickname} - welcome back. You last logged in on 
> ${lastLoginDate} and your account balance is currently 
> ${accountBalance}.</p>
>
> The key is we want the welcome message to be content managed - not 
> hardcoded. Basically we want to expose a bunch of pre-determined 
> variables that content authors can embed where ever they like inside 
> text based paragraphs. Assume these variables are previously loaded 
> into HTTP session scope through some filter.
>
> How would you do this?
>
> I can think of two ways but maybe there are easier ways:
>
> 1. Write our own JSP Custom Tag that replaces the ${xx} found in 
> content with corresponding session variables prior to writing the 
> content to the response stream.
>
> 2. Write our own base paragraph renderer that does the same as the 
> custom tag.
>
> Is there any easier way?
>
> Hopefully I've explained myself well enough.
>
> Cheers,
>
> Brent**
>
>
>
> ------------------------------------------------------------------------
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to