Help - Search - Members - Calendar
Full Version: Show PHP includes
Forums > Resource Center > Webmasters' Corner > Webmasters' Corner Resolved Topics
freeflow
Ok , well when writing tutorials (not on forums) i need to show php includes for them . Is there a code that allows you to show the includes? . I tried <textarea></textarea> but all i get is my server information when i do it.
mipadi
What do you mean by "show them"? Show the code, show the line with the include() function, show the path to the file?
freeflow
ok say i was writing a tutorials and there was a include code that i had to show for someone to put in there wordpress for example. I need to show the include , not have the path Just show it .
Show like this:
<? include("BLAHBLAHBLAH");?>
mipadi
In the HTML, just use the HTML character entity for the < and > characters. < is & lt; (minus the space--IPB can't display it unless there is a space) and > is & gt; (again, minus the space). So it'd look something like this:
CODE
& lt;php include('path/to/include.php'); & gt;

Or, you can use the PHP htmlentities function, which converts HTML entities:
CODE
<?php
$example = '<?php include(\'path/to/include.php\'); ?>';
echo htmlentities($example);
?>
freeflow
Grr Your amazing . The first one worked , second one didn't but one works so thats great thanks so much again.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.