PHP code help

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
Mardonis
Posts: 139
Joined: Wed Jun 29, 2011 7:54 pm

PHP code help

Post 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
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: PHP code help

Post 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>"; ?>
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: PHP code help

Post 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.
The indelible lord of tl;dr
Mardonis
Posts: 139
Joined: Wed Jun 29, 2011 7:54 pm

Re: PHP code help

Post by Mardonis »

cool thank you very much for this. Ill try and work on this now.
Post Reply

Return to “Beginner Help and Support”