View Full Version : simple code modifying?
Gio~Logist
02-18-2005, 02:55 PM
Im trying to make it so that if there's an <img src=""> then it wont just show as n X, and instead it wont show nothing. I came up with this code but it isn't working AT ALL..........anyone know what's wrong?
if ($output == "<img src=\"">")
{ echo ""; }
Deaths
02-18-2005, 02:58 PM
Maybe this would work better:
if($output == <img src=\"">")
{
$output = "";
}
Gio~Logist
02-18-2005, 03:01 PM
Thanks for trying but i got this :dead:
Parse error: parse error, unexpected '<' in /home/urbandy/public_html/forums/member.php on line 1273
Deaths
02-18-2005, 03:05 PM
if($output == "<img src=''>")
{
$output = "";
}
That should do it.
Note the ' instead of the ". If you use a ", PHP will think you close the if ;)
Gio~Logist
02-18-2005, 03:07 PM
Thanks again..............This time i did not get an error, however, the X still shows up when <img src=""> appears
Deaths
02-18-2005, 03:10 PM
Ah, you are tring to replace <img src="">.
Then try this:
if($output == '<img src="">')
{
$output = "";
}
Gio~Logist
02-18-2005, 03:11 PM
i was doing "BADGES / AWARDS HACKETTE v1.0 By Kaelon of Alleria.com" but it wouldnt work for some reason so now i need to maek my own thing and what i did was i put <img src="$userinfo[field6"> and then with the ones with no badges it appears as <img src="">.........his code looked something like this
if ($userinfo[field6]=="") {
$badge = "";
} else {
$badge = "<img src=\"$userinfo[field6]\">";
}
Deaths
02-18-2005, 03:21 PM
Could you please explain that post again, I did not understand you...
Gio~Logist
02-18-2005, 03:23 PM
I put <img src="$userinfo[field6"> in the getinfo template. The purpose of this is so that if field 6 has a link then the link will be posted as a pic. However, if that field is blank then it will show up as <img src="">. This is why i want to find a way to make it so that <img src=""> will just show up as nothing instead of an X
Dean C
02-18-2005, 03:31 PM
This isn't the forum for vB/PHP questions, moved :)
Gio~Logist
02-18-2005, 03:31 PM
Oh, sorry Dean............
Link14716
02-18-2005, 03:33 PM
In the template itself, change this:
<img src="$userinfo[field6]">
to this:
<if condition="!empty($userinfo[field6])"><img src="$userinfo[field6]"></if>
Gio~Logist
02-18-2005, 03:37 PM
<if condition="!empty()"><img src="">
it comes up like that in a profile with no image
Deaths
02-18-2005, 03:40 PM
<if condition="$userinfo[field6]"><img src="$userinfo[field6]"></if>
Try that.
Gio~Logist
02-18-2005, 03:42 PM
<if condition=""><img src="">
it comes up like that in a profile with no image
Isnt there a way to just make it so that <img src=""> shows up as nothing (using php)?
Deaths
02-18-2005, 03:43 PM
Do you actually enter the code like this : <if condition="">, or are you just simplifying it to post?
Gio~Logist
02-18-2005, 03:59 PM
i added the code lik he said, however, once i ad it, i appears like that on the profile of those people who do not have an image
Deaths
02-18-2005, 04:11 PM
I have no idea then, sorry.
Link14716
02-18-2005, 09:30 PM
Are you using vB2 or something?
* Link14716 looks at gio~logist's user info.
2.3.5, eh? Template conditionals are a vB3 feature, so of course it won't work. Bah.
Well then, wherever you were putting that PHP code above, then, use this:
if (!empty($userinfo['field6'])) {
$badge = "<img src=\"$userinfo[field6]\">";
}
And then $badge goes in the template.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.