Recent Bloggers

Olaf Kock

Staff
90 Publications
18 décembre 2014

David Kubitza

2 Publications
14 décembre 2014

Meera Prince

19 Publications
4 décembre 2014

James Falkner

Staff
100 Publications
2 décembre 2014

Juan Fernández

Staff
17 Publications
28 novembre 2014

Andrea Di Giorgi

2 Publications
26 novembre 2014

Gregory Amerson

Staff
26 Publications
25 novembre 2014

Cody Hoag

Staff
6 Publications
25 novembre 2014

Duke H

Staff
2 Publications
24 novembre 2014

Nicholas Gaskill

Staff
1 Publications
21 novembre 2014

Use Custom URL Variables to Display certain Paginated Web Content

Technical Blogs 24 juillet 2014 Par Bradley Wood

Ever wanted to explicitly define what page to display on the current pagination content from a url password?

This code should aim you in the right direction. Logic: -Get url variable ("page") value.
-set $total to the size of the pagination repeatable structure.
-If $pageId is set and is less than or equal to $total then use $pageId; else use the latest item.

#set ($friendlyURL = $request.get('attributes').get('CURRENT_COMPLETE_URL'))
#set ($pageId = $httpUtil.getParameter($friendlyURL, 'page"))

#set ($total = $image.siblings.size())

#if($pageId != "" && $getterUtil.getInteger($pageId) <= $total)
     #set($targetPage = $pageId)
#else
     #set($targetPage = $total)
#end

#foreach($image in $image.siblings)
     <img src="${image.data}" />
#end

Pagination JS that can be included in the velocity file
- define page: to be $targetPage

<script type="text/javascript">

AUI().ready('aui-paginator', function(A) {

	var pgA = new A.Paginator({
		page: ${targetPage},
		containers: '.paginatorA',
		total: 10,
		maxPageLinks: 10,
		rowsPerPage: 1,
		circular: true,
		rowsPerPageOptions: [ 1, 3, 5, 7 ],
		on: {
			changeRequest: function(event) {
				var instance = this;
				var newState = event.state;
				var page = newState.page;
				// newState.total = 100;

				if (newState.before) {
					var lastPage = newState.before.page;

					A.one('.contentA .page' + lastPage).setStyle('display', 'none');
				}

				A.one('.contentA .page' + page).setStyle('display', 'block');

				// IMPORTANT!
				// we need to .setState(newState) or .set(STATE, newState)
				// to update the UI
				instance.setState(newState);
			}
		}
	})
	.render();

});

</script>


*note: Have the Pagination JS code in the same template velocity file as the web content.

Embedding Navigation Portlet into Layout using Custom Settings

General Blogs 24 juillet 2014 Par Bradley Wood

Special thanks to atul patel's forum post displays how to embed a navigation portlet into a layout using custom settings.
With Custom Settings Basic display styles: There are 6 different basic views (source wiki):

  1. looks like breadcrumbs; shows parent page and current page but not siblings
  2. current page only?
  3. shows parent page and all subpages (siblings). The current page is bold. This seems to be the most valuable normal setting.
  4. shows subpages (siblings), no parent
  5. ? looks like 4
  6. Is a full community/org nav. Shows all pages in tier
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$velocityPortletPreferences.setValue("root-layout-type", "absolute")
$velocityPortletPreferences.setValue("bullet-style", "main")
$velocityPortletPreferences.setValue("header-type", "none")
$velocityPortletPreferences.setValue("root-layout-level", "0")
$velocityPortletPreferences.setValue("included-layouts", "all")
$velocityPortletPreferences.setValue("display-style", "")
$theme.runtime("71_INSTANCE_MAIN", "", $velocityPortletPreferences.toString())
$velocityPortletPreferences.reset()

 

Add Responsive Layouts to Liferay 6.1

General Blogs 6 juin 2014 Par Bradley Wood

One issue has come up time and time again with 6.1, There isn't a built in responsive grid system for Liferay 6.1. Version 6.2 uses twitter bootsrap. Here are 10 pure css layouts that overwrite the default layouts that are provided in Liferay. When the screen is resized all of the columns stack. This is a simple solution to instantly get a responsive website for liferay 6.1.

PURE CSS RESPONSIVE LAYOUTS in Marketplace

 

Overwrite Liferay Logo in Theme

General Blogs 9 mai 2014 Par Bradley Wood

In every theme that I write I always put this snippet of code in my theme's init_custom.vm file.

## ---------- Logo ---------- ##
#if (($company.getLogoId() == 0) && $use_company_logo)
     #set ($site_logo = "${images_folder}/custom/logo.png")
     #set ($site_logo_height = 69) #set ($site_logo_width = 403)
#end 

Gist Link

What this snippet will do is display the site logo if one has been set, If a company logo has been set it will use that, if there isn't a company or site logo, then it uses the logo.jpg in the theme and displays it instead of the default liferay logo.

 

Please leave a comment below if this was helpful, thanks.

 

Bradley Wood
Woodbench Media
80W. Sierra Madre Blvd, #109
Sierra Madre, CA 91024

www.woodbenchmedia.com

How to enable PACL for marketplace apps.

General Blogs 9 mai 2014 Par Bradley Wood

Here is a quick refereance for the PACL how to documentation. It was a little hidden, so here is the link for setting it up for 6.1.2 GA3

 

https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/lp-6-1-dgen11-developing-plugins-with-security-in-mind-0

 

Bradley Wood
Woodbench Media
www.woodbenchmedia.com

Affichage de 5 résultat(s).