Extending Liferay 7 default theme - liferay-theme

I am looking to change just a few attributes for the default Liferay 7 theme:
Left Justify the navbar
Hide the Search control in the navbar
Allow a second level to each menu
It seems this is best done using a Themelet? Curious if someone could point me to an existing implementation I could use as a starting point for such a customization.
Thanks,
Randy

To allow a seconde level or ( Child of Child) you should add another loop inside each element. Here is the FreeMarker code to put into navigation.ftl, and you can add you CSS on it.
<nav id="navigation" role="navigation">
<div class="row">
<div class="col-md-9">
<ul class="nav1">
<#list nav_items as nav_item>
<li>${nav_item.getName()}
<#if nav_item.hasChildren()>
<div class="fulldrop">
<#list nav_item.getChildren() as nav_child>
<div class="col-xs-4">
<#assign navchild_name = nav_child.getName() />
<h3>${nav_child.getName()}</h3>
<br>
<#if nav_child.hasChildren()>
<ul>
<#list nav_child.getChildren() as nav_child>
<li>${nav_child.getName()}</li>
</#list>
</ul>
</#if>
</div>
</#list>
</div>
</#if>
</li>
</#list>
</ul>
</div>
</div>
</nav>

Related

remove tag and add additional css class to data-sly-resource

Here's my code and I want to add another css class toggleable-content to the existing code:
<sly data-sly-resource="${'item' # resourceType='components/header'}"></sly>
This code would look something like this:
<section aria-label="aria label">
<ul class="row">
<li class="col">
<div class="body px-3">
<h2 class="h3">
body
</h2>
<p>body text</p>
</div>
</li>
</ul>
</section>
I want to remove section tag and add another css class toggleable-content to the <ul> tag. Below is what I'd like to achieve:
<ul class="row toggleable-content">
<li class="col">
<div class="body px-3">
<h2 class="h3">
body
</h2>
<p>body text</p>
</div>
</li>
</ul>
I was wondering how to use slightly to achieve the above? I tried something below but it doesn't work:
<sly data-sly-resource="${'item' # resourceType='components/header', cssClassName='toggleable-content'}"></sly>
Assuming the section markup is managed by the included resource (components/header) then you cannot do it directly. Indirectly, with AEM, you can pass a parameter (through request attributes) and retrieve it in the components/header model, then add the section conditionally (using data-sly-unwrap for example).
Or you re-organize your code and switch from resource inclusion to template calling and pass the parameter directly using data-sly-call.

Remove ce-wrappers of fluid cObject

I masked(mask-extension) a couple of plug-ins. When the image is generated in the template, it is always wrapped in following divs:
<div id="c63" class="frame frame-default frame-type-image frame-layout-0">
<div class="ce-image ce-center ce-above">
<div class="ce-gallery" data-ce-columns="1" data-ce-images="1">
<div class="ce-outer">
<div class="ce-inner">
<div class="ce-row">
<div class="ce-column">
<figure class="image"><img class="image-embed-item"
src="fileadmin/user_upload/bla" width="975"
height="678" alt=""></figure>
</div>
</div>
</div>
</div>
</div>
</div>
Is there any way to remove all those wrappers? I simply want to have the image.
Sidenotes:
1. f:image does not work, I cannot access the proper uid for it to show. (This is perhaps an issue with mask)
2. I cannot find the tt_content.stdWrap.innerWrap > in my typoScript, as I do not know where mask puts it. It is neither in the netup.ts nor in the NewContentElementWizard.ts
You need to overwrite the fluid_styled_content partial in Resources/Private/Partials/Media/Gallery.html.
How to overwrite, you can read here: https://docs.typo3.org/typo3cms/extensions/fluid_styled_content/8.7/Configuration/OverridingFluidTemplates/

Indexed Search extbase htmltags in output

I am using TYPO3 7.6.11 and indexed_search 7.6.0.
I use the extbase plugin for indexed_search and in the output it escapes the HTML-Tags to mark the searchword. For example, when I search for "search" I get this output:
Test text with<strong class="tx-indexedsearch-redMarkup">search</strong> pattern.
I found this bugfix to this problem: https://forge.typo3.org/issues/77901
But the file PageBrowsingResultsViewHelper.php doesn't look exactly the same, and even when I add the variable protected $escapeOutput = false; it doesn't change anything.
Any idea where this is come from and where I can disable the escaping?
It was another extension who overwrote a Partial of tx_indexedsearch that caused the problem.. -> Always check if the template you are working on is the one that gets outputted ;)
This happen because of format object rendering.your result will render in {row.description} object and initially there is no format set. you have to format your result({row.description}) to the HTML. For that:
Go to the search result file.
yourindexsearch/templatingpath/IndexedSearch/Partials/Searchresult.html
Here is the complete file:
<div class="fourffCom col-sm-6">
<f:format.html><h2>{row.title}</h2></f:format.html>
<f:if condition="{row.headerOnly} == 0">
<!-- Format html -->
<f:format.html>{row.description}</f:format.html>
<ul>
<li>
<p><f:translate key="result.size" /> </p>
<b>{row.size}</b>
</li>
<li>
<p class="tx-indexedsearch-text-item-crdate"><f:translate key="result.created" /> </p>
<b class="tx-indexedsearch-text-item-crdate"><f:format.date>#{row.created}</f:format.date></b>
</li>
<li>
<p class="tx-indexedsearch-text-item-mtime"><f:translate key="result.modified" /> </p>
<b class="tx-indexedsearch-text-item-mtime"><f:format.date>#{row.modified}</f:format.date></b>
</li>
<li>
</li>
<li>
<p><f:translate key="result.path" /> </p>
<b><f:format.html>{row.path}</f:format.html></b>
</li>
</ul>
</f:if>
<f:if condition="{row.headerOnly} == 1">
<!-- Format html -->
<f:format.html>{row.description}</f:format.html>
</f:if>
<f:if condition="{row.subresults}">
<p class="tx-indexedsearch-list">
<f:for each="{row.subresults.items}" as="subrow">
<f:render partial="Searchresult" arguments="{row: subrow}" />
</f:for>
</p>
</f:if>
</div>

