I am trying to create some sort of template which would show different portlets, according to a given parameter in the page, say for example a querystring or a request parameter.
I have the following code:
#if( $request.getParameter('sneiders') == 'snuffles' )
<div class="col1" id="col1">$processor.processColumn("col1")</div>
#else
<div class="col2" id="col2">$processor.processColumn("col2")</div>
#end
Portlets in column "col2" show up correctly, but portlets in column "col1", which should appear in /my/url?sneiders=snuffles, do not show up correctly. Somehow liferay just prints empty portlets, with the css class portlet-static
However, if i change things a little:
#if( $request.getParameter('sneiders') == 'snuffles' )
<div class="col1" id="col1">$processor.processColumn("col1")</div>
#elseif( $request.getParameter('sneiders') == 'snuffzen')
<div class="col2" id="col2">$processor.processColumn("col2")</div>
#else
<div class="col1" id="col1">$processor.processColumn("col1")</div>
<div class="col2" id="col2">$processor.processColumn("col2")</div>
#end
Portlets will show up correctly in any of those situations, which makes me think that you need a "default" case that will process all the columns
Has someone ran into this issue ? Is it an issue or am i doing things wrong ?
Any help will be much appreciated.
Best Regards
If I remember correctly, you may need to setup your portlets in the layout while all the columns are shown, otherwise the layout won't save correctly. So when you place a portlet when only column-1 is shown, the portlets previously set up in column-2 will be gone.
You may consider doing something like this so you will be able to set up the layout correctly (yet users won't be able to mess with parameters to show both columns):
#if( $themeDisplay.getPermissionChecker().isOmniadmin() )
<div class="col1" id="col1">$processor.processColumn("col1")</div>
<div class="col2" id="col2">$processor.processColumn("col2")</div>
#elseif( $request.getParameter('sneiders') == 'snuffles' )
<div class="col1" id="col1">$processor.processColumn("col1")</div>
#else
<div class="col2" id="col2">$processor.processColumn("col2")</div>
#end
Related
How do I check the table checkbox?
I tried clicking.
ie.Document.getElementsByClassName("x-grid3-hd-checker").Checked = True
<div class="x-grid3-hd-inner x-grid3-hd-checker x-grid3-hd-checker-on" unselectable="on" style="">
<a class="x-grid3-hd-btn" href="#"></a>
<div class="x-grid3-hd-checker"> </div>
<img class="x-grid3-sort-icon" src="/javascript/extjs/resources/images/default/s.gif">
</div>
I can't see a checkbox in the HTML code. But you use getElementsByClassName() in a wrong way for your case. getElementsByClassName() generates a node collection. If you need a specific node, you must get it by it's index in the node collection. First element has index 0.
Please note that the div tag with the CSS class class="x-grid3-hd-inner x-grid3-hd-checker x-grid3-hd-checker-on " is also included in the Node Collection, because a part of the class identifier is identical to "x-grid3-hd-checker ". [Edit: I'm not realy sure if the part must maybe stand at the begin of the identifier]
If you want to check this:
<div class="x-grid3-hd-checker"> </div>
Your code needs the second index of the node collection:
ie.Document.getElementsByClassName("x-grid3-hd-checker")(1).Checked = True
But if there are more tags with the class name "x-grid3-hd-checker" the above line don't work. I can't say anymore until you don't post more HTML and VBA code. The best would be a link to the site.
I am trying to get all headers which are not in the footer.
So the header <h3 class="ibm-bold">Discover</h3> should be excluded from the scrape.
<footer role="contentinfo" aria-label="IBM">
<div class="region region-footer">
<div id="ibm-footer-module">
<section role="region" aria-label="Resources">
<h3 class="ibm-bold">Discover</h3>
I have tried using this expression to select the headers which should be excluded, but it doesn't return the right nodes.
//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6]/ancestor::footer/text()
The page I am scraping is this: https://www.ibm.com/products/informix/embedded-for-iot?mhq=iot&mhsrc=ibmsearch_a
Please help
You almost had it.
//*[
(self::h1 or self::h2 or self::h3 or self::h4 or self::h5 or self::h6)
and not(ancestor::footer)
]/text()
I created a search container table that contains a column checkbox type, i.e.
<liferay-ui:search-container-column-text
name="territoriale"
orderable="<%= true %>"
>
<input type="checkbox" id="territoriale" checked="<%= cmt.getTerritoriale() == 1 %>" />
</liferay-ui:search-container-column-text>
This table is declared inside a jsp included using liferay-util:include, but can also be refreshed in the next steps by click on search button.
What happen is that when the table appears for the first time, I see that column just with text (value is "1"), when I click search button that runs the ajax call, the resource action return the correct checkbox in column.
Any ideas?
Below some screen shot
Thanks
Column after page load
Column after click on search button
This works fine on 6.2 CE ga5:
<liferay-ui:search-container-column-text
name="checkbox"
orderable="<%= true %>"
>
<% String checked = (Math.random() < 0.5) ? "checked" : ""; %>
<input type="checkbox" <%= checked %>/>
</liferay-ui:search-container-column-text>
So the root cause of your issue should be somewhere else. You may output cmt.getTerritoriale() into html to check its content.
I think, that checked="<%= cmt.getTerritoriale() == 1 %>" is not correct,
you may use checked or nothing.
See here about using checked attribute.
You can also use rowchecker as was mentioned in the comments of Pankajkumar Kathiriya.
Can anyone please tell me how to dynamically change page layout in Liferay.
Let's consider we have page with Layout 2 column(50/50) and both these columns have portlets.
If a user clicks on any of the portlets, I Would like to change the page layout to 2 column(70/30).
I have never tried it but did you try checking LayoutLocalServiceUtil.updateLayout() ?
That should help you. If you are creating a new page use LayoutLocalServiceUtil.addLayout() otherwise use updateLayout().
Get layout and then update it.
layout = LayoutLocalServiceUtil.getFriendlyURLLayout(groupId, false, friendlyURL);
Adding to-
As provided-
layoutId = LayoutLocalServiceUtil.getFriendlyURLLayout(groupId, false, friendlyURL);
pass the new page's friendlyURL,
if it is a public page then false else true for private,
and make sure that you have applied some layout to the new page(for e.g- 70/30)
Use this layoutId in -
" windowState="<%= WindowState.NORMAL.toString()%>">
provide portletId to the portletname field.
Below is a sample html portion from a layout template...
<div class="portlet-layout">
<div class="aui-w70 portlet-column portlet-column-first" id="column-2">
$processor.processColumn("column-2", "portlet-column-content portlet-column-content-first")
</div>
<div class="aui-w30 portlet-column portlet-column-last" id="column-3">
$processor.processColumn("column-3", "portlet-column-content portlet-column-content-last")
</div>
</div>
if you check it minutely, there are classes describing the width of the div, In my example aui-w70 is for width 70% and aui-w30 is for 30%. I am sure you will also get similar things in your layout too.
If you can change the class names according to your need in desired events, you are good to go...
Give it a try....
Is this possible to do the following in ExpressionEngine:
(code taken from here)
IF THERE ARE RELATED ENTRIES SHOW THIS: (important to see the header)
HEADING : Related Entries:
Entry 1
Entry 2
Entry 3
ELSE (SHOW NOTHING)
...
DONE
Code:
{related_entries id="performers"}
{if no_related_entries}
<h2>No Entries</h2> {/if}
<h2>{title}</h2> {body}
{/related_entries}
How do I hide the header? Because the only way to check if there are related entries is to actually start the {related_entries} LOOP.
Any hints? I don't want to hack into PHP for this.
{related_entries id="performers"}
{if title != ""}
<h2>{title}</h2>
{/if}
{body}
{/related_entries}
This should do it, no need for no_related_entries, since you do not plan on doing anything if there is nothing.
Since you have header tags around your title, I imagine you want to avoid printing out header tags when there isn't any related entries.
so if title is not empty, display, if it is, then it won't, so you'll avoid <h2></h2>
don't worry about putting a conditional around the body tag, it will just not display anything if it is blank, but if you put an html tag around it like you did the title, then you would do the same as you do w/ the title conditional.
This ought to do the trick
{related_entries id="performers"}
{if no_related_entries}
<h2>No Entries</h2>
{if:else}
<h2>{title}</h2> {body}
{/if}
{/related_entries}
Sam "SammyTheSnake" Penny