Liferay 7.4: How to create a configurable web content article footer? - liferay

I need to create a footer in a Liferay-project, that can be modified from the instance. I've been trying various things in my footer-code and instance, but haven't figured out how to do it.
Any content inside the footer can't be touched and in page edit mode, Liferay says "This area is defined by the theme. You can change the theme settings by clicking more in the Page Design Options panel on the sidebar". I didn't get any help from Page Design Options either. Is there a way to do this?

I found the answer after hours of work and searching and want to share it with everyone here. The working solution was found here, in one of the comments.
You need to write some code (I use Freemarker/ftl) and then configure the site pages a bit, but here's how it works:
Put a new setting inside liferay-look-and-feel.xml:
<settings>
<setting key="footer-article-id" value="" configurable="true" type="text"/>
</settings>
This will create a new configurable option in page options, allowing you to input the ID of the web content.
NOTE: <theme> might get underlined red "The content of element type "theme" must match". This still prints everything correctly, but the tags are given in a wrong order. Inside my <theme>, I have <template-extension>, <settings> and <portlet-decorator> in that order, which removes the error.
Assign a variable in init_custom.ftl (cleans up the footer-code):
<#assign footer_article_id = getterUtil.getString(themeDisplay.getThemeSetting("footer-article-id"))/>
And then add this to the footer-code, to create the spot, where the content is visible:
<#liferay_journal["journal-article"]
articleId=footer_article_id
groupId=page_group.groupId
/>
After this, everything should be ready code-wise.
Create a Web Content for your footer. In the creation screen, there's an ID on the panel on the right. Publish your content and grab the ID.
Finally, go to Site Builder --> Pages and click on configuration from the top bar (behind three dots). You should see the input field like in the first picture: That's where you add the ID.
Save the settings and your web content should now be in the footer.
Hope this helps!

Related

How to customize blog portlet in liferay

I am new to liferay and using liferay-ce-portal-7.0-ga3 i have placed a blog and able to write contents in it. i want to change the blog portlet design by adding thumbnail preview to it . My current view is it has either title,abstract and full content view. How could i customize to get blog view
You can customize Liferay's appearance through Application Display Templates (ADT). Unfortunately there's no sample for the OOTB appearances, but when you go to your site's (or the global site's) Configuration area, you can find/edit/create ADTs there. Depending on the markup and CSS, as well as your typical image size etc., the actual ADT you write would be different, thus impossible to include anything here.
The editor however, has some autocomplete and some predefined entries/fields, that should give you a starting point. E.g. when you just open a blank editor and hit the "Blog Entries" field, you'll end up with
<#-- Application display templates can be used to modify
the look of a specific application. Please use the
left panel to quickly add commonly used variables.
Autocomplete is also available and can be invoked
by typing "${". -->
<#if entries?has_content>
<#list entries as curBlogEntry>
${curBlogEntry.title}
</#list>
</#if>
You'll find what you can do with BlogsEntry in it's javadoc, make sure to follow the BlogsEntryModel superclass link as well to see more.
I'll have to leave the exercise to generate proper markup and styling to you though.

A bit confused with creating custom content parts and placement

I'm trying to create a Custom Part that just drops text into the page. I've created a part using the GUI that I called "Side Feature" and I added a text field called "Featured". I am trying put it on the side bar which I created on my layout, but I don't know how to move it to the sidebar. It shows up on my main content.
How do I move it to the sidebar? I tried using "#Display(Model.Featured)", but that doesn't seem to work. I also read about the placement.info file, but I'm not too sure how that would work in this sense.
I couldn't find a tutorial/blog post online similar to this. Most of them were too advanced. I am very new to Orchard.
You can't without code or additional module: sidebar is a zone for widgets, not for content parts. Placement info only works for local zones within the global Content zone.
If you want to do it through code, follow this: http://weblogs.asp.net/bleroy/archive/2011/03/26/dispatching-orchard-shapes-to-arbitrary-zones.aspx
If you want to use a module, look for Origami on the gallery.

Solpart menu is ripping my soul apart!!! Not opening up in DNN

Please, someone tell me if there is a replacement for the rubbish Solpart menu, the menu with the small arrow to administer a module in DotNetNuke?
I have been using DNN for some time now and I would love to know if there is not a better way to get this menu working. I cannot believe DNN would let something as buggy as that out!
Thanks
You can use any menu for that drop down. You'd just swap out the solpartmenu for the one you want in the container you create. Here is a blog post outlining some of the menu options available. I'd suggest taking a look into each one of these and see which would be a good fit for you.
New Navigation Options in DotNetNuke 5.x Designers Should Know
Below is one (slightly updated) example from How to use RadMenu instead of the default solpartactions menu
Open an existing container for edit (a Default DNN container will work fine).
Register the RADMENUACTIONS tag by adding the following line of code: <%# Register TagPrefix="dnn" TagName="RADMENUACTIONS" Src="~/DesktopModules/RadMenu/RadMenuActions.ascx" %>
Replace <dnn:ACTIONS ... /> with <dnn:RADMENUACTIONS ... />
Set additional properties for RadMenu if desired. For example you can set the Skin property: <dnn:RADMENUACTIONS runat="server" id="dnnRADMENUACTIONS" Skin="CssGreen" />

