Check out the LimeSurvey source code on GitHub!

How can I use a different logo for each survey, but without changing de template

More
2 years 8 months ago #109980 by helviobrito
Hi.

Please help me. I've alreedy looked into the forum and the mamual and didn't find a clear answer for may issue.

I use LM 2.05+ Build 140302 and a mdified version of Vallendar template. I need to change the logo for each survey, but I didn't figure out how to do this. Can anone help me?

Please Log in to join the conversation.

More
2 years 8 months ago #110000 by tpartner
In the template file, you can use the placeholder for the survey ID in the filename of the logo image.

So, something like:

<img src="path/to/images/logo-{SID}.png" />

.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: helviobrito

Please Log in to join the conversation.

More
2 years 8 months ago #110022 by helviobrito
Thanks for your attention, tpartner. But, please, I'd like to know which template file I'll use to put this line in: survey. pstpl or starpage.pstpl?

Please Log in to join the conversation.

More
2 years 8 months ago #110023 by tpartner
It depends on where your logo is - probably in startpage.pstpl.

What template are you using? Can you activate a sample survey?


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 years 8 months ago #110024 by tpartner
It depends on where your logo is - probably in startpage.pstpl.

What template are you using? Can you activate a sample survey?


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 years 8 months ago #110025 by helviobrito
I am using Vallendar, with a little modification only to change the color of warning texts from pink to red.

Here is a survey that you can see as an example: focuspesquisa.com.br/focusOnline/181521/lang-pt-BR .

See the logo focusOnline in the questions page? I'd like to change it only in this survey, for example, not affecting the others active ones.

Please Log in to join the conversation.

More
2 years 8 months ago #110027 by holch
Can't access the survey without a token and on the startpage there is no logo.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 8 months ago #110028 by holch
But Tpartners solution would affect all other surveys that depend on this template that you use.

But I think it is a very elegant solution, if you have many surveys and they all need a different logo. You just put the logo file into the respective folder with the Survey ID in the file name and the template will use this file.

However, this change will affect all previous surveys, because they don't have the correct name and one disadvantage is that you would have to create a logo file for each survey, even if the logo stays the same. So if you usually use always one logo and just for this survey you need to use another one, I think it is easier to copy the template and change the logo file.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 8 months ago #110029 by helviobrito
Sorry. Use the login Testing and the token 123456.

So, I think that the logo goes in the survey.pstpl. My generic logo url is there. So, supose I have an image named newlogo.png and I want it just in the survey with the ID 181521. Do I change the images's name to newlogo-181521.png?

Please Log in to join the conversation.

More
2 years 8 months ago #110030 by tpartner
Yeah, no access for me either.

I think it is easier to copy the template and change the logo file.

No, we can do it dynamically for a single with JavaScript but I would need to see a survey to give the script details.


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 years 8 months ago #110031 by tpartner
Still don't see a logo. That survey is using the default template with no logos.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 years 8 months ago #110032 by helviobrito
Yes, I agree. I didn't think of copy the template for each survey. But I had a doubt it the logo name with the survey ID solution wouldn't affect all previous surveys, as you said, hotch. Thanks.

Please Log in to join the conversation.

More
2 years 8 months ago #110033 by helviobrito
Plase, try again. Now the template is right.

Please Log in to join the conversation.

More
2 years 8 months ago #110051 by tpartner

But I had a doubt it the logo name with the survey ID solution wouldn't affect all previous surveys, as you said, hotch.

I made that suggestion before you said you had other surveys that you don't want affected.


If you want to insert a logo only for survey ID 181521, you can add this to the end of template.js. This will insert the defined image before your survey description.

$(document).ready(function(){
	// Image URL
	var imagePath = 'http://www.google.com/logos/2011/thai_elephant_day11-hp.jpg';
 
	// Insert the image
	if($('input#sid').val() == 181521) {
		$('td.survey-description').prepend('<img class="logo-image" src="'+imagePath+'" />');
	}
});


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
2 years 8 months ago #110065 by helviobrito
Thanks, tpartner. I'll try this solution and report the result to you.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form