Yii: how to set layout in main.php (config file)? - layout

I found this link
Theming and layout in yii framework
but it describes how to set custom layout in controller.
Is it possible to set custom layout within config file (main.php)?

Yes You can . Just Add the layout property to your application config
'layout'=>'your_layout_name'
Keep in mind that the above configuration is used only if the CController layout property is set to null.

Related

How to set List View as default view in Hybris PCM Backoffice

I am a bit new to the Hybris platform. I am working with the Backoffice PCM on Hybris 6.7.
I would like to change the default browser display when using the PCM Backoffice. Currently the default behavior renders Grid View but I would like to use List View instead. I will like to either remove entirely the grid view option (or disable it) and automatically open products in list view instead.
You have to customize the xml to obtain the desired behavior. The best approach is creating a new extension from template ybackoffice to consolidate your changes.
Basically, the original extension have these lines:
<context type="Product" component="pcmbackoffice-assortment-collection-browser" >
<cb:collection-browser xmlns:cb="http://www.hybris.com/cockpitng/config/collectionbrowser">
<cb:available-molds default-mold="grid-view">
<cb:mold spring-bean="listViewCollectionBrowserMoldStrategy"/>
<cb:mold spring-bean="gridViewCollectionBrowserMoldStrategy"/>
</cb:available-molds>
</cb:collection-browser>
</context>
Just copy and paste in your new extension in the file <myextension>-backoffice-config.xml and remove the line correspondent to the grid view (for removing the option), eg.:
<context type="Product" component="pcmbackoffice-assortment-collection-browser" >
<cb:collection-browser xmlns:cb="http://www.hybris.com/cockpitng/config/collectionbrowser">
<cb:available-molds default-mold="list-view">
<cb:mold spring-bean="listViewCollectionBrowserMoldStrategy"/>
</cb:available-molds>
</cb:collection-browser>
</context>
Do ant clean all, and after HAC update in your extension.
Ps.: You can apply these changes through orchestrator to see the result in live, before create the new extension.

Changing portal_normal.vm in Liferay

Right now I am using the default portal_normal.vm to display my page. I have made some changes to custom.css to give some look to the theme (JUst changed the colour of the background)
I have made some changes to the portal_normal.vm.
What if I want to give a complete different look to my page ? My answer is make changes to the portal_normal.vm page.
MY question is :
portal_normal.vm has some variables and stuff like:
<html class="$root_css_class" dir="#language ("lang.dir")" lang="$w3c_language_id">
I would like to know where does portal_normal.vm get these values from? By values I mean values of variables like $root_css_class ? Usually velocity gets these values from a java class. So in liferay theme, from where does portal_normal.vm get these values from? Is it ok to change the portal_normal.vm file completely?
Yes you can change any thing in portal_noraml.vm file and you design your own look.
Here to change portal_normal.vm we will use theme. in _diff/templates place classic theme portal_normal.vm and do changes.
All velocity variable are declared in init.vm file and we have another file called inti_custom.vm for declare our own velocity related variables.
Most of the velocity variables which required for portal already defined by liferay people we just use those.
Use init_custom.vm in _diff/templates folder for custom velocity varibles.
https://github.com/liferay/liferay-portal/blob/6.2.x/portal-web/docroot/html/themes/_unstyled/templates/init.vm
Most of the variables already loaded by velocity engine so max we dont need to create new variables in velocity engine.
You can create theme in liferay and provide customization in portal_normal.vm.
There is init.vm file where some of the variables are declared and also VelocityVariablesImpl.java is the class where vm variables are defined.

How to set a custom directory for layouts in Sinatra?

I have a Sinatra app with multiple layouts. I want to isolate them into their own subdirectory in views:
app.rb
views/
views/layouts/
views/layouts/default.haml
views/layouts/print.haml
views/layouts/mobile.haml
This works, except that I have to explicitly set a layout with each render call:
get '/' do
haml :index, {:layout => :'layouts/default'}
end
Is there a way to set the layout globally (for all routes within a module, for example), or to tell Sinatra where look for layouts outside of default directory?
Need to RTFM better... So there is no specific option for Sinatra itself, but you can set a default layout for each rendering engine, e.g. HAML:
configure do
set :haml, :layout => :'layouts/default'
end

OrchardCMS Shape tracing not showing up for custom theme

I'm creating a custom theme for my new Orchard site. The shape tracing module is incredibly useful, but for some reason it isn't rendering in my custom theme. I'm not sure what I might be missing to get it to appear.
When I set my site to use the theme TheThemeMachine, it appears just fine at the bottom of the page. When I compare the rendered source from the TheThemeMaching and my custom theme, I see all the CSS & JS references in the head for the shape tracing module. However when I scroll to the bottom of the source of my custom theme, I don't see all the script blogs with the JSON objects. I just see a lot of empty script "shape-tracing-wrapper" blocks.
Ideas?
You're missing a zone named Tail in your document.cshtml. Compare your theme's version with the one in Core/Shapes/Views.

Need to have separate "complete" Drupal theme for each page on a site

I want to build a Drupal demonstration site where I can create several custom themes and display each on a separate page of the site. Access can be either via links or menu items. The "simpler" the solution the better.
Create a custom block that executes PHP code. The following code snippet should show the current page in the theme set in $custom_theme.
global $custom_theme, $theme;
// If $theme is set, init_theme() will not initialize the custom theme.
unset($theme);
// Set the theme you want to use.
$custom_theme = "garland";
init_theme();
There is also a module that allows you to change the used theme based on some rules (in example, the content type being showed, the URL of the page being viewed, etc): the project page is http://drupal.org/project/themekey.

Resources