DenHepLei Posted November 28, 2007 Share Posted November 28, 2007 Hi, Is there a way to make this validate (xhtml11)? <a href="<?php echo $_SERVER['PHP_SELF'];?>?page=a">A</a> I receive the following error: character "<" is the first character of a delimiter but occurred as data. Thanks, - DenHepLei Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 28, 2007 Share Posted November 28, 2007 If that line is what appears in the browser, then the page it is on is not being parsed as PHP code. Does the page have a .php extension or have you setup your server to parse .htm/.html pages as PHP? Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/#findComment-401436 Share on other sites More sharing options...
DenHepLei Posted November 28, 2007 Author Share Posted November 28, 2007 Yes, the page has a .php extension the page is name index.php. I also have other php code within the page, everthing seems to function fine it just does not validate? Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/#findComment-401443 Share on other sites More sharing options...
PFMaBiSmAd Posted November 28, 2007 Share Posted November 28, 2007 You are validating the output, not the source? PHP source code does not validate, because it has no meaning as markup/HTML until it is parsed and executed. Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/#findComment-401448 Share on other sites More sharing options...
helraizer Posted November 28, 2007 Share Posted November 28, 2007 Hi, Is there a way to make this validate (xhtml11)? <a href="<?php echo $_SERVER['PHP_SELF'];?>?page=a">A</a> I receive the following error: character "<" is the first character of a delimiter but occurred as data. Thanks, - DenHepLei If you have it within <?php ?> tags already, that'll be why. If not do so and use <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=a>A</a>"; ?> Sam N.B - as far as I'm aware there's no xhtml 11 either. 1.1 on the other hand.. Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/#findComment-401468 Share on other sites More sharing options...
DenHepLei Posted November 28, 2007 Author Share Posted November 28, 2007 Hi, This solves my issue: <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=a>A</a>"; ?> BTW I am aware there is no xhtml 11 (yet...) I just grabbed the snippet of text from my DOCTYPE not thinking about it... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> Thanks for all you help, I should have seen this myself, it's kind of like looking for your car keys while your holding them in you hand the whole time! Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/#findComment-401487 Share on other sites More sharing options...
DenHepLei Posted November 28, 2007 Author Share Posted November 28, 2007 Hi, Is this the best way to write this, it works but seems lengthy... <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=a>A</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=c>C</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=d>D</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=e>E</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=f>F</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=g>G</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=m>M</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=n>N</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=p>P</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=s>S</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=t>T</a>"; echo " :: " ?> <?php echo "<a href=". $_SERVER['PHP_SELF']."?page=y>Y</a>"; ?> Thanks, - DenHepLei Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/#findComment-401495 Share on other sites More sharing options...
marcus Posted November 28, 2007 Share Posted November 28, 2007 Could use range. $range = range('a','z'); $count = count($range); $x=1; foreach($range AS $letter){ $space = ($x == $count) ? " :: " : ""; echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$letter\">".strtoupper($letter)."</a>" . $space; $x++; } Link to comment https://forums.phpfreaks.com/topic/79302-solved-is-there-a-way-to-make-this-validate-xhtml11/#findComment-401498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.