Welcome to the LimeSurvey Community Forum

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

Best way to enable optional additional Logo for each Survey

  • lucasdidthis
  • lucasdidthis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago #193682 by lucasdidthis
Hejhej!

I'm pretty new to LimeSurvey, so excuse me if this is a dump question, but my client wants the option to add a different (or even multiple) different Logo(s) for different Surveys (without altering the theme or changing the main logo).

Is there a way I can provide that option? At least a single, changing logo should be possible, shouldn't it? What code do I need to add to the nav_bar.twig? How does the client add the logo within the survey?

I hope the the question wasn't answered before, but I wasn't able to find anything really helpful with the search.

Thanks in advance, all the best
Lucas
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago - 4 years 2 months ago #193692 by tpartner
In nav_bar.twig, you can add something like this to the logo option block.

It will insert an image - logo.png - found in the survey resources image folder.

Your client can upload the survey-specific images via the Resources tab in the survey menu.

Code:
{# Logo option #}
<div class="{{ aSurveyInfo.class.navbarbrand }} logo-container"  {{ aSurveyInfo.attr.navbarbrand }}  >
  <img src="upload/surveys/{{ aSurveyInfo.sid }}/images/logo.png" alt="{{ aSurveyInfo.name }}" class="logo img-responsive" />
</div>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 2 months ago by tpartner.
The following user(s) said Thank You: cdorin, lucasdidthis
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #193708 by DenisChenu
In my opinion : best way is to add multiple logo system inside theme system.

In skelvanilla, i have 3 logo, then one can be the global one, and anoptherone the survey one :)

This need more work
but since it's a client : you can make a quote.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
4 years 2 months ago #193712 by jelo

DenisChenu wrote: This need more work
but since it's a client : you can make a quote.


I suspect the work you have to invest into answering RFQ and handling is more expensive than the willingness to pay.

This is a typical example for a LimeStore offer or Themebundle.
50-100 EUR per year for an constantly updated theme, which is actually working without consulting the forum for one fix here and another workaround here. Just working is the key. If LS3/LS4 is constantly breaking parts, it will turn into a support nightmare.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • lucasdidthis
  • lucasdidthis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago - 4 years 2 months ago #193716 by lucasdidthis
Thank you very much @tpartner, works like a charm. Additional Question, though: Is there a way to check if a file exists (within the .twig file) in order to just display the logo if the file actually exists?

Can't get the PHP function file_exists to work and .twig does not seem to know a similar function. :-(

Thanks again for the help!
Last edit: 4 years 2 months ago by lucasdidthis.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #193729 by Joffm
Hi,
if it doesn't exist it cannot be displayed.
In that case the alt-value is used.
In Tony's example the name of the survey is displayed.

If you don't want that, use: alt=" " or enter the path toan existing (default) image.
Only alt="" will show the "image not found" symbol.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #193730 by tpartner
What LimeSurvey version are you using?

In 4.x, you can create custom twig functions incorporating PHP.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #193733 by DenisChenu

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #193734 by DenisChenu

jelo wrote: I suspect the work you have to invest into answering RFQ and handling is more expensive than the willingness to pay.

Yes, maybe and ?

Else : skelvanilla is free , and can be easily apdated :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • lucasdidthis
  • lucasdidthis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #194323 by lucasdidthis
Thanks again for your help everyone. A lot of great input, but I went with a super simple JavaScript solution (to match the very limited budget of the client).

See you next time, have a good one everyone! :)
The topic has been locked.
More
4 years 1 month ago #194332 by surveySn
Hi lucasdidthis

Could you share your solutions?

I have the same problem,Thank you,
The topic has been locked.
  • lucasdidthis
  • lucasdidthis's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago - 4 years 1 month ago #194412 by lucasdidthis
Sure. I just added
Code:
onerror="this.alt='missing image';"
to the image-tag with the second logo and use
Code:
img[alt='missing image']{
display:none;
}
in the css stylesheet to hide the empty element.
It's not the cleanest solution, but it works and was super fast and easy to implement.
Last edit: 4 years 1 month ago by lucasdidthis.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose