Page 1 of 1

Php-Code to view Code

Posted: 21 Sep 2018, 15:59
by JanMolendijk
Dear admin hope you do okey ???

I looking for php code like I can do here with [ code] option
to show it on my website ???? so i`m also able to see <>

Php-Code to view Code

Posted: 21 Sep 2018, 17:06
by Admin
Hello,
I didn't understand your question.
What do you want to do?
What to show and what to see?

Php-Code to view Code

Posted: 22 Sep 2018, 17:22
by JanMolendijk
Sorry for my bad english

In my documents I want to see the full code in text
like I can do here for example

Code: Select all

<iframe src="http://145.53.93.209/Comments" 
width="300" height="440" frameborder="0" scrolling="yes" 
align="top" marginwidth="0" marginheight="0" name="offtopic">
</iframe>

Php-Code to view Code

Posted: 22 Sep 2018, 18:26
by Admin
Try to apply the htmlentities() function to the string with code in your php script that displays the page.
Example:

Code: Select all

$str ='Have a <b>Good life</b> with everyone and <em>with yourself</em>.';

echo htmlentities($str, ENT_QUOTES);

Php-Code to view Code

Posted: 25 Sep 2018, 14:22
by JanMolendijk
Thanks for the support but I could not make it work
after I made a search & found on php . net something

But I can not find out how to place enters in the document
the whole code shows without enter (for new row)

Code: Select all

<?php
$new = htmlspecialchars('<iframe src="http://145.53.93.209/Address.php" 

width="300" height="440" frameborder="0"

scrolling="yes" align="top" marginwidth="0"

marginheight="0" name="offtopic"></iframe>', ENT_QUOTES);

echo $new; 
?>

Php-Code to view Code

Posted: 25 Sep 2018, 14:37
by Admin
To replace the new line characters (\n,\r\n) with html <br> tag, use the nl2br() function.

Code: Select all

<?php
$str ='<iframe src="http://145.53.93.209/Address.php" 
width="300" height="440" frameborder="0"
scrolling="yes" align="top" marginwidth="0"
marginheight="0" name="offtopic"></iframe>';
$new = htmlspecialchars($str, ENT_QUOTES);
$new = nl2br($new, false);

echo $new; 
?>

Php-Code to view Code

Posted: 25 Sep 2018, 14:52
by JanMolendijk
Thanks Chief

You told me once that you do not judge,
but sometimes I wonder what you think
of my knowledge :D ????