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.

PHP code help

Postby Mardonis » Mon Oct 13, 2014 4:17 pm

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
Mardonis
 
Posts: 139
Joined: Wed Jun 29, 2011 2:54 pm
Has thanked: 3 times
Been thanked: 1 time

Re: PHP code help

Postby Epiales » Mon Oct 13, 2014 5:48 pm

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
Epiales
 
Posts: 1119
Joined: Wed Aug 14, 2013 8:38 pm
Has thanked: 62 times
Been thanked: 6 times

Re: PHP code help

Postby Jackolantern » Mon Oct 13, 2014 6:49 pm

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
&gt;


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=''> &gt; 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
User avatar
Jackolantern
 
Posts: 10893
Joined: Wed Jul 01, 2009 6:00 pm
Location: Houston, TX
Has thanked: 22 times
Been thanked: 92 times
Blog: View Blog (1)

Re: PHP code help

Postby Mardonis » Tue Oct 14, 2014 7:37 am

cool thank you very much for this. Ill try and work on this now.
Mardonis
 
Posts: 139
Joined: Wed Jun 29, 2011 2:54 pm
Has thanked: 3 times
Been thanked: 1 time


Return to Beginner Help and Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x