Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
Pablo Raguenes
Customizable link columns in footer
2010. november 18. 3:28
Válasz

Pablo Raguenes

Rangsorolás: Junior Member

Hozzászólások: 62

Csatlakozás dátuma: 2010. november 18.

Legújabb hozzászólások

Hello everyone,

I'm a new user of Liferay portal (6.0.5) and I'm currently developping a website for a new company. This is also my first web development experience so pardon me if I'm a bit ignorant about CSS, Velocity or even HTML emoticon

I've "created" my own theme (not from scratch, just customizing the official Liferay classic theme) and managed to obtain a decent header (logo, navigation bar with multiple layer menus, etc...). That was "not so hard" cause Liferay classic theme already got all these features, I just had to customize them (position, font, color, ...).

Now I need to add a list of links in the footer, arranged in columns, which is quite common on websites
ex Amazon :


My problem is that I don't want these lists to be part of the theme cause it's a "non-developper" person (marketing) that will manage the content of the website, including this list of links. So I'd like to know where he could store these links and their structure (order, column header, etc...) and how I could retrieve it in the theme.

I've seen the Bookmarks portlet, with subfolder and links, it could work for the marketing person. But how can I retrieve the data from this portlet in the Velocity template ?

I've noticed it's possible to retrieve some elements of the company in the theme
ex in template "init.ftl" :
1<#assign company_name = company.getName() />


Could I access the bookmarks in the same way ?
ex :
1<#assign company_bookmarks = company.getBookmarks() />


and then browse these bookmarks to display them by columns ?

I've made some research in the wiki and the forum, but I'm surprised to find no other questions/articles about this "issue" since this kind of footer is common on websites.

Thanks to anyone who could give me a hint emoticon
James Falkner
RE: Customizable link columns in footer
2010. november 18. 7:39
Válasz

James Falkner

LIFERAY STAFF

Rangsorolás: Liferay Master

Hozzászólások: 997

Csatlakozás dátuma: 2010. szeptember 17.

Legújabb hozzászólások

You probably want to do two things

1. Define your footer structure along with a template, using Liferay's web content management system, so that your marketer can manage the titles and links of the footer without worrying about layout.

2. Then, in your customized footer, include your web content article using something like

1<% JournalArticle article = JournalArticleLocalServiceUtil.getArticle(groupId, "CUSTOM-FOOTER-ARTICLE-ID");
2long articleResourcePrimKey = article.getResourcePrimKey(); %>
3<liferay-ui:journal-article articleResourcePrimKey="<%= articleResourcePrimKey %>" />


And make sure to include the above jsp in one of your customized theme files, e.g.

1$theme.include("/my/footer.jsp")
Pablo Raguenes
RE: Customizable link columns in footer
2010. november 18. 8:46
Válasz

Pablo Raguenes

Rangsorolás: Junior Member

Hozzászólások: 62

Csatlakozás dátuma: 2010. november 18.

Legújabb hozzászólások

Thanks for your answer emoticon

But my problem is that the marketer wants to worry about the layout (the number of columns, the order of columns, the order of links inside each column).

So I've created a footer.vm file with the following code :
 1<table>
 2    <tr>
 3        #foreach ($nav_item in $nav_items)
 4            <th>
 5                <span>
 6                    $nav_item.icon() $htmlUtil.escape($nav_item.getName())
 7                </span>
 8            </th>
 9        #end
10    </tr>
11    <tr>
12        #foreach ($nav_item in $nav_items)
13            <td>
14                <a href="$nav_item.getURL()" $nav_item.getTarget()>
15                    <span>
16                        $nav_item.icon() $htmlUtil.escape($nav_item.getName())
17                    </span>
18                </a>
19            </td>
20        #end
21    </tr>
22</table>


It creates a table with n columns (n being the number of pages in the navigation). Of course it's not what I want. emoticon
Instead of looping on $nav_items, I would like to loop on a map of links, grouped by category.
And I don't see how the marketer could organize links in a web content portlet, that's why I used the Bookmarks portlet.

I'm not sure I made myself clear (English isn't my native language emoticon), but I don't know how many columns there will be in the footer, and it might change from time to time, that's why I can't force a layout on the marketing

PS : I know the <table> tag is not the best solution and that I should use <div>, but I didn't manage to create n div of equal width (since in the CSS I don't know what n is equal to)
Pablo Raguenes
RE: Customizable link columns in footer
2010. november 22. 3:03
Válasz

Pablo Raguenes

Rangsorolás: Junior Member

Hozzászólások: 62

Csatlakozás dátuma: 2010. november 18.

Legújabb hozzászólások

Hello again,

I've tried your solution but get a NullPointerException when I try to include the JSP file in the Velocity template (portal_normal.vm) :

 110:49:28,227 ERROR [IncludeTag:231] Current URL /web/guest generates exception: Invocation of method 'include' in  class com.liferay.taglib.util.VelocityTaglib threw exception java.lang.NullPointerException at test-classic-theme_SERVLET_CONTEXT_/templates/portal_normal.vm[line 78, column 24]
 210:49:28,227 ERROR [IncludeTag:154] java.lang.NullPointerException
 3    at com.liferay.taglib.util.VelocityTaglib.include(VelocityTaglib.java:348)
 4    at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
 5    at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
 6    at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
 7    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
 8    at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:342)
 9    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
10    at org.apache.velocity.Template.merge(Template.java:328)
11    at org.apache.velocity.Template.merge(Template.java:235)
12    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:381)
13    at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:155)
14    at com.liferay.portal.velocity.VelocityEngineImpl.mergeTemplate(VelocityEngineImpl.java:165)
15    at com.liferay.portal.kernel.velocity.VelocityEngineUtil.mergeTemplate(VelocityEngineUtil.java:71)
16    at com.liferay.taglib.util.ThemeUtil.includeVM(ThemeUtil.java:329)
17    at com.liferay.taglib.util.ThemeUtil.include(ThemeUtil.java:75)
18    at com.liferay.taglib.theme.IncludeTag.include(IncludeTag.java:38)
19    at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:223)
20    at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:58)
21    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
22    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


I'm sure I'm giving the right URL since if I change the URL, I get a "file not found" error.

Anyway, this solution seems quite complex for the marketing.
So they simply suggested to put a Web Content portlet in the footer, since they'll be used to edit this kind of portlet, and this portlet allows to make a customized table in an easy way (Excel/Clac style)
But according to my researches on this website, it's impossible to put a portlet in the footer emoticon
So is there a way to display a portlet automatically on every pages ?

I've seen the "preferences-unique-per-layout" preference which make a unique instance of the portlet for multiple pages, but how can I automatically add this portlet to all pages (if possible at the bottom of the page) ?