when I add a Web Content Display to my Page the Portlet is titled "Web Content Display".
So how to tell Liferay that it should use the title of the displayed Web Content.
One idea I can think of is to hide the title "Web-content Display" through Look and Feel of the portlet and then create a web-content using Structures & Templates.
And in the Template you can specify the title to be display at the top of the web-content and you can use some css-magic to position it where the portlet-title used to appear. It should not be difficult I think.
<!-- position this div with the help of CSS to give the feel of the title -->
<div class="temp-title">$contentTitle</div>
<div class="content">$myContent</div>
Related
I am working on this website, and as you can see I have a different header for different pages. In the other pages the header, the navigation, and the logo are fixed on top during scroll but not in this page.
Is possible to fix them in this page as well via JS?
You have to set the class of your dslc-header element to dslc-header-pos-fixed
<div id="dslc-header" class="dslc-header-pos-relative">
to
<div id="dslc-header" class="dslc-header-pos-fixed">
I'm beginner with Tapestry. I have a component called Navigation, where I dynamically get the pageName of my web pages, and display the link in header of a website. Here's the relevant part:
<t:loop source="pages" value="row">
<li><t:pagelink t:page="${page}">${pageName}</t:pagelink></li>
</t:loop>
That works ok.
I have page About_us.tml, and About_us.java. That page contains only text, so it's simple. My problem is, that my Navigation component displays this page in header (where are links to all of the pages of my web app) as About_us link. I want to change this to About us link. I don't want the "_" sign.
Any idea how could I possibly solve this?
Thanks.
It's very easy to pass the pageName through a bit of Java code to prepare it to be presented.
public String prepare(String pageName) { return pageName.replace("_", " "); }
and
<t:pagelink ...>${prepare(pageName)}</t:pagelink>
My main goal: When i click the link, a new browser window should be opened and displays the content of entire log file. And the window should not have an address bar and navigation buttons (Back, Forward).
Is there any approach to do this in Spring-MVC project?
Here is what i am doing now:
When i click the link, the controller will be called with a parameter logName.
Now the controller have access to get any kind of details of the log file like content, path, etc... I am setting all these details to an object and sending back to JSP.
Here i am not sure how to open a new window and display the content of the log file in that window.
Please suggest me an approach on this!!
It would be very helpful for me if you can share me with some examples...
Spring or JSP have nothing to do with it, the only way to force user's browser to open a link in a new tab is to use client-side Javascript. window.open() allows configuring the popup to hide certain interface elements (see all options in the documentation)
Your code would look something like:
<input type="button" value="Show Log" onclick="showLog(logName)">
function showLog(logName) {
var url = "/path-to-your-controller.html?logName=" + logName;
window.open(url, "LogPage", "toolbar=no,location=no,menubar=no");
}
However, I don't think using a customised browser popup is a good solution; it's been disappearing from the web for a reason. It would be more elegant to fetch raw data using AJAX and display it in a JS popup: it wouldn't interfere with user's page navigation (you tagged the question with jQuery, you could use jQuery UI for that).
What is more, I wouldn't be surprised if window.open wasn't supported by all browsers in the same way† - something to keep in mind if you're targeting a wider audience.
† seems that Chrome ignores location=no, for instance
I have created a theme in liferay 6.1. Now my question is how do I change the title of the theme pages.
For ex: About us page has title "Aboutus -liferay", I want to change it to "Aboutus".
I have tried using javascript for this like:
document.title="aboutus";
But until the page loads it shows the default title(Aboutus-liferay) and then after page load this "aboutus" title appears.
I want the custom title.
Any help is highly appreciated.
I just added:
**<head>
<title>$the_title</title>
</head>**
in my portal_normal.vm file and this solved my problem. Now whatever title i add in my html title of the pages in Manage Pages --> pages gets displayed in the title.
Edit the title inside portal_normal.vm of your theme.
In portal_normal.vm, which is a velocity file, add your title to the following code snippet :
<head>
<title>your_title</title>
</head>
EDIT
If you are talking about JSP pages, you can use:
com.liferay.portal.util.PortalUtil.setPageTitle(String, title, HttpServletRequest request);
in the respective page body.
In my webpage (Eg Link1: http://localhost:8086/MyStrutsApp/login.do) I have several links. When a user clicks on one of the links, he is taken to another page (Eg link2: http://localhost:8086/MyStrutsApp/AddBook.jsp) to fill an html form.
Now what I want to achieve is that when any user clicks on the link, that html form (Link2) is displayed on the same page (i.e. Link1).
I have no idea how to achieve this.
The AJAX way to achieve this is the following:
you have a DIV on your original page that will be replaced (i.e., either has content that only makes sense in the original context or completely empty)
your Link2 servlet produces only the contents of the above DIV (and not the contents of that page)
you use a tiny bit of Javascript to make an AJAX call and fill the DIV with the response.
If you want to use Dojo, the HTML page would look like this:
<!-- main content -->
<div id="leftpanel">
<h3>This content will be replaced</h3>
You can add a book
</div>
The Javascript code would look like this:
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" type="text/javascript"></script>
<script type="text/javascript">
function display_wait(s) {
var mainPanel=dojo.byId("leftpanel");
mainPanel.innerHTML='<div class="waitingmsg">'+s+'</div>';
}
function updateFromURL(url) {
display_wait("loading content");
dojo.xhrGet({url:url,
load:function(result) {
dojo.byId('leftpanel').innerHTML=result;
}});
}
</script>
(As Rafa mentioned, you can use the same technique to display the new part in a dialog)
You can always use jQuery to present a dialog ... http://jqueryui.com/demos/dialog/
Retrieve the page with AJAX and present it inside the dialog.
To display one page within another, use an iframe. See the iframe docs.
To make a link on the outer page load its target page into the iframe, give the iframe a name attribute, and give the link a matching target attribute.