How to make a text as a CQ component?


hi,

 

i newbee in cq development, please bear me if ask obvious question.

 

i created template diplays title , summary of page in wcm below.

i put these 2 values of properties each page node using crxde lite.

 

------template.jsp---------------------------------------------------------------

<% string currenttitle = currentpage.gettitle();

string summary = currentpage.getproperties().get("summary",""); %>

 

<h1><%=currenttitle%></h1>

<p><%=summary%></p>

 

-----------------------------------------------------------------------------------

 

it display title each pages in wcm structure. however, when click page wcm.

i cannot edit content of summary can edit using cq component of text. if want edit have go crxdelite and

browse page's jcr:content , find summary property edit it.

 

i tried this.

 

-------template.jsp(what i  tried)-----------------------------------------------

<% string currenttitle = currentpage.gettitle();

string summary = currentpage.getproperties().get("summary",""); %>

 

<h1><%=currenttitle%></h1>

<cq:text property="text"/>

<p><%=summary%></p>

-----------------------------------------------------------------------------------

but displays cq component , text seperately.

 

 

 

is there anyway can this?

 

<cq:text property="text" value="<%=summary%>"/>

hi,

 

try read documentation following links understand how components work , sure how start implementation them:

 

-> http://dev.day.com/docs/en/cq/current/developing/components.html

-> http://dev.day.com/docs/en/cq/current/howto/components_develop.html

-> http://dev.day.com/docs/en/cq/current/getting_started/first_steps_for_developers.html

 

my suggestion first of create custom component "summary" under  "/apps/yourapp/components/summary" dialog set summary description , of course summary.jsp render on page. summary.jsp contains like

 

<% string summary= properties.get("summary", string.class); %>

<p><%=summary%></p>

 

finally need inlclude in template.jsp component:

 

<cq:include path="summary" resourcetype="yourapp/components/summary"/>

 

then if open page in edit mode should have possiblity open dialog component , specify summary.

after click ok on dialog value summary should present on page. of course quick overview, better please check link documentation.

 

i hope somehow helps you.

 

regards,

kasq



More discussions in Archived Spaces


adobe

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support