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, 11: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 12th 2014, 8:11 am; 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 12th 2014, 12:45 am

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 : 2083
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 12th 2014, 6:35 am

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 12th 2014, 7:39 am

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 : 13207
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 12th 2014, 7:53 am

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 12th 2014, 8:05 am

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

Male Posts : 13207
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 12th 2014, 8:10 am

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 12th 2014, 8:15 am

You're welcome ^^

Topic archived

Have a great day. Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
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