Create a Sharepoint page but don't show in breadcrumb

I'm struggling to do something which I thought should be straight forward, basically I need to create an aspx page which I now realise must be put into a document library but the problem I have is it's only one page and when the page is displayed the breadcrumb has a link to the document library.
We really don't want the users to be able to get to the library via the breadcrumb and just want to show the page. From one of my other questions some other helpful people made some suggestions like putting the file in the _layout directory but this won't work because the new page has a master page associated with it.
Any ideas how I can display the custom page but not allow normal users to navigate to the document list?
Thanks!
Dan
Having a master page associated with an ASPX page does not prevent it from being placed in the _layouts directory. All of my ASPX pages use a custom master page I wrote, and they're all stored in the _layouts directory. But there's enough methods to hide the breadcrumbs without changing the storage location.
If you want to hide the breadcrumbs on only a specific page, the simplest method to do so is to prevent the contents of the breadcrumbs from being displayed. On the default master page (and I'm going assume that your master page also has this), there is a content called "PlaceHolderTitleBreadcrumb", which is what displays the breadcrumb. By overriding this in the ASPX file, you can prevent this from displaying. A simple way is to just insert the following line in your ASPX file:
<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"> </asp:Content>
By being in the page itself, it becomes a custom version of the breadcrumb instead of the master page's, so it won't evaluate itself and will leave you with a blank line. The will keep content inside the table cell, so it will specifically make a blank line occupy the same space that the breadcrumbs normally would. If you just put an empty content there, then it will instead render nothing there and pull all of your content upwards. Up to you if you think that looks better.
As far as where to place the line, I recommend just beneath the following lines, if your ASPX page has them. If you don't have the following lines, you might have to experiment a bit to find what position works properly.
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server">
<IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt="">
</asp:Content>

Faulty pages created by SiteDefinition

I'm creating some pages using a SiteDefinition, the markup looks something like this:
<File Url="Page.aspx" Name="$Resources:SiteDefinitions,PageName;" Type="GhostableInLibrary">
<Property Name="Title" Value="$Resources:SiteDefinitions,PageTitle;" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx"></Property>
<AllUsersWebPart WebPartZoneID="WebPartZone1" WebPartOrder="1">
-- webpart data here
</AllUsersWebPart>
</File>
The page is created as expected, but it's somewhat faulty. If for instance I click Edit Page and then click Publish (without actually editing anything) I will get this error:
"This Page has been modified since you opened it. You must open the page again."
I will get this error approx. every second time I try an editing action.
If I manually create a page using the same page layout everything works as expected and this error does not show up.
Does anybody have an idea what could be wrong?
I too create a Page using the above method only thing I found missing in your code is that I used to have a title in the PageLayout as
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx, Your title"></Property>
This should not be the cause, but you can try it, Also refer the articles this or this
I think you're right with using PublishingLayoutPage. I came across this article today while searching for this error caused by something else. It describes your same issue although the person in the article was not inheriting from PublishingLayoutPage and had not specified the PublishingPageLayout property. When they fixed this it worked.
This doesn't directly help you, although I did notice in their article that they are specifying the ContentType property. Have you tried specifying this? As you can see your complete code, are there any other differences you see from the article or additional information from the comments?
Okay, I (kinda) got this working now.
The guy who had made the ONET.xml had put a reference to the page layout in the Url attribute of the element.
Like I wrote in a comment earlier I tried making the page layouts inherit from TemplateRedirectionPage. Instead I now made an empty default.aspx file that inherits from TemplateRedirectionPage and changed all my page layout files back to deriving from the PublishingLayoutPage. And then I added the PublishingPageLayout element below every element.
Funny, or oddly, having a refence to the page layout in the Url attribute and not having the PublishingPageLayout element at all is actually valid. It doesn't make sense, because it will produce these faulty pages, but SharePoint actually accepts it and spits out all the pages defined in the ONET.xml
Only thing left now is that since I made the above changes, when I manually create a new page based on a page layout every default webpart (as defined with AllUsersWebPart) is instantiated 5 times. Really don't know where this behaviour is coming from, but at least it's not as serious as not being able to edit/publish my pages :)

Resources