This project is read-only.

Get Content Item, Part, Field from JavaScript

Topics: Writing modules
Sep 20, 2012 at 7:05 PM

Is it possible to get content item with special content parts and field of content item from javascript?



If exists online traffic regulations or law where each point is content item. Each point has a link to many other points. I want when the user clicks on that link ( then it displays popup window with preview (content item with some part or field).

Can i do this by only javascript or i need build custom module that get such page?

Oct 4, 2012 at 11:10 AM

Using JavaScript you can make AJAX calls and process the returned HTML in anyway you want (e.g. use jQuery to select portions). More optimal would be to write your own module and a controller so that you can for example return just the conten item's HTML without the "chrome" / layout. This controller would have an action method, e.g. "Item" which takes a content ID as an argument. Use the ContentManager to load the content item and render it into a shape. Return that shape as a ShapeResult, and you should be good to go.