Hi all!

So I've got something that's been stumping me. Granted, I don't know PHP like I should (I am learning!), I'm trying to figure out how to apply some css to just this one specific link that this bit of php code creates, but I can't for the life of me figure out how to do it.

Here is the snippet of code:

$output .= t('<p class="user-info darklink" style="position:relative; left: 433px; top:-5px;">Hi <a class=\"darklink\" href="">!user</a>, welcome back.<br><div style="position:relative; left: 295px; top:20px;"><a class="darklink" href="/user">My Account</a> | <a class="darklink" href="/logout">Sign Out</a></div></p>', array('!user' => theme('username', $user)));

The "darklink" class makes the links (that appear on a dark background) appear white. This allows all of the majority of my theme's links to appear black, because those links have a white background.

The link I'm having trouble with is the "!user" link that comes from the php array. The php displays the current user that is logged in. But currently I cannot figure out how to apply a css class just to this one link.

Does it have to be done with some sort of php code I dont know?

I appreciate any help at all! I'd like to get this [tiny] thorn out of my side.

Thanks!

Comments

Do not escape the class name?

I guess it's not necessary to escape class name in <a class=\"darklink\" href="">!user</a>, have you tried replacing it with <a class="darklink" href="">!user</a>?

_________________________

Kiwi Drupal Themes

Hey thanks for your

Hey thanks for your response!
Yea I've tried that. Actually, the way the code is looks like this:

$output .= t('<p class="user-info darklink" style="position:relative; left: 433px; top:-5px;">Hi !user, welcome back.<br><div style="position:relative; left: 295px; top:20px;"><a class="darklink" href="/user">My Account</a> | <a class="darklink" href="/logout">Sign Out</a></div></p>', array('!user' => theme('username', $user)));

Notice how the "!user" part no longer has an href tag around it. When I posted my first post, I just copy and pasted the code as I was in the middle of testing to see if adding an href tag with a class would make the "!user" link (that is made by the php) constrain to the class css I'm needing it to.

Any thoughts?

Boil em, mash em, stick em in a stew....

Perhaps this will

Perhaps this will work?

$output .= t('<p class="user-info darklink" style="position:relative; left: 433px; top:-5px;">Hi !user, welcome back.<br><div style="position:relative; left: 295px; top:20px;"><a class="darklink" href="/user">My Account</a> | <a class="darklink" href="/logout">Sign Out</a></div></p>', array('!user' => l($user->name, 'user/'.$user->uid, array('attributes' => array('class' => 'darklink')))));

BTW, do not use inline styles, it's a very bad practice.

_________________________

Kiwi Drupal Themes

that did the trick! Thank

that did the trick! Thank you!

Oh, and as far as using inline styles goes, i agree that it isn't good to get in a habit of using them. I was doing it for this specific bit of code to make it easier while I was trying to work out the bug of the "!user" link.

Thanks again!

cheers

Boil em, mash em, stick em in a stew....