Hi!

We were looking at something similar recently:

The Template and Model classes cannot directly impact the rendering of a page - 
this has to be done in a template (JSP or Freemarker) or perhaps at the 
Rendering level.

A simple solution for what you seem to need might be:

1. Write a Model class, which loads and parses the static HTML in its execute 
method, and provides 2 accessor methods: getStaticHTMLStartOfPage() and 
getStaticHTMLEndOfPage()

2. Assign this model class to a page template defintion, and write a freemarker 
template for the page. The freemarker template can look something like this:

${model.staticHTMLStartOfPage}
...your content here
${model.staticHTMLEndOfPage}



That should do the trick. Problem is that each time the page is rendered, 
you're making a request to another server - could cause performance troubles. 
Also, if the remote server doesn't deliver the page, you can't render correctly.
You may want to consider a solution where you fetch the remote HTML "offline", 
and cache it for later use. That would be more robust, and have better 
performance, IMHO.

Regards from Vienna,

Richard Unger




-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Im Auftrag von Dinh Bao Dang
Gesendet: Freitag, 09. Juli 2010 16:44
An: [email protected]
Betreff: [magnolia-user] Best practise integrating foreign HTML into a Magnolia 
Template?


Hi Folks,

I have seen that there is a snippet module available for magnolia but it's very 
new and not well documented (or I didn't found it)

My concern is: I have a URL with static HTML. Let's call it 
http://fragment.partner.com/index.html. I have to fetch this HTML and modify 
it. There are two markers in this HTML: [CONTENT_START] AND [CONTENT_END]. I 
have to put my Content between these two markers.

What is the best practice?

My idea is: The model for my magnolia template gets the HTML page, parses to 
[CONTENT_START], put my content there, delete both markers and send this html 
to my JSP or Freemarker to display.

I think this is practicable but not the best way. Does anyone has suggestions 
for me?

Cheers, Bao

----------------------------------------------------------------
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