Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Toggle between templates based on language

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 1 day ago #167726 by Joffm
Replied by Joffm on topic Toggle between templates based on language
Thanks, tpartner,
of course it's a template engine, where we can use the twig statements.
Though there is an "if" statement three lines above

{% if( aSurveyInfo.options.brandlogo == "on") %}

it didn't come to my mind to use it.

To be honest, I use a different template engine in my programs.
So I am not familiar with twig.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
6 years 21 hours ago #167731 by krosser
Replied by krosser on topic Toggle between templates based on language

tpartner wrote: No, you should not be doing anything with the core vanilla or bootswatch theme directories. They will be over-written on updating.

I am responding from my phone and memory this week so I may make some mistakes on the file structure but...

My understanding is that you have extended (copied) bootswatch. This should create a directory:

/upload/themes/survey/yourThemeName/

Now the theme dependency/inheritance ladder is:

- vanilla
- bootswatch
- yourThemeName


So, if you copy nav_bar.twig into...

/upload/themes/survey/yourThemeName/views/subviews/header/

...it will automatically override any copy of that file in the parent themes (bootswatch and vanilla).

You may not be able to see that new file in the template editor but any changes made in a plain-text editor and uploaded via FTP will be applied.


Can this be done when you use LS in their cloud and not installed on your server?

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
More
6 years 20 hours ago #167732 by krosser
Replied by krosser on topic Toggle between templates based on language

tpartner wrote: You can use an IF() statement in the twig file so only one image (depending on language) is loaded. This will reduce server load and browser load-time. I'll give an example next week when I get back to the world.


That would be nice! I look forward to your code example.

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 18 hours ago #167740 by tpartner
Replied by tpartner on topic Toggle between templates based on language

Can this be done when you use LS in their cloud and not installed on your server?

I don't know. Contact support and ask there. As far as I am concerned all twig files that now replace the old .pstpl files should be available in the theme editor. (but maybe they are still working on that)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
5 years 11 months ago #167858 by krosser
Replied by krosser on topic Toggle between templates based on language

tpartner wrote:

Can this be done when you use LS in their cloud and not installed on your server?

I don't know. Contact support and ask there. As far as I am concerned all twig files that now replace the old .pstpl files should be available in the theme editor. (but maybe they are still working on that)


I have contacted them multiple times on different issues and they are always reluctant to provide extensive support or any feedback. Therefore, I have to seek help largely here on the forum.

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167876 by holch
Replied by holch on topic Toggle between templates based on language
well, they are providing hosting for Limesurvey. Extensive support to customization of Themes/Templates isn't part of the support scope, I guess.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 11 months ago #167880 by tpartner
Replied by tpartner on topic Toggle between templates based on language
Yes but my statement "all twig files that now replace the old .pstpl files should be available in the theme editor" still stands. In other words, if it was previously possible to edit an element in the GUI, it should still be possible.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 11 months ago #167910 by LouisGac
Replied by LouisGac on topic Toggle between templates based on language

tpartner wrote: Yes but my statement "all twig files that now replace the old .pstpl files should be available in the theme editor" still stands. In other words, if it was previously possible to edit an element in the GUI, it should still be possible.


yes we should add a new "screen" with all twig files.


For now, if you want to add a twig file in the ThemeEditor list:


1. Open the config.xml of your theme.
2. In the engine>template_editor section
3. Find the screen that interest you. For exemple, for the welcome page:
github.com/LimeSurvey/LimeSurvey/blob/b3...config.xml#L119-L137

4. Here, just add the twig files you want. For example:
Code:
<file type="view" role="subview">./subviews/navigation/clearall_links.twig</file>
The topic has been locked.
More
5 years 11 months ago - 5 years 11 months ago #167911 by krosser
Replied by krosser on topic Toggle between templates based on language

LouisGac wrote:

tpartner wrote: Yes but my statement "all twig files that now replace the old .pstpl files should be available in the theme editor" still stands. In other words, if it was previously possible to edit an element in the GUI, it should still be possible.


yes we should add a new "screen" with all twig files.


For now, if you want to add a twig file in the ThemeEditor list:


1. Open the config.xml of your theme.
2. In the engine>template_editor section
3. Find the screen that interest you. For exemple, for the welcome page:
github.com/LimeSurvey/LimeSurvey/blob/b3...config.xml#L119-L137

4. Here, just add the twig files you want. For example:
Code:
<file type="view" role="subview">./subviews/navigation/clearall_links.twig</file>


So do you have to export, modify and import the theme back to make it work?
I tried to manually add nav_bar.twig to the exported theme and import it back and it didn't work for me. I changed the name of the archive and in the config.xml too. The theme then doesn't appear in the list and aftwerwards doesn't allow to import again saying that it's already there.

In general, why don't we have nav_bar.twig in the list in Bootswatch by default if it's there but not visible?

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
Last edit: 5 years 11 months ago by krosser.
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 11 months ago - 5 years 11 months ago #167954 by LouisGac
Replied by LouisGac on topic Toggle between templates based on language
krosser: if you're a limeSurvey Pro user I can do it live for you
Last edit: 5 years 11 months ago by LouisGac.
The topic has been locked.
More
5 years 11 months ago #167957 by krosser
Replied by krosser on topic Toggle between templates based on language

LouisGac wrote: krosser: if you're a limeSurvey Pro user I can do it live for you


To do what, Louis? - Make nav_bar.twig visible in Bootswatch theme?

Do I have to open a new ticket in order to request it in the Pro account?

I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 11 months ago #167958 by LouisGac
Replied by LouisGac on topic Toggle between templates based on language
yep, would be perfect. I can do it today.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose