[opencms-dev] Selective display of Structured Content

Steve Bryan steve at bright-interactive.com
Wed May 28 12:41:16 CEST 2008


Hi Stephane

The proper way here is to create your own collector.

You can manually add edit links, example code below - but this is not part
of the OpenCms API and may well break for future versions of OpenCms - I
doubt the developers would like it! I would at least encapsulate this in a
single function so you can easily change it in future.


<%

// sPath = the path of the XML object
// sThisResourceName = the path of this page (ie the page with the list)

// Edit link
String sLink = "/system/workplace/editors/editor.jsp";
sLink += "?resource=" + sMetadataPath;
sLink += "&backlink=" + sThisResourceName;
sLink += "&directedit=true&redirect=true";		
pageContext.setAttribute("Link", sLink);

%>

<c:out value="${Title}" />
<a href="<cms:link><c:out value='${Link}' /></cms:link>">Edit</a>
<br />


-----Original Message-----

Date: Tue, 27 May 2008 16:53:10 -0400
From: Stephane Bourbonnais <sbourbonnais at nonlinear.ca>
Subject: [opencms-dev] Selective display of Structured Content
To: "opencms-dev at opencms.org" <opencms-dev at opencms.org>
Message-ID:
	<A4C6D3DF120B1648BC9809012E88D4FF5F93622134 at nlcexsvr.linear.local>
Content-Type: text/plain; charset="us-ascii"

Hi,

I have structured content for "stories" on my site. I have a field in the
xml for the "type" of story. I want to use contentload to pull all the
stories in of a certain type (or types), but when I use the code below I get
a bunch of "direct edit" images/code on my page for items I chose not to
show. Is there ANY way (outside of building my own collector) to get this to
work properly?

Is there a way I can remove items from a I_CmsXmlContentcontainer?
Is there a way I can manually put the "direct edit" buttons in if I set the
contentload value for editable to "false"?

<%
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);
CmsJspXmlContentBean cmsXmlBean = new CmsJspXmlContentBean(pageContext,
request, response);

                I_CmsXmlContentContainer container =
cmsXmlBean.contentload("allInFolderDateReleasedDesc",
cms.getRequestContext().getFolderUri() + "story_%(number).html|story",
cms.getRequestContext().getLocale(), true);

while(container.hasMoreContent()) {
                if (cmsXmlBean.contentshow(container, "Type").equals("1")) {
                                out.print(cmsXmlBean.contentshow(container,
"Title"));
                }
}
%>

Any help would be greatly appreciated. Thanks!

Stephane Bourbonnais

non-linear creations inc.
987A Wellington St., Suite 201, Ottawa, Ontario, Canada, K1Y 2Y1
tel: 613.241.2067 ext: 264  fax: 613.241.3086

http://www.nonlinear.ca<http://www.nonlinear.ca/>  |
sbourbonnais at nonlinear.ca<mailto:sbourbonnais at nonlinear.ca>





More information about the opencms-dev mailing list