[CODE]
#1
Posted 27 January 2006 - 09:24 PM
#2
Posted 27 January 2006 - 09:28 PM
Edited by zYpher, 27 January 2006 - 09:33 PM.
#3
Posted 27 January 2006 - 10:14 PM
<?
highlight_string('
<?
$is = "is";
echo "this php code" . $is . "highlighted";
?>');
?>
if your using php 5 with highlight_string is should also highlight html: )
***** edit *****
hmm.. i just checked the function
http://us2.php.net/m...ight-string.php
i dont know where i got that it highlights html..
Edited by coolaid, 27 January 2006 - 10:33 PM.
#4
Posted 28 January 2006 - 01:30 AM
*edit*
is there a way to keep the formatting? also, i ahve it in a div, but if i have 1 big line, it will just continue on past the div..how do i keep it in? (i know thats css)...
Edited by zYpher, 28 January 2006 - 01:41 AM.
#5
Posted 28 January 2006 - 02:12 AM
<div>
<pre>
<code>
<? php code ?>
</code>
</pre></div>
that should work
#6
Posted 28 January 2006 - 11:04 AM
<div id="code-container">
<div id="code-top"> </div>
<div id="code-main"><?
highlight_string('<?php this php .is. highlighted ?>');
?> </div>
</div>
the test url is http://www.kreatived...ks.net/main.php
Edited by zYpher, 28 January 2006 - 11:26 AM.
#7
Posted 28 January 2006 - 11:40 AM
*EDIT*
ok i got it to work! 1 problem..there is a "1" at teh end of the function...i used this function:
<?php $text = 'text goes here......'; $newtext = wordwrap($text, 55, "\n"); echo highlight_string($newtext); ?>
the problem is, that it returns a 1 at the end on the website..is there anyway to bypass that?
Edited by zYpher, 28 January 2006 - 12:12 PM.
#8
Posted 28 January 2006 - 01:25 PM
php.net said:
Note: The return parameter became available in PHP 4.2.0. Before this time it behaved like the default, which is FALSE
<?php $text = 'text goes here......'; $newtext = wordwrap($text, 55, "\n"); highlight_string($newtext); ?>Also, the highlight_string function will keep the formatting of your code automatically. If you look at any of the php tutorials on my site (more specifically this one), they all use highlight_string('<? the code ?>'), and no formatting is lost. So there might be some other problem with your code if it's not keeping the formatting.
Edited by rc69, 28 January 2006 - 01:35 PM.
#9
Posted 28 January 2006 - 03:09 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
