Multiple paragraphs in a CQ5 page don't work - aem

I tried adding muultiple "par" components in my template's JSP. But only the one appearing first is visible on the page.
Is there is limitation of using paragraphs in a page ?

Just change the value for your path variable
<cq:include path="par1" resourceType="foundation/components/parsys" />
<cq:include path="par2" resourceType="foundation/components/parsys" />
this should help you in having multiple paragraph components

Related

How to use t3:// TypoLinks in TYPO3 HTML Content Elements without disabling `parseFunc.htmlSanitize` globally?

Since the release of the security patches in August 2021 that prevents Cross-Site Scripting via Rich-Text Content I noticed that the output of HTML Content Elements suddenly changed in our projects. Some tag attributes and tags got removed by the newly introduced HTML Sanitizer (when the template is modified so that t3:// style TypoLinks get rendered).
So simply overriding the default Html.html Fluid Template, changing the <f:format.raw> to <f:format.html> and adding a html decoding like in the following example is no longer sufficient.
<f:section name="Main">
<f:comment> We use this to render links and other stuff in html elements </f:comment>
<f:format.htmlentitiesDecode>
<f:format.html parseFuncTSPath="lib.parseFunc">
{data.bodytext}
</f:format.html>
</f:format.htmlentitiesDecode>
</f:section>
The easiest way to prevent changes in your html codes output provided by HTML Content Elements is to disable the sanitizer globally by adding lib.parseFunc.htmlSanitize = 0 to your TypoScript config, what is not ideal.
How can I disable the parseFunc.htmlSanitize only for this purpose?
Or is there an other solution to render TypoLinks within HTML Content Elements?
Note: You don't need to disable the HTML Sanitizer if you do not override the Html.html template!
Simply make a copy of lib.parseFunc and disable the sanitizer in this copy.
lib.parseHtmlFunc < lib.parseFunc
lib.parseHtmlFunc.htmlSanitize = 0
Then use this lib in your Html.html template.
<f:section name="Main">
<f:comment> We use this to render links and other stuff in html elements </f:comment>
<f:format.htmlentitiesDecode>
<f:format.html parseFuncTSPath="lib.parseHtmlFunc">
{data.bodytext}
</f:format.html>
</f:format.htmlentitiesDecode>
</f:section>
Thanks to #OliverHader for bringing me to the right track.

How to render another page (not only content) in fluid

I search a way to render a page into another page.
I have a page with uid=186 and I want to render this on every page, so I try to render it in the layout.The page with uid=186 got another page template and also uses another layout (the layout is just empty, I don't really need a layout for that page).
My first try was:
<v:content.render pageUid="186" />
But that renders only the content, and also only the columns that are defined in the current page template, not the ones in the page templates I use in uid=186.
I also tried:
<v:render.request action="render" controller="Page" pageUid="186" extensionName="fluidpages"/>
But this leads to the PHP error:
mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 29 bytes) in /var/www/vhosts/myhost/typo3_src-6.2.9/typo3/sysext/frontend/Classes/ContentObject/Menu/MenuContentObjectFactory.php on line 50
As I use a page template with much columns in the page uid=186 I would love to render the hole page as it is, and not fetch each column.
I would also be fine with a typoscript solution.
Anyone got an idea how I could archive that?
you can make a separate file that render the uid=186 with page layout of uid=186
First you have to separate the header and footer or may be you can define the different sections for header and footer in one file (for ex pageObjects.html). so you can render that section whenever you want.
<f:render section="Header" partial="PageObjects" arguments="{_all}" />
<v:content.render pageUid="186" />
<f:render section="Footer" partial="PageObjects" optional="TRUE" arguments="{_all}" />

CQ parsys component persists on the page

I added a single parsys component in my template using the code:
<div class = "BodyText" style="margin-top:75px;" >
<cq:include path="vff1" resourceType="foundation/components/parsys"/>
</div>
But when I create a page, and add some text to the parsys component, the component still stays on the page (below the text I added).
Is there a way to remove it after adding some asset (text or image etc.)in to the parsys ?
The parsys is a drop area for components. You cannot drop components into the parsys then remove the parsys without also removing the components contained inside as the components are sub-nodes of the parsys node in the jcr.
In your case it seems that you would prefer to embed the text component into the template instead of the parsys
<div class="BodyText" style="margin-top:75px;">
<cq:include path="text" resourceType="foundation/components/text"/>
</div>
Remember the path attribute needs to be unique.
To add, the drop area appears only in author mode, if you want to check how it looks in publish mode you can select the preview mode in the sidekick. As such your publish site will be the live site in production
Agree with the answers given above. The correct answer will be just to summarize the above 2 answers.
The parsys component can't be just removed after adding components into it. If you don't want it, then add the desired component ins the jsp of the page. (Not recommended at all)
It is anyways visible only in the 'author' instance. The dotted-bordered component that displays 'Drag components or assets here' won't appear in the 'public' instance.
There is a way to remove the parsys, but I would advice to exercise this with caution.
First in your include parsys you check if the component you want to add into this particular parsys exist or not. If it does than you just directly include in that component into your page, and if not then you include the parsys.
Sample code:
<c:choose>
<c:when test="<COMPONENT_EXIST>">
<cq:include path="<Path to component>" resourceType="<component resource>" />
</c:when>
<c:otherwise>
<cq:include path="<parsys_path>" resourceType="foundation/components/parsys" />
</c:otherwise>
</c:choose>

How can I enable tinyMCE in Umbraco to add a div with a class attribute and contain a paragraph?

I need to allow add a div with a class attribute in tinyMCE in Umbraco. I can add a div, but all content in the div is just text. I need that text has a paragraph, and finally add a class attribute for the div.
It's a little hard to understand what you are asking, but I think this should help.
http://our.umbraco.org/wiki/recommendations/recommended-reading-for-content-editors/adding-styles-to-the-tinymce
You can basically associate a stylesheet with the tinyMCE and then add styles to it that will appear in the style dropdown
You may use
tinymce.activeEditor.execCommand('insertHTML', false, '<div class="section'></div>');
This will insert the specified html into the editor at the local caret position.
Be aware that your valid_elements and valid_children configuration settings won't strip out anything from the html that you insert.
If you can paste your template code then we can be more of a help to you.
What you want to do is wrap your <umbraco:Item field="aliasOfYourRTE" runat="server" />
with the div you want so in your case your code will look like this:
<div class="YOURCLASSNAMEHERE">
<umbraco:Item field="bodyText" runat="server" />
</div>
The umbraco RTE automatically spits out <p> </p> tags when content is inserted. Also, make sure you are publishing your node so that your content is viewable on the front end.
Hope this helps.
Go to Settings - Styles.
Open the stylesheet with the styles for the Format dropdown of TinyMCE in Data Type Richtexteditor.
Add a style with the Alias div.class, e.g. div.alert alert-danger.
If you then click in TinyMCE on a paragraph and then choose in the Format dropdown this style the paragraph is formatted as follows:
<div class="alert alert-danger"> ... </div>
Is this what you wished to do?

How to display everyone of the label and the radio choices in its own line?

I'm using Struts2. By default, when using the struts form, the label and the choices are displayed in the same line. How can I do to make the label in a line, and every radio choice in its own line? Is there a way by CSS? I need your help guys. Here it is how my form looks like. Thank you!
<s:form action="resultAction" namespace="/">
<s:radio label="Gender" name="yourGender" list="genders" value="defaultGenderValue" />
<s:submit value="submit" name="submit" />
</s:form>
Which theme are you using as by default struts2 use xHtml theme and which generate certain set of Tables to render the view.
Struts2 use free-marker template to render the HTML for tags and you can customize theme as per your choice or can create you rown theme.
Try with simple theme which will not generate any table or div and will render plain HTML for you are you have all way to apply your custom CSS to change/customize the view.
You can set the theme per page basis on for the whole application for per page basis add the following line in the head section
<s:set name="theme" value="'simple'" scope="page" />
for whole application you can either set in struts.properties file or in struts.xml file though the second one is more preferable.
<constant name="struts.ui.theme" value="simple" />
If you want to play with theme here is the link for same
struts-2-themes