I'm editing a Liferay Theme. By editing the portal_normal.vm, I want to conditionally show or hide a component
#if ($is_welcome_page)
<span class="lang">
$taglibLiferay.language("fm",null,"languageId",1)
<br>
<div class="my-menu">
...... lots of irrelevant stuff here
</div>
</span>
#end>
How can I make that $is_welcome_page variable become true only if the current page is the Portal's Welcome page ?
I guess I could get the friendly Url and check it, but I'm not sure how I can do that. Any working code would be much appreciated!
Edit: using Liferay 6.1.0 if that helps
Generally customising themes per-page is a bad practice (theme should be global or customized for a specific site). To do it correctly, you should just add language portlet on your main site instead of hardcoding it within a theme template.
Anyway, if you really want to do it, you have access to the layout object (directly or via $layout = $theme.getLayout()), which in Liferay is a representation of a page (for example it has getFriendlyURL() method). Check Liferay Wiki for the list of all variables accessible from Velocity, there are lots of others properties you could use, for example the_title.
This is a theme customization, so a good practice is to put all custom settings within Theme Settings. You can read how to do it in Liferay's documentation.
I did it, thanx to #Krzysztof Gołębiowski
#set($testPageName = $theme.getLayout().getFriendlyURL())
#set($layout = $theme.getLayout())
#set($currPageName = $layout.getFriendlyURL())
#set($isWelcomPage = $currPageName == "/home")
#if ($isWelcomPage)
<span class="lang">
$taglibLiferay.language("fm",null,"languageId",1)
<br>
#end
Related
I am using typo3 v9.5.0. I need to design a website with a background image wrapped all over the content element and menu. There is no specified layout in bootstrap package. I've tried extensions like background by uploading the image.
But there is something wrong. By default its pointing the wrong resource which it left(typo3/01_DBM).
I have no clue why it's behaving like that. If there is any other extension or technique, kindly suggest me. But I want it to be done dynamically because it needs regular updation.
TYPO3 9.5.0 is outdated. although you use it localy update to current version.
you have multiple options to integrate a background image to the whole page.
Here my recommandation which does not require any specific extension:
As you use the bootstrap-package you can enhance the Fluid-templates of it in your own site-extension (which you should use).
Where do you get the image from?
Every pages record (defining a page in TYPO3) has fields for related media files (you can find/set it on the Resources tab.
Here an editor can easily insert an image which should be used as a background image to the content.
In your typoscript definition of variables for the page you can define an own variabel for the first image
10 = FLUIDTEMPLATE
10 {
[...]
dataProcessing {
111 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
111 {
references {
fieldName = media
table = pages
}
as = BackgroundImages
}
}
[...]
}
and use it in the fluid template for the page like:
[...]
<div style="background-image:url(fileadmin/{BackgroundImages.0.originalFile.identifier});">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: '{data.uid}', colPos: '0'}" />
</div>
[...]
further enhancements could use a sliding mechanism, so a page without own background-image could use the image of parent page.
If this isn't possible please let me know!
I'm hoping there's a solution to what I'm asking.
I need to move the Next/Prev buttons, located in the pagenavigation plugin to after the <jdoc:include type="component" />; Basically render it anywhere in my templates' index.php?
Is there any way to do this?
This is the code that renders the pagination:
<?php
if (!empty($this->item->pagination) && $this->item->pagination && $this->item->paginationposition && !$this->item->paginationrelative):
echo $this->item->pagination;
?>
<?php endif; ?>
As you can see the pagination is part of the item. As you can see if you look at the pagenavigation content plugin the pagination values are created in response to the onContentBeforeDisplay event. The plugin is hard coded to only work for articles in the single article view.
So to use it in a different component you would really need to create a second plugin for that component (or you could do any component or anything besides the single article view, that all would be easy to code using context).
To locate it in a different place in the single article view you would have to move the block of code to the desired location in the layout. Potentially you could also use css to locate the rendering of the block somewhere else on the page. (But more on this at the bottom.)
Unfortunately (but nor surprisingly given its name) onContentBeforeDisplay comes really late, in the view (unlike with pagination in the backend).
I always find it confusing because this frontend "pagination" property controlled by this plugin has nothing to do with backend pagination which is controlled by a JPagination object. I believe if is because of backward compatibility all the way to 1.0. ALso because the template chrome for pagination chrome are called pagination.php.
That leads me to the next thing I'll mention. You can make a file pagination.php and put it in the html folder of your template. You can see an example of this in the core template protostar. THat's where you would do the CSS or whatever other tricks you want to do to make the pagination do what you want. I think if you work hard enough at it (possibly using javascript or possibly calling that file from a module) you can pretty much achieve whatever you want.
I would like to ask how I can block richText from changing html text under source view.
I'm using Blossom module and defined richText as #Chris J advised me to do:
Add source button to Magnolia CMS richText control
Whenever I put html code in source code, switch to normal view and get back to source view the code is changed. For example the following part of code is missing :
<div class="components"> <div class="product col img-slider"> <div id="product-image" class="royalSlider productImage rsDefault"> <div class="rsContent"> <div class="rsTmb"><img src="/magnoliaPublic/resources/XXX/products/product_7.jpg" alt="">
and is replaced with folowing
<p><img alt="" src="/magnoliaPublic/resources/XXX/products/product_7.jpg" /></p>
I need to provide the possibility for the user to put html code and next to see in on the web page.
Regards
Jan
Jan. I'd ask why you are using a rich text area if you are entering HTML. It is not really designed for this usage. Would you be better off with an ordinary text field? In the STK (you mentioned this in your previous question) you will find a component that serves exactly this purpose.
Under "Configuration" you will find it at /modules/standard-templating-kit/templates/components/content/stkHTML
You will see that the template script is simply:
[#if content.editHTML?has_content]
${cmsfn.decode(content).editHTML}
[/#if]
If you want to stick with a purely Blossom approach, you may need to recreate this but it is an incredibly simple component.
Incidentally, in Magnolia 5.4 there is a code editing field used in a similar component that offers syntax highlighting. You can see this by logging into the demo site and trying to add an HTML component to the main area of the page travel/contact.
I'm building a business app and having Facebook, etc in the file dialog is not so cool. How can I hide it? I thought it might be possible with custom CSS and a "visibility: hidden" style , but the services don't have individual class names. Only other way is with nth child, but that would be very messy...
Thanks,
Graeme
You can specify it as an option:
filepicker.pick({services: ['DROPBOX','BOX',…]}, ....);
https://developers.filepicker.io/docs/web/#pick
or:
<input type="filepicker" data-fp-services="BOX,COMPUTER">
https://developers.filepicker.io/docs/web/#widgets-pick
I am using Liferay 6 and Tomcat for development .
I have developed a Custom Login POrtlet for my Application
Now on entering http://localhost:8086 , my Custom Login Page is displayed .
Please see the screen shot .
My question is , could anybody tell me how can we remove that Liferay Logo , Sign In Hyperlink ( Extreme right top ) and Powered BY ?? from the screen .
Actually the Logo can be changed without creating a theme. The other items require a cusotm theme however (where you will want to edit the velocity macros). For the logo look under Control Panel > Portal > Portal Settings and then click "Display Settings" on the right side.
Additionally you can also provide a small amount of css to the basic theme as well, but this should be considered a temporary hack at best. Go to Manage > Page Layout > Public Pages and at the bottom you will see a section labled CSS in there you can do:
#sign-in { display: none }
.powered-by { display:none }
But bear in mind that a user with firebug or similar tools can still expose the old sign-in by changing the CSS in firebug and the Liferay tag line is still in the source so it's only hidden from non-technical folks. A theme is really the right solution.
Yes you can remove all of those by creating your own Liferay Theme, deploying it, and then setting that Theme as the one to use for your Community.
This Liferay Wiki Article on creating Theme's should get you started, if you have any questions after this then ask away! :)
Go to custom.css file inside _diff folder of your theme add the below code:
#sign-in { display: none }