Page 1 of 1

PHP code help

Posted: Mon Oct 13, 2014 9:17 pm
by Mardonis
I have a pice of code that i cant seem to figure out how to display in PHP.

Code: Select all

echo "> <a href=">Game News</a><br/>";
It is supposed to look like this:
> Game News

I have tried:

Code: Select all

echo "> <a href='>Game News'</a><br/>";
But that only leaves the > showing that goes in front of the Game News portion.

Any ideas?

Thanks

Re: PHP code help

Posted: Mon Oct 13, 2014 10:48 pm
by Epiales
Mardonis wrote:I have a pice of code that i cant seem to figure out how to display in PHP.

Code: Select all

echo "> <a href=">Game News</a><br/>";
It is supposed to look like this:
> Game News

I have tried:

Code: Select all

echo "> <a href='>Game News'</a><br/>";
But that only leaves the > showing that goes in front of the Game News portion.

Any ideas?

Thanks

Try this:

Code: Select all

<?php echo "<a href=''> > Game News</a>"; ?>

Re: PHP code help

Posted: Mon Oct 13, 2014 11:49 pm
by Jackolantern
Also, it should be noted that the > symbol can trip up HTML rendering engines since it is used in tags. You can use what is called an "HTML entity" to show it if it is giving you problems. Just substitute this for every > symbol you need to show:

Code: Select all

>
Aside from that, you just need to straighten out your quotation marks like Epiales mentioned. So the complete line could look like this:

Code: Select all

<?php echo "<a href=''> > Game News</a>"; ?>
EDIT: Oh, and here is a list of common HTML entities. Every character has one, but you won't need the majority of them. The only ones you are likely to need are the symbols used in HTML since they will mess up browsers, or ones for characters that are harder to input, like the copyright symbol or basic fractions.

Re: PHP code help

Posted: Tue Oct 14, 2014 12:37 pm
by Mardonis
cool thank you very much for this. Ill try and work on this now.