The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How can I add a variable in a template?

View previous topic View next topic Go down

Solved How can I add a variable in a template?

Post by Van-Helsing on October 11th 2014, 14:40

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, 23:11; edited 1 time in total

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

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

Post by _Twisted_Mods_ on October 11th 2014, 15:45

think you have to devide it like this


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

_Twisted_Mods_
Helper
Helper

Male Posts : 2032
Reputation : 302
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 on October 11th 2014, 21:35

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
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

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

Post by Ange Tuteur on October 11th 2014, 22:39

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
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

Post by Van-Helsing on October 11th 2014, 22:53

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

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

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

Post by Ange Tuteur on October 11th 2014, 23:05

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

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

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

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

Thank you very much Ange its solved Smile .

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

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

Post by Ange Tuteur on October 11th 2014, 23:15

You're welcome ^^

Topic archived

Have a great day. Smile

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


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