Reputation: 23
I have the following code for displaying files that are saved on the database/server:
$value .= "<a target=_blank href='https://docs.google.com/viewer?url=http://www.iso365.online/flashpoint/".$fileArray[$i]["name"]."'>View</a>";
On the web page this displays the value as a hyperlink which is displayed as
View
.
What I want to do is change the text from View to an icon, which would be
images/view.jpg
.
Can someone please tell me how to modify the above code to make this happen, thanks.
Upvotes: 1
Views: 1430
Reputation: 5800
Ok, so that code is not only HTML (it looks like PHP, so you might want to add that tag).
But regardless, you want to change the text View
to an image element.
<img src="images/view.jpg">
So the code should be:
$value .= "<a target=_blank href='https://docs.google.com/viewer?url=http://www.iso365.online/flashpoint/".$fileArray[$i]["name"]."'><img src='images/view.jpg'></a>";
Notice the use of single quotes instead of double quotes (src='...'
instead of src="..."
), as double quotes are the string delimiter and will end your string early.
Upvotes: 0
Reputation: 781
Try this:
<a target=_blank href='https://docs.google.com/viewer url=http://www.iso365.online/flashpoint/".$fileArray[$i]["name"]."'>
<img src="link to your image here..."></img>
</a>
Upvotes: 1