How to set up a global CSS for an entire page in Liferay DXP? - liferay

I am new to Liferay, and I still don't know the difference between the various 'kind' of Liferays.
This Liferay is what I am talking about.
I understand that you have to create a page first, and then add components (fragments) in it.
I also understand that you can go to fragments, and create a custom fragment with a custom CSS, and then import it into your page.
However, what I want to do is have a global CSS that I can use for all fragments inside a page, rather than having to add CSS for each fragment.
Is that possible, and if so, how?
I know I can use the 'style-books' which apply to an entire page, however, I don't know how to customize them, and it doesn't seem that that's even possible.

To avoid coding, you can use the css additional textbox provide by theme settings.
It's a whole page css addon for every pages in the site

Related

Using Orchard CMS, how do I add a script reference for display only on the home page?

I have a site that is using Orchard CMS and I would like to add a script reference and bit of JavaScript to the home page. It needs to be placed below the existing jQuery script include. What's the best way to achieve this? I've tried using an HTML Widget in the Footer zone of TheHomePage layer of my theme, but this widget produces a and doesn't place the element in the correct location (at the bottom of the element, below the existing jquery reference).
The site is running an old version of Orchard; 1.0 I believe.
You can either use a layout alternate for the homepage (but that may not exist on an antique 1.0), layout-homepage.cshtml with a #using(Script.Foot()) {} block containing your script, or you can use Vandelay Classy to add a script from the admin (but that probably also won't work on 1.0).
Or if none of what Bertrand mentioned above work, just add a html widget to the homepage layer and chuck your script reference in the html section

Orchard CMS 100% unthemed html page

We have a requirement to use the content zone of Orchard CMS to enter in html for a full screen landing page. We managed to get an unthemed page type using the Downplay.Orchard.Layout selector. The problem is that in using the content zone orchard automatically wraps html, head and body tags around it. We want to remove this content so we essentially have a blank page to start off with and then we can create our own html to display on the landing page. Is this possible to do for a single page and if so what would be the best way to do this?
You can have a URL alternate or you can use the new Disable Template part (1.8, i think)
I have done lots of URL alternates in the past. Pretty easy.
Just remembered, a question like this: Using Alternatives for Document.cshtml in Orchard CMS
removing the Wrapper (Document.cshtml) from your (Layout-url-...) and adding a new one, should do the trick.
And it might be better to use the placement.info, but thats my opinion...
Suppressing Wrappers and Placement.info

Conflicts between Custom theme CSS and Liferay CSS

I am trying to customize the Liferay UI by using custom theme using base as as "_Styled" theme.
I have my own css files which I coped to _diff/css folder of theme and imported them "custom.css" file .However its breaking the presentation of liferay.In my custom CSS I have styles defined for all the standard tags like body,div etc which is impacting the liferay UI too.
How can I resolve this conflict? Thanks in advance!
Quick (and not the best) solution is to remove contents of liferays css file (for example "base.css") and save this empty file in /diff/css/ folder of your theme. This way the base.css will get overriden with your new empty file and thus no styles will get loaded. And your custom.css will be the only stylesheet that is taken into account.
Well, of course it all has an effect on the rest of Liferay as well. Liferay provides quite a bit of the HTML DOM of your page, and if you change the presentation of all of those elements, you'll have to take care to style Liferay's elements too.
Is this a conflict? No. Let's go for the simplest case: You declare div {color:green;}. Of course, now everything, your components as well as Liferay's components, use green text. If you only want to style your own portlets, you might want to specify some portlets: div.portlet-my-own-application {color:green;}
I know that color is a too simple usecase, but I hope it illustrates the solution strategy.
Rather than following Artem Khojoyan's suggestion to override Liferay's base.css, I'd recommend to take a look at the resulting css, what's effective etc., and simplify your own css - adapt it to be used within Liferay - by inspecting the effective CSS for every elements that looks off. Firebug or any of it's relatives are your friend.
I'm afraid, with the details "I'm doing something which has an effect on Liferay UI" there's nothing much more to help you. In fact, I'd hope that what you do has an effect on Liferay's UI... You'll just need to find the proper CSS code
Ideally if your styles are loaded from custom.css, then will overwrite liferay default styles.
In some cases, to overwrite a style in css, you can use !important
for example, liferay default style
body {
background-color: #fff
}
You can specify your style to consider irrespective of order of loading
body {
background-color: red !important;
}

Orchard - access a content type through different URLs so they use different views

I'm trying to create a CSS documentation library in Orchard. I want to save a description, CSS snippet and HTML snippet against each content type. The first view would show the description and CSS and HTML code written out. The second view would show a preview of what the CSS and HTML look like rendered.
cssdocumentation.com/content/item1
cssdocumentation.com/content/item1/live-preview
I've created the content type and the first view. But I'm not sure how to create the second view. I can see if I can create the alternative URL I can use the Url Alternates module to create an overriding .cshtml
To create an alternative URL I've looked at the autoroute module but this only allows you to adapt a single URL (unless I'm missing something?) and I've looked at Alias UI but this forces me to manually create an alternative URL everytime I create a content item.
Is this possible in Orchard without writting too much C#? (I'm a frontend developer so I only dabble in the behind the scenes stuff)
Thanks for any help
Best solution is to do this within your own module. But as a secondary option instead of having a second page, combine this content with your first page and hide it with CSS. When the user clicks a button to navigate to the next step render the CSS/HTML result on the same page. You can do this in many ways, here are a few ideas:
Render the CSS/HTML result out straight away on the same page but hide it. Show it when the user clicks a button
using jQuery to render the result on the client side. More dynamic if you allow editing of the HTML and CSS.
Redirecting the user to the same page with specific url parameters which you can pick up in your alternate to modify the output.

Use image buttons for pagination - Drupal

The default pagination in drupal is great, but the text links are used
<<first <previous 6 7 next> last>>
But I need to use forward and backward image buttons instead of text links. Can anyone point me in the right direction?
Depending on what portions of the pager you're interested in replacing with images, you may be able to use CSS background images, without having to override the theme function. However, in the default pager output, not all the links may have unique classes.
That said, if you're using Drupal's default pager, you can override the theme_pager function to add your image links.
If you're using the Views module, you may be using a different theming function. When in doubt, you should be able to use the Theme Developer module to find which function or template file is outputting the part of the page you're interested in theming. Theme Developer will also tell you what suggestions you can use to override the output.

Resources