Fórum

Site Template Questions

Andrew O, modificado 12 Anos atrás.

Site Template Questions

New Member Postagens: 9 Data de Entrada: 27/01/12 Postagens Recentes
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?
thumbnail
Nate Cavanaugh, modificado 12 Anos atrás.

RE: Site Template Questions

Junior Member Postagens: 94 Data de Entrada: 27/11/06 Postagens Recentes
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,
thumbnail
Nate Cavanaugh, modificado 12 Anos atrás.

RE: Site Template Questions

Junior Member Postagens: 94 Data de Entrada: 27/11/06 Postagens Recentes
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, modificado 12 Anos atrás.

RE: Site Template Questions

New Member Postagens: 9 Data de Entrada: 27/01/12 Postagens Recentes
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, modificado 12 Anos atrás.

RE: Site Template Questions

New Member Postagens: 9 Data de Entrada: 27/01/12 Postagens Recentes
So any new updates or workarounds in regards to this issue?
Sandrine Dullier, modificado 11 Anos atrás.

RE: Site Template Questions

New Member Postagens: 3 Data de Entrada: 30/03/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Site Template Questions

New Member Postagens: 9 Data de Entrada: 27/01/12 Postagens Recentes
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:


<%@ page import="javax.portlet.PortletPreferences" %>

     <portlet:defineobjects />

     &lt;%
          PortletPreferences preferences = renderRequest.getPreferences();
          String siteName = preferences.getValue("siteName", "");
          String siteUrl = (siteName.equals("")) ? siteName : "/" + siteName;
     %&gt;

     <a style="color: #ffffff;" href="<%=siteUrl + " about_us"%>"&gt;
          About Us
     </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, modificado 11 Anos atrás.

RE: Site Template Questions

New Member Postagens: 3 Data de Entrada: 30/03/12 Postagens Recentes
Thanks Andrew !