Liferay widget template, freemarker. How to get product specifications? - liferay

I'm creating a Widget Template (Search Results Template). I'm working with CPCatalogEntry class and I'm wondering how I can get the list of specifications of a product.

Related

Creating templates for specific locations in Orchard themes

Working on a custom theme for Orchard 1.6. I've got my top navigation & recent blogs rendering exactly how I want it. However I want to create a footer that shows the navigation & recent blog posts in a different way. I'm using four zones across the footer and want to add widgets to them (navigation, recent blog posts), however I want the rendering to be different.
I can't figure out how to create a view that is used for these widgets JUST within these zones. The template override options shown in the Shape Tracing tool aren't specific to the zone I'm in so they'd apply to the ones in the body of the site (which I've already implemented).
Is what I'm trying to do even possible w/o some custom code (not just a view but some type of a new component) which I'm trying to avoid?
If you enable Widget Alternates, you'll get additional alternates that you can use, in particular depending on the zone name.

Find ID or Class of Sharepoint Document Library

I have a Mega Menu navigation that generates its content from custom lists. Each 'Tab' on the Mega Menu links to a different document library. I want to highlight the tab of the currently selected document library.
Each 'tab' already has a class attribute but I am having trouble giving the document library an ID or Class attribute, or finding one that is already there.
I have added a content editor web part in one of the document libraries, which is a blank html text file that has a body ID. When I reference it in the CSS I am able to achieve the highlighting of the tab when on that document library. However this only applies to the certain view that I am in. When changed to another view on the same document library (I have about 15-20 views) the highlighting disappears because there is no content editor web part in that view.
So to sum up - how can I use a universal ID or Class attribute that will not change each time a view is changed in a document library?
Thanks.
I ended up just using jQuery for this. Put it in my master page in a script tag.
if ( document.location.href.indexOf('<string in URL - I used the name of the document library') > -1 ) {
$('UL#topnav A.SecondTab').css('background-image', 'url(highlightedtab.jpg)');
}
Used several if statements because each tab has a different class name, e.g. FirstTab, SecondTab etc.

Global sidebar with widget support

I would like to make a layout with a sidebar that can have widgets from different modules. Lets say there shall always be a login widget at the top if the user isn't logged in then it shall show user info. The getting started album guide could use it to display the latest albums and so on, i hope you understand how i want to use the sidebar.
Could it be done with a config file in autoload and a small code that read that config and calls the widgets on every page load?
There are several ways of page composition in Zend Framework 2:
1. Switching between Layouts
By default, ZF2 provides you with a single layout template layout.phtml.
In real-life applications, you will probably need to have several layouts
and switch the layout for certain controller/action. In each of your layouts, you will be able to show different widgets/sidebars.
2. Partial Views
A partial view is a .phtml view template file which can be rendered by another
view template. Partial views allow to compose your page of pieces and reuse pieces
of view rendering logic across different view templates. This is accomplished through the Partial view helper.
3. Placeholder View Helper
The Placeholder is another useful view helper allowing for capturing HTML
content and storing it for later use. Thus, analogous to the Partial
view helper, it allows to compose your page of several pieces.
4. Forward Controller Plugin
With the Forward controller plugin, you are able to call an action (for example, the action rendering some widget) from another module/controller from your controller and grab the output of that action. Then you are able to incorporate that output into your page.
5. Use View Models for Page Composition
When you write action methods for the controller classes, you use the ViewModel
class as a variable container for passing the variables from controller to view template,
and for overriding the default view template name. But, actually the ViewModel class is more than just a variable container plus view template name. In fact, it is closely related to the layout and page composition.
The third big capability of the view model class is that it allows for combining several
view models in a tree-like structure. Each view model in the tree has the associated
view template name and data variables that can be passed to the view template to control
the process of rendering.
This feature is internally used by Zend Framework 2 when "combining" the layout view template and the view template associated with the controller's action method. ZF2 internally creates the view model for the layout template and assigns it with layout/layout view template name. When your controller's action method returns the ViewModel object, this object is attached as a child to the layout view model.
So, you can attach your own view models to the default view model to render the page of pieces that you want.

How can I present a library as a custom view?

I have a Sharepoint library that is currently rendering as the usual folder and document items table list view.
I would like to use present the same information as a grid of folder and document icons with some nice jQuery hover animations to show tooltips on the item the icon represents.
I suppose what I am really trying to find out is how to add a new library view that allows me to specify the markup rendered per item. I could write a new webpart to query the list and use an ASP:Repeater but I don't want to have to specify a webpart property each page to tell the webpart where it should open the list from.
You can use List View Web Part with custom XSLT.

Is there documentation for the #Model type in Orchard?

I'm customizing my father-in-law's Orchard site and trying to create a .cshtml file to control the display of a Containable content type, but I'm having a bugger of a time finding the data in the #Model field. Is there any documentation on it anywhere?
So far I've found #Model.Slug and #Model.Title. What I'd really like is access to the custom fields on the Content Type.
The Model object is of a dynamic type so it's properties are dynamically added depending on what modules are being used.
If you are using the new 1.1.30 version of Orchard you can use the new Shape Tracing tool which is part of the Deisgner Tools module which can be installed through the modules gallery. This will add a panel to the bottom of your website page that will allow you to see and navigate through the Model object.

Resources