aznjay Posted September 17, 2008 Share Posted September 17, 2008 So how do you show the PHP code without actually using it. like this how do you show php stuff without using it just presenting it. I'm trying to make tutorials and it shows up...mmm... <? blah ?> Quote Link to comment https://forums.phpfreaks.com/topic/124592-php-viewing/ Share on other sites More sharing options...
genericnumber1 Posted September 17, 2008 Share Posted September 17, 2008 comments! <?php I do stuff! // I don't do stuff /* I don't do stuff either! */ # I don't do stuff either, but my usage is much less common, I'd use the two above me. ?> at least I think that's what you're asking... Just occured: maybe you mean how do you echo php tags without parsing? you could do <php ^ looks like <?php outside of these code tags. > ^ looks like > outside of these code tags. or you could do echo ' <?php // code ?> '; Quote Link to comment https://forums.phpfreaks.com/topic/124592-php-viewing/#findComment-643508 Share on other sites More sharing options...
F1Fan Posted September 17, 2008 Share Posted September 17, 2008 My company has a few programs that transfer PHP code from one server to another using the include function. When it is included (using the full http address), the included file generates and echoes php code like this (this is a sample of the code inside the included file): <?php echo "<?php\n\n"; ?> more PHP code here... blah blah blah... <?php echo "\n?>"; The problem with this is that it doesn't show up on the page, you have to view the source to see it. So, you could try adding the <pre></pre> tags around it. Quote Link to comment https://forums.phpfreaks.com/topic/124592-php-viewing/#findComment-643510 Share on other sites More sharing options...
F1Fan Posted September 17, 2008 Share Posted September 17, 2008 sorry, those where the "pre" tags. Quote Link to comment https://forums.phpfreaks.com/topic/124592-php-viewing/#findComment-643511 Share on other sites More sharing options...
Third_Degree Posted September 17, 2008 Share Posted September 17, 2008 just have to use print or echo Quote Link to comment https://forums.phpfreaks.com/topic/124592-php-viewing/#findComment-643512 Share on other sites More sharing options...
Zane Posted September 17, 2008 Share Posted September 17, 2008 there is a function called highlight_string that does exactly what you are looking for. a simple highlight_string("<?php echo "Sup Nykka!"; ?>"); would make this Quote Link to comment https://forums.phpfreaks.com/topic/124592-php-viewing/#findComment-643518 Share on other sites More sharing options...
M.O.S. Studios Posted September 17, 2008 Share Posted September 17, 2008 its easy, your problem is your using echo which places text into hml code. and by defalut if html see's a tag it dosn't understand it hides everything in between it. the way around this problem is useing the html codes for < and > your script would be this: echo "<?php blah ?>" which = <?php blah ?> i found a converter at http://www.plus2net.com/html_tutorial/tags-page.php Quote Link to comment https://forums.phpfreaks.com/topic/124592-php-viewing/#findComment-643547 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.