TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,972
  • Latest: Lineo
Stats
  • Total Posts: 196,105
  • Total Topics: 21,345
  • Online today: 1,072
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 721
  • Total: 721

embedding $context['user'] in a href

Started by disisme, February 15, 2006, 05:10:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

disisme

Guys, I can add the button just fine to the home page (running Bloc's Cerberus theme), but I want to embed the forum username in the href link that launches teamspeak.

Teamspeak is launched from a web page like this :
"teamspeak://xx.xx.xx.xx:8767/nickname=name_I_need_to_pass"

Now, in the index.template.php it uses $context['user'] to store the forum username.  I've tried the following 2 lines, but get template errors :
"teamspeak://xx.xx.xx.xx:8767/nickname=$context['user']?password=party"
and
"teamspeak://xx.xx.xx.xx:8767/nickname=" . $context['user'] . "?password=party"

the ? within the string is a continuation character specific to teamspeak and may be causing the problem.  I get 2 distincly different errors with those 2, which probably isnt surprising to you guys who are au fait with php and html.  The first one complains about the single quote in context.  The second one ends the string at the double quote after nickname=.  Not surprising, really.

How can I pass that variable within the string?

Heres the full line of code I am using against the button :

                          <a href="teamspeak://xx.xx.xx.xx:8767/**STUFF_I_NEED_HERE***">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/voxchat.GIF" alt="chat" style="margin: 2px 0;" border="0" />' : 'chat'), '</a>', $context['menu_separator'], '

IchBin

Did you try this:

nickname=' . $context['user'] . ' <---single quotes instead of double.

disisme

oh man...thats close.... it didnt error, but it threw me in as 'Array'.  Let me check if thats the right var name.  It may not be resolved at that point.

IchBin

I do believe it is actually this:

$context['user']['name']

disisme

Ithink you omay be right.... let me try that

disisme

you are, indeed, correct.  Thanks you sir, your a champion!

This website is proudly hosted on Crocweb Cloud Website Hosting.