The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How can I add a variable in a template?

3 posters

Go down

Solved How can I add a variable in a template?

Post by Van-Helsing October 11th 2014, 2:40 pm

Hello,
How can I add the username variable in index_box template. I am trying this code
Code:
<li id="user_content"><a href="/st/{USERNAME}" title="">Οι δημοσιεύσεις μου</a>

but its not working. Can you help me please?

My forum version is PunBB.


Last edited by Black-Shadow on October 11th 2014, 11:11 pm; edited 1 time in total
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I add a variable in a template?

Post by _Twisted_Mods_ October 11th 2014, 3:45 pm

think you have to devide it like this


Code:
<li id="user_content"><a href="'/st/' + '{USERNAME}'" title="">Οι δημοσιεύσεις μου</a>
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2108
Reputation : 336
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

Solved Re: How can I add a variable in a template?

Post by Van-Helsing October 11th 2014, 9:35 pm

thetwistedkilla wrote:think you have to devide it like this


Code:
<li id="user_content"><a href="'/st/' + '{USERNAME}'" title="">Οι δημοσιεύσεις μου</a>
Hello,
Its not working it returns white page http://prntscr.com/4v73cw as you can see here now it adds the characters ' ' in url address http://prntscr.com/4v73wi normally it must goes to the link <forumurl>/st/username but its not adds the username at the end of the link.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I add a variable in a template?

Post by Ange Tuteur October 11th 2014, 10:39 pm

Hello Black-Shadow,

From what I recall, you cannot use this variable in the templates. You could try this :
Code:
<a id="search-t" href="/st/" title="">Οι δημοσιεύσεις μου</a><script type="text/javascript">$(function(){document.getElementById('search-t').href = '/st/' + _userdata.username});</script>
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I add a variable in a template?

Post by Van-Helsing October 11th 2014, 10:53 pm

Hello Ange,
The /spa/ is for member's replies and /st/ is for member's topics?
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I add a variable in a template?

Post by Ange Tuteur October 11th 2014, 11:05 pm

st = member's topics
sta = topics member has posted in
spa = member's replies
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I add a variable in a template?

Post by Van-Helsing October 11th 2014, 11:10 pm

Thank you very much Ange its solved Smile .
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: How can I add a variable in a template?

Post by Ange Tuteur October 11th 2014, 11:15 pm

You're welcome ^^

Topic archived

Have a great day. Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum