I have this line in php
<a title="'.htmlspecialchars($User->Name).'" href="'.$Href.'"'.$LinkClass.'>
I need to add another class which is known called tip
The code above generates something like this:
<a class="ProfileLink" href="/respond/profile/2/422" title="422">
As you can see $LinkClass gives me the class “ProfileLink” which is great
But I need to parse the class like “ProfileLink tip”
So just not sure how to amend $LinkClass above to something like $LinkClass tip
This is probably so basic I just cant see the wood for the trees
//
Edit: to add
Final html output needs to be :
<a class="ProfileLink tip" href="/respond/profile/2/422" title="422">
//
Added:
Entire php output for this function is:
if (!function_exists('UserPhoto')) {
function UserPhoto($User, $Options = array()) {
$User = (object)$User;
if (is_string($Options))
$Options = array('LinkClass' => $Options);
$LinkClass = GetValue('LinkClass', $Options, 'ProfileLink');
$ImgClass = GetValue('ImageClass', $Options, 'ProfilePhotoMedium');
$LinkClass = $LinkClass == '' ? '' : ' class="'.$LinkClass.'"';
$Photo = $User->Photo;
if (!$Photo && function_exists('UserPhotoDefaultUrl'))
$Photo = UserPhotoDefaultUrl($User);
if ($Photo) {
if (!preg_match('`^https?://`i', $Photo)) {
$PhotoUrl = Gdn_Upload::Url(ChangeBasename($Photo, 'n%s'));
} else {
$PhotoUrl = $Photo;
}
$Href = Url(UserUrl($User));
return '<a title="'.htmlspecialchars($User->Name).'" href="'.$Href.'"'.$LinkClass.'>'
.Img($PhotoUrl, array('alt' => htmlspecialchars($User->Name), 'class' => $ImgClass))
.'</a>';
} else {
return '';
}
}
}
How about using an array for the class attribute? Like this:
and then on return :