Tribune

Home » Liferay Portal » English » 2. Using Liferay » General

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Andrew O
Site Template Questions
1 febbraio 2012 9.16
Risposta

Andrew O

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 27 gennaio 2012

Messaggi recenti

I am using a site template with LR 6.1 and had two questions about it. The first, if I have several sites using the template, and then I make changes to the template itself, is it possible to have those changes perpetuated to all the sites that use the template. I saw in the documentation that when a site uses a site template, it simply copies the template and does not create a link with it. However, I did notice that there was a bug filed for this issue and I was wondering if anyone knew any more information about it.

The second question is in regards to using hyperlinks within the Web Content Display portlets of a site template. I have some anchors with links inside the site template, for example moving between specific site pages of the template. But when I use the template in creating a new site, none of the links work because the url is different for the new site (localhost/group/template/page1 changes to localhost/web/company/page1). How would I remedy this issue, without going to each page and manually changing the link for each new site? Should I not be embedding anchors inside my Web Content Displays?
Nate Cavanaugh
RE: Site Template Questions
2 febbraio 2012 9.33
Risposta

Nate Cavanaugh

LIFERAY STAFF

Punteggio: Junior Member

Messaggi: 67

Data di Iscrizione: 27 novembre 2006

Messaggi recenti

Hi Andrew,
About your first question, you should see a checkbox when creating a new site from a template:


If you keep that box checked, it will update your sites when you edit the Site Template (I tested this locally, and it is working for me).

About your second question, I'm not sure off the top of my head if there's an API to allow linking from within the site template, but I'll take a look and see what I can find out.

Thanks Andrew,
Nate Cavanaugh
RE: Site Template Questions
2 febbraio 2012 10.43
Risposta

Nate Cavanaugh

LIFERAY STAFF

Punteggio: Junior Member

Messaggi: 67

Data di Iscrizione: 27 novembre 2006

Messaggi recenti

Hi Andrew,
Actually, I did a bit more testing and asking around, but basically, that checkbox I pointed to does not apply to content, but to the portlet itself.

I'm not 100% sure if there's a way to do exactly what you're looking for, but I'll try to see if there's a workable solution.

Thanks,
Andrew O
RE: Site Template Questions
3 febbraio 2012 7.33
Risposta

Andrew O

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 27 gennaio 2012

Messaggi recenti

Hi Nate,

Thanks for your responses! I appreciate you looking into this issue. For the time being, I'm just doing manual changes of links and content as needed, since there are only 2 sites that I am using the template for. However, I am hoping to expand up to 20+ in the next couple months as well as add more contents to the portlets themselves.

Thanks!
Andrew O
RE: Site Template Questions
20 febbraio 2012 11.25
Risposta

Andrew O

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 27 gennaio 2012

Messaggi recenti

So any new updates or workarounds in regards to this issue?
Sandrine Dullier
RE: Site Template Questions
25 gennaio 2013 2.15
Risposta

Sandrine Dullier

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 30 marzo 2012

Messaggi recenti

Hi everyone,

I have the same problem for internal links in web content of a site template.

Has someone already find a turnaround ?

thanks !
Andrew O
RE: Site Template Questions
25 gennaio 2013 10.41
Risposta

Andrew O

Punteggio: New Member

Messaggi: 9

Data di Iscrizione: 27 gennaio 2012

Messaggi recenti

Hi Sandrine,

I used the following workaround for the links within pages. I did away with the web content portlets and instead created my own custom portlets. This is a relatively easy task and within the view.jsp of the portlet, you can actually have plain html code. I then used the settings of the portlet to create a "site" variable that I could dynamically change for each instance of the portlet. I then used that variable in constructing the hyperlink. So for example, I had a footer across all sites that had a "About" link, but the link would be different depending on what site I was on. So in the view.jsp, I had the following:

 1
 2<%@ page import="javax.portlet.PortletPreferences" %>
 3
 4     <portlet:defineObjects />
 5
 6     <%
 7          PortletPreferences preferences = renderRequest.getPreferences();
 8          String siteName = preferences.getValue("siteName", "");
 9          String siteUrl = (siteName.equals("")) ? siteName : "/" + siteName;
10     %>
11
12     <a style="color: #ffffff;" href="<%=siteUrl + "/about_us"%>">
13          About Us
14     </a>


This way, I could simply go into the Options->Configurations of each instance of the portlet when it is deployed and change the needed variable to my site name, without actually touching my code.

Just FYI, in order to implement custom configurations, you need to change the liferay-portlet.xml of the portlet to include the property configuration-action-class, as well include some custom files such as a Configuration.java and a configuration.jsp, but you can find how to do that in other parts of the forum.
Sandrine Dullier
RE: Site Template Questions
28 gennaio 2013 4.19
Risposta

Sandrine Dullier

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 30 marzo 2012

Messaggi recenti

Thanks Andrew !