Liferay5.1.2主题研究(二)

更改liferay自带的名为liferay-jedi-theme的主题

 一 、更改/webapps/liferay-jedi-theme/templates/portal_normal.vm文件:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

#parse ($init)

#set ($company_url = $company_url + "/web/guest/home")

<html dir="#language ("lang.dir")" xmlns="http://www.w3.org/1999/xhtml">

<head>
 <title>$company_name - $the_title</title>

 $theme.include($top_head_include)

 #css ($css_main_file)
 #js ($js_main_file)
#*=======================hide  logo=============
 #if ($company_logo != "")
  <style type="text/css">
   #banner .logo {
    padding: 0;
   }

   #banner .logo a {
    background: url($images_folder/custom/logo.png) no-repeat;
    display: block;
    font-size: 0;
    height: 88px;
    text-indent: -9999em;
    width: 290px;
   }

   #ie6_png_fix ()
  </style>
 #end
-------------------------------*#
 #set ($groupLocalService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
#*下边这句话不要注掉,注掉就不能显示文字页角了*#
 #set ($guestGroup = $groupLocalService.getGroup($company_id, "Guest"))

 #set ($journalTemplateLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalTemplateLocalService"))

 #set ($journalTemplateId = $theme_settings.getProperty("css-template-id"))

 #if ($journalTemplateLocalService.hasTemplate($guestGroup.getGroupId(), $journalTemplateId))

  ## Instead of reference the URL, just insert the content to save an
  ## extra HTTP request.

  ## <link rel="stylesheet" type="text/css" href="$theme_display.getPathMain()/journal/get_template?groupId=$guestGroup.getGroupId()&templateId=$journalTemplateId" />-->

  #set ($journalTemplate = $journalTemplateLocalService.getTemplate($guestGroup.getGroupId(), $journalTemplateId))

  <style type="text/css">
   #set ($cssTemplate = $journalTemplate.getXsl())
   #set ($cssTemplate = $stringUtil.replace($cssTemplate, "@root_path@", $themeDisplay.getPathContext()))
   #set ($cssTemplate = $stringUtil.replace($cssTemplate, "@image_path@", $themeDisplay.getPathImage()))
   #set ($cssTemplate = $stringUtil.stripBetween($cssTemplate, "/*", "*/"))

   $cssTemplate
  </style>

 #end 

</head>

<body class="$css_class">

$theme.include($top_messages_include)

<div id="wrapper">
 <div id="banner">
#*===============hide company_name=========
  <h1 class="logo">
   <a class="png" href="$company_url">$company_name</a>
  </h1>
-------------------------------------*#
  #parse ("$full_templates_path/dock.vm")
#*==========hide search=================
  #if ($group_id == $guestGroup.getGroupId())
   <div class="search">
    $theme.journalContentSearch()
   </div>
  #end
--------------------------*#
  #if ($update_available_url)
   <div class="popup-alert-notice">
    <a class="update-available" href="$update_available_url">#language ("updates-are-available-for-liferay")</a>
   </div>
  #end

  #*<div id="top-menu">
   <a href="$company_url">www.Liferay.com</a>

   #if ($is_signed_in)
    | <a href="$themeDisplay.getPathFriendlyURLPublic()/$user.getScreenName()/profile">#language ("my-profile")</a>
   #end
  </div>*#
 </div>

 #if ($has_navigation)
  #parse ("$full_templates_path/navigation.vm")
 #end

 <div id="back-container">
  #if ($selectable)
   $theme.include($content_include)
  #else
   $portletDisplay.recycle()

   $portletDisplay.setTitle($the_title)

   $theme.wrapPortlet("portlet.vm", $content_include)
  #end
#**************页脚*#
  <div id="footer">
   #*<p class="copyright-notice"><h3>& copy;& reg; 2000-$the_year $company_name</h3></p>*#

   <div class="footer-award-images">
    #set ($journalArticleLocalService = $serviceLocator.findService("com.liferay.portlet.journal.service.JournalArticleLocalService"))

    #set ($journalArticleId = $theme_settings.getProperty("footer-article-id"))

    #if ($journalArticleLocalService.hasArticle($guestGroup.getGroupId(), $journalArticleId))
     $velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
     $velocityPortletPreferences.setValue("group-id", "$guestGroup.getGroupId()")
     $velocityPortletPreferences.setValue("article-id", $journalArticleId)

     $theme.runtime("56_INSTANCE_qltu", "", $velocityPortletPreferences.toString())

     $velocityPortletPreferences.reset()
    #end
   </div>

   #if ($has_navigation)
    #parse ("$full_templates_path/bottom_navigation.vm")
   #end
   
  </div>
 </div>
</div>

$theme.include($bottom_ext_include)
$theme.include($session_timeout_include)
$theme.include($sound_alerts_include)

</body>

</html>

 

二、心得体会:

页脚代码中有“56_INSTANCE_qltu”,代表的是当前社区的日志文章的portlet的id。要在页脚上放日志文章portlet,必须要把这个id写对,并且要修改liferay-look-and-feel.xml中的<setting key="footer-article-id" value="13807"></setting>。13807是对应的文章号。两个必须都写正确,页脚才能显示出文字。

另外,5.1.2版本的对应的这个文件比5.0.1多了一些设置,上边绿色的字就是多的。暂时不知道多的这些是做什么的,不过,其中第一句不能少,如果少了它,页脚的文章也还是加不进去。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值