Opened 15 years ago

Closed 15 years ago

#2640 closed New Feature (wontfix)

Dynamically Generated Templates

Reported by: Kevin McIsaac Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


I'd like to be able to have templates be generated dynamicall from a URL. That is rather than specify static HTML in the template, I'd like to give a URL instead and use the output of that URL as a template.

In my case, this would be to use the template to create a newsletter from recent content from our CMS, which I then hand edit to add, subtract or change items.

My thought is to extend the existing Template format as follow, i.e. add a src attribute to the HTML tag.

<Template title="Newsletter" image="newsletter.gif">

<Description>IBRS newsletter</Description> <Html src="" ></Html>


I can see this would be a simple change to the template.html, however my JS is not up to this task.

Change History (2)

comment:1 Changed 15 years ago by Kevin McIsaac

So I surprised myself and figured out how to do this. in fck_template.html after line 121, i.e.,

oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ;

I added this code

if ( oPart = oPart.attributes.getNamedItem('src') ) { xmlhttp = new XMLHttpRequest();"GET",oPart.value,false); xmlhttp.send(null);

Add error checking on this requestion and only overwrite the HTML if the request work. This way the Html in the templage is a default.

oTemplate.Html = xmlhttp.responseText ; }

and it worked

comment:2 Changed 15 years ago by Alfonso Martínez de Lizarrondo

Resolution: wontfix
Status: newclosed

You can point the TemplatesXmlPath to a dynamic page that creates a XML file with all your content. That would be faster than firing several requests for each template

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy