cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying articles in menu

lemmy
Champ in-the-making
Champ in-the-making
Hi,

I'd like to show articles in the menu. Assuming I'm having a section 'news' which doesn't contain subsections but a couple of articles news1, news2 and news3. In the menu item news these articles should be displayed as sub items. I've learned that the menu is rendered by the file:

Alfresco\tomcat\webapps\wcmqs\WEB-INF\webscripts\menu\top.get.html.ftl.

It's macro outputMenu list the sections. I've read the wiki about Freemarker but a peace is missing in my understanding:

Where are these keyword like section, section.title etc. defined?
Is there a list of these keywords and attributes available?

I'm talking about something like:

<#list section.articles as article>
    <li><a href="${url.context}${article.path}"><#if article.title?? && article.title?length gt 0>${article.title}<#else>${article.name}/#if></a>                
    </li>                          
</#list>

Thanks,
Lemmy
3 REPLIES 3

bremmington
Champ on-the-rise
Champ on-the-rise
There is a little information about the objects available on the wiki. Your question prompted me to look for the WQS API javadoc online, and I failed to find it. I shall work on getting that fixed. Basically, each request processed by WQS has a few objects available to it. These are injected into the request by the ApplicationDataInterceptor: "webSite" (of type WebSite), "section" (of type Section), and "asset" (of type Asset). You can find these interfaces in the org.alfresco.wcm.client package.

Perhaps what you want is a new asset collection in your top level sections that hold the articles that you want to show in the nav. Then introduce a javascript controller to the "top" component that builds up a data structure that represents the nav tree that you want to display. Use section.getAssetCollection("asset collection name") to obtain the asset collection.

lemmy
Champ in-the-making
Champ in-the-making
Thanks for your reply, Brian.

The script top.get.html.ftl uses e.g. section.title. In the Section interface I can't find a getter for title. So where does it come from? But I do find getAssetCollection there. Can I use it in the ftl script?

I'm using a section.articles collection to show all the articles in that section with the cmis-alfresco query

SELECT d.* from cmis:document as d WHERE in_folder('${section:.}') and d.cmisSmiley SurprisedbjectTypeId='D:ws:article'

Basically I'd like to show exactly the same in the menu.

Thanks,
Lemmy

bremmington
Champ on-the-rise
Champ on-the-rise
The getTitle operation is defined on the Resource interface from which both the Section and Asset interfaces are derived. You can call section.getAssetCollection(String) from your Freemarker if you'd prefer not to use a controller.