Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Recent blogs

RSS - Blogs
December 24, 2008
The year has almost ended...
December 9, 2008
5 Spring pitfalls
December 9, 2008
Like A Version
October 22, 2008
New certification process
October 17, 2008
Search quest [3/3] - improvements

All Blogs...


New in WebManager 9.5 part 1: Content API additions

July 10, 2008

GX WebManager 9.5 is released today and I will write some blog posts to elaborate a bit more on the new features for developers in 9.5. So you’ll not only hear our marketing department say how cool every feature is, but also see that things actually work :- ).

In this post I’d like to take a look at some new additions to the GX WebManager content API. This content API is becoming increasingly powerful and the following examples will hopefully prove this.

getMediaItems()

It’s only one function, but currently it’s one of the most powerful functions in the content API. With this function you can retrieve media items based on a range of selection and sorting criteria. Before 9.5 there were several ways to retrieve media item content, but they were not bundled in a single function.

When looking up the getMediaItems tag in the Javadoc you see that it’s basically a media collection element, at least it contains many of its fields and functions.


So let’s create an example with getMediaItems(). One thing that’s now a piece of cake is creating a tag cloud, or Folksonomy as you Web 2.0 gurus might say. To create this example simply paste the code below in the mediaItemContent.jspf template:

<br/><br/>
<h2>Tags</h2>
<c:if test="${not empty mediaItem && not empty mediaItem.current}">
	<c:set var="termsString" value="" />
	<c:forEach var="term" items="${mediaItem.current.terms}">
		<%-- retrieve the media Items based on this term --%>
		<wm:getmediaitems var="mediaItemResult" andterms="${term.name}" excludemediaitemids="${mediaItem.id}" />
		<c:set var="addToTermsString" value="<a href=\"javascript:;\" style=\"font-size: ${10+(2*fn:length(mediaItemResult))}pt; \">${term.name}</a>" />
		<c:choose>			
			<c:when test="${empty termsString}">
				<c:set var="termsString" value="${addToTermsString}" />
			</c:when>
			<c:otherwise>
				<c:set var="termsString" value="${termsString}, ${addToTermsString}" />
			</c:otherwise>
		</c:choose>		
	</c:forEach>
	${termsString}
</c:if>
<br/><br/><br/>
<h2>Related articles</h2>
<c:if test="${not empty mediaItem && not empty mediaItem.current}">
	<c:set var="termsString" value="" />
	<DL>
	<c:forEach var="term" items="${mediaItem.current.terms}">
		<c:choose>
		<c:when test="${empty termsString}">
			<c:set var="termsString" value="${term.name} (${term.id})" />
		</c:when>
		<c:otherwise>
			<c:set var="termsString" value="${termsString},${term.name} (${term.id})" />
		</c:otherwise>
		</c:choose>
		<%-- retrieve the media Items based on this term --%>
		<wm:getmediaitems var="mediaItemResult" andterms="${term.name}" excludemediaitemids="${mediaItem.id}" />
		<c:if test="${fn:length(mediaItemResult)>0}">
			<DT>
			tagged with: '${term.name}' (${fn:length(mediaItemResult)})		
			<br/>
			<c:forEach var="mediaItemsWithTerm" items="${mediaItemResult}"  varStatus="loopStatus">
				<wm:link var="mediaItemLink" linkText="${mediaItemsWithTerm.current.title}" contentid="${mediaItemsWithTerm.id}" />
				<DD>${mediaItemLink.htmlTag}</DD>
			</c:forEach>
			</DT>
		</c:if>	
	</c:forEach>
	</DL>
</c:if><br/><br/>

Then enter some articles with various terms and make sure you enter some articles that contain the same term. When you view an article on the website you will see something like this:  


So as you can see retrieving related articles based on their tags/terms is now extremely easy. Now it's simple to create new applications like tag clouds and related articles anywhere anytime.

Content syndication

This also opens up new possibilities in terms of using GX WebManager content on other websites. You can simple create an XML presentation that returns media items based on certain selection criteria. This allows you to create feeds similar to YouTube's API feed: http://gdata.youtube.com/feeds/api/standardfeeds/most_popular. Perfect for exchanging unformated content with 3rd party websites and apps. You can use an XML format similar to YouTube or Flickr or define your own XML format. It's all done in JSPs so you also benefit from caching and even personalization if you want.  

Other additions

Besides the getMediaItems several other functions have been added to offer more functions through the API:

In the PageManagementService

  • copyBlock(Page block, Page targetParentBlock)  and copyBlock(PageVersion blockVersion, Page targetParentBlock)
  • copyPageModel(PageModel pageModel)

In the MediaRepositoryManagementService:

  • createMediaTerm(Website website, java.lang.String termName)
  • getMediaItemFilterInstance()
  • getMediaItemSortOptionsInstance()

Please see the Javadoc for details.



Paxlie | 11-07-2008 23:46

nice blog Martin, looking forward to using this new exciting feature. Should be awesome!



michelt | 13-07-2008 14:30

These features will make it lot's and lot's easier to fulfill the needs that typically arise in requirements that we see in designs that need to be implemented with GX Webmanager. Looking forward to using them!

Regards,

Michel



markvc | 14-07-2008 18:52

Wow! This is nice! The filter should now only be extended to also include custom metadata fields and I'm really ready to rock'n'roll.



patricka | 15-07-2008 09:56

Cool stuff, deffo!



jeroen | 02-10-2008 11:53

better and better is the product. looking forward to play with this!


About the Author

Return to all blogs


Martin van Mierloo is Product Manager and has many years of experience with GX WebManager. Martin writes about the GX WebManager roadmap, new product features and WCMS related topics..
Read all Martins blog entries

Other blog entries:

December 24, 2008
The year has almost ended...
October 22, 2008
New certification process
October 17, 2008
Search quest [3/3] - improvements
October 17, 2008
New in 9.6: Import/export
September 17, 2008
Using Google Custom Search on your site
July 16, 2008
New in WebManager 9.5 part 2: Personalization API
June 27, 2008
Ease of implementation
June 18, 2008
Content Management and Sustainability
May 28, 2008
Search quest [2/3] - Relevance
March 13, 2008
Search quest [1/3]


Share:

del.icio.us
digg
Technorati
Slashdot
Reddit
YahooMyWeb
NewsVine
ekudos
© 2008 GX creative online development B.V.

Disclaimer

This website (GXdeveloperweb.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.