[opencms-dev] TemplateOne Example...

Deiverson Jorge deiverson at oriens.com.br
Tue Dec 20 13:40:08 CET 2005


Hi ,

Does anyone have or could post an example of templateone for news. A "how
to" would be very wellcome.
I'm intending to build a microsite that shows the news created in a
subfolder.
After a hard time trying I'll describe what I did:


1 - I First  created a project and changed its type to "Microsite".


2 - Than created a main_test.jsp, inside the fonder
/system/myproject/template/ similar to 
/system/modules/org.opencms.frontend.templateone/templates/main.jsp


3 - Rebuild the main_test.jsp (based on main.jsp) to show only the news
and got to this result:

<%@page buffer="none" session="false" import="java.util.*,
org.opencms.frontend.templateone.*" %><%

// initialize action element to access the API
CmsTemplateBean cms = new CmsTemplateBean(pageContext, request, response);

String resPath = cms.getResourcePath();
%>

<% cms.editable(true); %>

<link href="<%= cms.getStyleSheetUri(resPath,
cms.getStyleSheetConfigUri(), cms.getRequestContext().getSiteRoot(), 
cms.getRequestContext().getLocale()) %>" rel="stylesheet" type="text/css">

<% cms.buildHtmlBodyEnd(); %>


3 - Created a page index.html in /myproject/ and set the template
main_test.jsp. Still, I had to set the following properties to make it
work:
layout.right = /system/shared/templateone/right/news (No content or
properties. Didn't get what is this for)
template = /system/modules/br.com.oriens/templates/main_teste.jsp


4 - Copied the folder /modules/ from /sites/default/modulesdemo/ to
/myproject/. Here is the structure:
-> /myproject/
   ->/modules
     ->/news/all news
   ->index.html

I tryied this first:
-> /myproject/
   ->/news/all news
   ->index.html
But didn't work.


5 - Copied the files foot_links.jsp and nav_head_menus.jsp from
/system/modules/org.opencms.frontend.templateone/elements/ to 
/system/meuprojeto/elements/, cause main_test.html require them. (I
believe it's because the import of org.opencms.frontend.templateone.*).


6 - So when I run /myproject/index.html the
/system/meuprojeto/template/main_test.jsp works fine with the
foot_links.jsp and nav_head_menus.jsp both in /system/meuprojeto/elements/
and shows the news from /myproject/modules/news/. When I add more news,
they are included correctly in /myproject/modules/news/


7 - I checked the
/system/modules/org.opencms.frontend.templateone.modules/elements/list_news_right.jsp,
which is loaded to (putted an alert("ok") and confirmed that it really
passes through this page) and in the line:

String folder = request.getParameter("folder");

The folder value is "/modules/news/". Where this came from? I'd like to
change this value to "/news/" to change my project structure to:

-> /myproject/
   ->/news/all news
   ->index.html
Is this ok?

Will be necessery to put the list_news_right.jsp inside
/system/myproject/elements/. Who and how it refers to the file
list_news_right.jsp?

It shows only the last 5 news. Where can I configure this? Couldn't find
tha page or property that controls this behavior. Still, why the files
foot_links.jsp and nav_head_menus.jsp are required and who calls them.

I have found a sample site in the docs but not the procedures to create a
new project.

I'd like to have the following structure:

-> /myproject/
   ->/news/all news
   ->index.html

-> /system/
   ->/meuprojeto/
     ->/elements/news.jsp (containing list_news_right.jsp, foot_links.jsp
and nav_head_menus.jsp)
     ->/templates/main_test.jsp

Does anyone can help? I believe that an example of a site that only shows
news would make easier to understand and use the code to other projects.

##############################
Deiverson Silveira
Programador Java/JSP
www.oriens.com.br
##############################




More information about the opencms-dev mailing list