Welcome to Geeklog, Anonymous Monday, December 23 2024 @ 02:21 pm EST
Geeklog Forums
Dynamic Link Creation
Status: offline
sammykrupa
Forum User
Junior
Registered: 12/05/04
Posts: 28
Hey!
I am trying to setup Dynamic Link Creation. Here is an example:
Text Formatted Code
http://gdfae.com/click-2134123412-2134123-<username of logged in person>
As you can see I need to have the [username of logged in person] changed to the username of logged in person. Is there anyway I can do this using blocks, static pages, whatever?
Thanks!
Sam Krupa
8
7
Quote
sammykrupa
Anonymous
How can I use that on a page so it changes to the username of the logged in user?
8
10
Quote
Status: offline
sammykrupa
Forum User
Junior
Registered: 12/05/04
Posts: 28
Anyone?
Sam Krupa
Sam Krupa
8
7
Quote
sammykrupa
Anonymous
Yea, but whenever I put $_USER['username'] on a page nothing happens? What am I doing wrong? If I am doing something stupid I don't know it.
7
9
Quote
sammykrupa
Anonymous
I am confused!
10
9
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Text Formatted Code
<?php$retval = 'http://gdfae.com/click-2134123412-2134123-';
$retval .= $_USER['username'];
return $retval;
?>
that will only work in your header.thtml, a phpblock, or a PHP enabled staticpage.
7
7
Quote
sammykrupa
Anonymous
Thank you!
7
11
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
you need to be a bit more specific... what exactly are you putting into your lib-common (and why not in your lib-custom?)? how are you calling it?
try this
global $_USER;
$retval = '<a href="http://gdfae.com/click-2134123412-2134123-';
$retval .= $_USER['username'] . '">';
$retval .= $_USER['username'] . '</a>';
return $retval;
}
now just call user_link() where you need this link to be inside your phpblock. or, easier, just put this code inside your phpblock.
try this
Text Formatted Code
function user_link(){global $_USER;
$retval = '<a href="http://gdfae.com/click-2134123412-2134123-';
$retval .= $_USER['username'] . '">';
$retval .= $_USER['username'] . '</a>';
return $retval;
}
9
7
Quote
sammykrupa
Anonymous
Victory!
I owe you one! Thanks!
I owe you one! Thanks!
7
9
Quote
All times are EST. The time is now 02:21 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content