[opencms-dev] Direct Edit does not work ...

Michael Emmerich emmerich at german-navy.de
Sat Sep 11 10:41:42 CEST 2010


Olivier,

a simple template with direct edit would look like this:

<html>
<head>
<title><cms:property name="title" escapeHtml="true" /></title>
<cms:editable />
</head>
<body>

<h2>My first template head</h2>

<!-- Main page body starts here -->
<cms:include element="body" editable="true"/>

<!-- Main page body ends here -->

<h2>My first template foot</h2>

</body>
</html>


I would always suggest to use the taglib and not scriplet code, your 
templates/jsos will be much easier to maintain.

You might take a look in the alkacon documentation mudules as well, 
there is a basic template-how to in it.

Kind regards,
Michael

> Hi all,
> I did not use OpenCms for 2 years and I think I forgot sthg...
> In a context where I have multiple site,
> I would like to use the Direct Edit feature on a page (xmlpage) called
> index.html
> I coded a micro-template just to test and unfortunatly, even if I am
> logged / offline and in the right siteRoot ... I never get the Direct
> Edit button.
> Is somebody can help me ?
> here is the code of the template (.. basic ..)
>
> <%@ page import="java.util.*,org.opencms.file.*,org.opencms.jsp.*"
> buffer="none" session="false"%>
> <%
> // create a JSP action element
> CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
> response);
>
> // get own uri
> String uri = cms.getRequestContext().getUri();
> %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <html>
> <head>
> <title>Demo page with 1 element</title>
> </head>
> <body>
> <h2>Demo</h2>
> <p><!-- Editable body
> element --> <%
>
> CmsObject cmsObject = cms.getCmsObject();
> cmsObject.loginUser("Admin", "admin");
> CmsProject cmsproject = cmsObject.readProject("Offline");
> cmsObject.getRequestContext().setCurrentProject(cmsproject);
> cmsObject.getRequestContext().setSiteRoot("/sites/default/");
> // include editable element from the URI
> cms.include(uri, "body", true);
>
>
> %> <!-- /Editable body element --></p>
> </body>
> </html>
>
>
> Olivier
> Ce message est à l'attention exclusive des destinataires désignés. Il
> peut contenir des informations confidentielles. Si vous n'êtes pas
> destinataire du message, merci d'en avertir immédiatement l'expéditeur
> et de détruire ce message. Le contenu de ce message ne pourrait engager
> la responsabilité de Steria que s'il a été émis par une personne dûment
> habilitée agissant dans le strict cadre de ses fonctions et à des fins
> non étrangères à ses attributions. Bien que les meilleurs efforts soient
> faits pour maintenir cette transmission exempte de tout virus,
> l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité
> ne saurait être engagée pour tout dommage résultant d'un virus transmis.
> This message is intended exclusively for the designated addressee. It
> may contain confidential material. If you are not the correct addressee,
> please notify the sender immediately and destroy the message. The
> content of this message will engage the responsibility of Steria only if
> it has been sent by an authorized person acting in the strict scope of
> his functions and for purposes that are related to his competence.
> Although reasonable efforts have been made to keep this transmission
> free from viruses, the sender will not be liable for damages caused by a
> transmitted virus.
>
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list