- Posts: 222
- Thank you received: 10
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Toggle between templates based on language
- krosser
-
- Offline
- Elite Member
-
tpartner wrote: Copy nav_bar.twig to your extended theme directory (using the same file structure as that in vanilla). Then changes in that file will apply regardless of theme dependencies.
Do you mean I need to export both extended themes (Vanilla or Fruity and Bootswatch), then copy the header folder from Vanilla (which contains nav_bar.twig) (->views->subviews->header) into Bootswatch (into the same folder), and then import it back into the theme editor?
I'm using the latest LS 3.22 hosted on LS servers, not installed locally.
- tpartner
-
- Away
- LimeSurvey Community Team
-
- Posts: 10109
- Thank you received: 3595
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.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- tpartner
-
- Away
- LimeSurvey Community Team
-
- Posts: 10109
- Thank you received: 3595
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- Joffm
-
- Away
- LimeSurvey Community Team
-
- Posts: 12942
- Thank you received: 3979
of course it's a template engine, where we can use the twig statements.
Though there is an "if" statement three lines above
it didn't come to my mind to use it.{% if( aSurveyInfo.options.brandlogo == "on") %}
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
- krosser
-
- Offline
- Elite Member
-
- Posts: 222
- Thank you received: 10
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.
- krosser
-
- Offline
- Elite Member
-
- Posts: 222
- Thank you received: 10
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.
- tpartner
-
- Away
- LimeSurvey Community Team
-
- Posts: 10109
- Thank you received: 3595
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)Can this be done when you use LS in their cloud and not installed on your server?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- krosser
-
- Offline
- Elite Member
-
- Posts: 222
- Thank you received: 10
tpartner wrote:
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)Can this be done when you use LS in their cloud and not installed on your server?
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.
- holch
-
- Offline
- LimeSurvey Community Team
-
- Posts: 11660
- Thank you received: 2742
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
- tpartner
-
- Away
- LimeSurvey Community Team
-
- Posts: 10109
- Thank you received: 3595
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
- LouisGac
-
- Visitor
-
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:
<file type="view" role="subview">./subviews/navigation/clearall_links.twig</file>
- krosser
-
- Offline
- Elite Member
-
- Posts: 222
- Thank you received: 10
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.