Hi, Does anyone knows how to create the automatic sitemap in liferay

I have created the sitemp.xml manually.But now I want to create the automatic sitemap in liferay.
Does anyone knows how to create the automatic sitemap in liferay?
You should
Go to content -> configuration -> Application Display Templates
Write template either in velocity or freemarker
Use site map portlet on your custom page and configure it, using your created custom template.
Here is example of mine:
<div>
<h1>Map service</h1>
<#assign firstLevelCounter=0>
<#list entries as secondLvlLayout>
<#if !secondLvlLayout.isHidden()>
<#if (firstLevelCounter+1)%2==0>
<div>
</#if>
<div>
<div><h2>${secondLvlLayout.getName(locale)}</h2></div>
<#list secondLvlLayout.getChildren() as thirdLvlLayout>
<div>
<div>
<h3>${thirdLvlLayout.getName(locale)}</h3>
</div>
<#if thirdLvlLayout.getChildren()?has_content>
<ul>
<#list thirdLvlLayout.getChildren() as forthLvlLayout>
<li>
<div><span>${forthLvlLayout.getName(locale)}</span></div>
</li>
</#list>
</ul>
</#if>
</div>
</#list>
</div>
<#if (firstLevelCounter+1)%2==0>
</div><hr/>
</#if>
<#assign firstLevelCounter=firstLevelCounter+1>
</#if>
</#list>
</div>

how to display the part of the html using emacs-w3m

I found a w3m plugin in w3m-extension.el for English-Chinese dict like this:
(defun w3m-search-dict-cn ()
"Translate input word and search from dict.cn."
(interactive)
(w3m-search-advance "http://dict.cn/search/?q=" "English Dict.cn" 'gbk))
I configue the w3m plugin to search the dict online using the youdao dict website.
(defun w3m-search-dict-cn ()
"Translate input word and search from youdao.cn."
(interactive)
(w3m-search-advance "http://dict.youdao.com/search?q=" "English youdao.cn" 'UTF-8))
But I found that the result info is too large to read .
What i want is just
<div id="collinsResult" class="tab-content">
<div class="trans-container">
<div class="trans-content">
<div class="collinsToggle trans-container">
<div class="wt-container">
<h4>
<span class="title">exception</span>
<em class="additional spell phonetic">/ɪkˈsɛpʃən/</em>
<span class="star star3" title="使用频率"></span>
<span class="via rank">CET4 TEM4</span>
<span class="additional pattern">(
exceptions
)</span>
</h4>
<ul class="ol">
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">1. </span>
<p>
<span class="additional" title="可数名词">N-COUNT</span>
An <b>exception</b> is a particular thing, person, or situation that is not included in a general statement, judgment, or rule. 例外
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> Few guitarists can sing as well as they can play; Eddie, however, is an exception. </p>
<p>很少有吉他手唱歌能唱得跟弹得一样好,而艾迪是个例外。</p>
</div>
</div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> The law makes no exceptions. </p>
<p>法律不搞例外。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">2. </span>
<p>
<span class="additional" title="习语">PHRASE</span>
If you make a general statement, and then say that something or someone is <b>no exception</b>, you are emphasizing that they are included in that statement. 不例外; 无例外
<span class="additional">[强调]</span>
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> Marketing is applied to everything these days, and books are no exception. </p>
<p>现在市场营销用于任何事物,图书也不例外。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">3. </span>
<p>
<span class="additional" title="习语">PHRASE</span>
If you <b>take exception to</b> something, you feel offended or annoyed by it, usually with the result that you complain about it. 厌恶; 反感
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> He also took exception to having been spied on. </p>
<p>他也厌恶被暗中监视。</p>
</div>
</div>
</li>
<li>
<div class="collinsMajorTrans">
<span class="collinsOrder">4. </span>
<p>
<span class="additional" title="习语">PHRASE</span>
You use <b>with the exception of</b> to introduce a thing or person that is not included in a general statement that you are making. 除外
</p></div>
<div class="exampleLists">
<span class="collinsOrder">例:</span>
<div class="examples">
<p> Yesterday was a day off for everybody, with the exception of Lorenzo. </p>
<p>昨天每个人休一天假,洛伦佐除外。</p>
</div>
</div>
</li>
</div>
</div>
</div>
</div>
</div>
when i search the word "exception" not the whole page.
How can I use the w3m to download the page and get what i want part of the html and then display in the emacs buffer?
M-x w3m-view-source, display source code
M-x html-mode, or any other mode providing the convenient key-binding
Mark the part of interest
M-x copy-to-buffer MY_NEW_BUFFER
Add <html>``</html> tags if missing in section
M-x w3m-buffer, display selected content