[opencms-dev] Inserting content from the HTML Gallery

Thomas März thomasmaerz at gmx.de
Sat Jun 7 02:04:01 CEST 2003


Nicholas Abboud <nicholas.abboud at babelfish.com> writes:
> The HTML Gallery in OpenCms looks like a great way to keep the same
> content on different parts of the site but only have to make the
> change once. The problem I'm having with the HTML Gallery, though, is
> that none of the content I add to the Gallery seems to be able to be
> linked to any of the pages I create.

Maybe you will find this workaround useful:
 - Add a property "path_to_html" to the top folder
   with the value e. g.  "/en/include_html/".

 - Add a property "html_snippet" to the files you want the snippets to
   be included in resp. to a folder, so all the files beneath the folder
   inherit this property.

Then modify your template:

<%
com.opencms.flex.jsp.CmsJspActionElement cms = new
    com.opencms.flex.jsp.CmsJspActionElement(pageContext, request,
                                             response);      
com.opencms.file.CmsObject cmsObject = cms.getCmsObject();

String html_folder  = cms.property("path_to_html", "search", "/default/path/");
String html_snippet = cms.property("html_snippet", "search", "empty.html");
%>
<%
// put this at the right place in your template where you want the content
out.println(cms.getContent(html_folder + html_snippet);
%>

Best Regards,
Thomas März





More information about the opencms-dev mailing list