Welcome to the LimeSurvey Community Forum

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

How to get limesurvey base url? like http://example.com/limesurvey/

More
8 years 11 months ago - 8 years 11 months ago #141548 by vkuzmin
I'm use "/limesurvey/" in links but its not so good. For example, when i want to show a link to start survey again i'l type
Code:
<a href="/limesurvey/index.php/survey/index/sid/{SID}/newtest/Y/lang/en">Start again</a>
Is there any replacement for base url? To do something like {BASEURL}/index.php/survey/index/sid/{SID}/newest/Y/lang/en

Closest one i've found in replacements_helper.php is
Code:
href="{SURVEYRESOURCESURL}../../../../"
Last edit: 8 years 11 months ago by vkuzmin.
The topic has been locked.
More
7 years 9 months ago - 7 years 9 months ago #161399 by socius
Hi all,

@vkuzmin, did you finally find a solution to this, i.e. a placeholder that returns the base url?

I would like to use the base url in a survey question (not in the mails). I use LS Version 2.6.4.

I just searched the documentation ( www.limesurvey.org/manual/URL_fields , www.limesurvey.org/manual/Email_templates , ) and the forum and did not find a solution.

{SURVEYRESOURCESURL} gives back the correct URL for .../upload/surveys/241618
{TEMPLATEURL} gives back the correct URL to the template, but

neither entering
{SURVEYURL} nor
@@SURVEYURL@@

in the question text gave back the link, just errors







Did I overlook anything?

Thanks a lot for any hint!

Best,
G
Last edit: 7 years 9 months ago by socius.
The topic has been locked.
More
7 years 9 months ago - 7 years 9 months ago #161434 by tpartner
You can try something like this (but I'm not sure whether it will return the absolute or relative path):

Code:
{if(stripos(TEMPLATEURL, '/upload/templates/'), substr(TEMPLATEURL, 0, stripos(TEMPLATEURL, '/upload/templates/')+1), substr(TEMPLATEURL, 0, stripos(TEMPLATEURL, '/templates/')+1))}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 9 months ago by tpartner.
The following user(s) said Thank You: socius
The topic has been locked.
More
7 years 8 months ago - 7 years 8 months ago #161597 by socius
Thanks @tpartner! (and sorry for my late response!)

This works!

I have my webspace at my university, in the form
www.university.edu/mywebspace/lsinstallationdir

and in my case this code returns the relative path:
/mywebspace/lsinstallationdir

Thanks!
Best
G
Last edit: 7 years 8 months ago by socius.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose