roller-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roller-User" <Roller-U...@intrakom.uni-c.dk>
Subject Delivering blogs as Javascript
Date Fri, 02 Nov 2007 09:25:20 GMT
Greetings

I would like to do the following:

Allow an external user to put a script tag on his site similiar to this:

<script src="http://mysite/roller/blogname/page/javascript"></script>

Now, this url should deliver a valid Javascript whom forinstance could do
one document.write("blogcontent")

Thus the content of the blog is delivered externally. This requires a few
things:

1) That the javascript.vm sets the Content-type to text/javascript. I can
do this through a custom Model. Problem solved
2) That I can get the output of another Velocity file and sanitize it so
it can be written out as a javascript variable.

Let's assume I can display the content of the blog in a Velocity file
called layout.vm.

Imagine this was possible for javascript.vm

-- start javascript.vm --
$myCustomModel.setContentType("text/javascript")
#set($page = $model.weblog.getPageByName("layout") )
#set($content = #parse($page.id))
#set($content = $myCustomModel.prepareForJavascript($content) )
document.write($content);
-- end javascript.vm ---

Line 3 in above file obviously returns an error due to the way Velocity
works. My question however is, whetever there is another way to do
something similiar within the Roller API(s)?

Cheers
Søren Wiuff
UNI-C


Mime
View raw message