Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

design_dialog

Avatar

Level 3

Hi,

How do I create a text component as a design_dialog? I need to have a place to hold a text that will be the same for the whole website.

Thank you.

Cheers,

Viren. 

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi Viren,
Would it be enough if you create you own iparsys that holds the text you want, let say on the parent page. Then the child pages of this one will have the opportunity to inherit the same text as entered in the parent page. This component could then be automatically included in your template if you wish to have it on every page (do you don't forget some pages).

Otherwise you could have a component where you ahve a design dialog. This design dialog could hold a value like, myText.

In the design_dialog.xml, you could have something like:
 

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" title="My Text Dialog" xtype="panel"> <items jcr:primaryType="cq:WidgetCollection"> <mytext jcr:primaryType="cq:Widget" fieldLabel="This is my text" name="./myText" xtype="textfield"/> </items> </jcr:root>

Then in the component jsp file:
 

<% //.... String myText = currentStyle.get("myText", "Default Text"); //... %> <p><%= myText %></p>

This was just a basic example but it should be possible for you to choose a method that suits you.
Good luck
/Johan

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

Hi Viren,
Would it be enough if you create you own iparsys that holds the text you want, let say on the parent page. Then the child pages of this one will have the opportunity to inherit the same text as entered in the parent page. This component could then be automatically included in your template if you wish to have it on every page (do you don't forget some pages).

Otherwise you could have a component where you ahve a design dialog. This design dialog could hold a value like, myText.

In the design_dialog.xml, you could have something like:
 

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Dialog" title="My Text Dialog" xtype="panel"> <items jcr:primaryType="cq:WidgetCollection"> <mytext jcr:primaryType="cq:Widget" fieldLabel="This is my text" name="./myText" xtype="textfield"/> </items> </jcr:root>

Then in the component jsp file:
 

<% //.... String myText = currentStyle.get("myText", "Default Text"); //... %> <p><%= myText %></p>

This was just a basic example but it should be possible for you to choose a method that suits you.
Good luck
/Johan