0

I was trying to add a text file through an iframe in order for my lecture to be able to see and mark my php code. The problem is that 000web.com where I hosted my site does not allow txt files for security reasons.

As a work around I tried to place my php code inside a textarea tag and this still does not work. I would highly appreciate it if someone can assist me with this issue. Basically I want to display my php code inside a php page so that it can be viewed by a visitor.

2
Contributors
1
Reply
15
Views
1 Year
Discussion Span
Last Post by jkon
1

Hello Vusumuzi . If I understood the only thing you like to do is have the PHP code in the content , so here are two alternative easy ways. There is always the option to use a programming languages code highlighter JavaScript browser text editor.

<?php 
    // First option 
    highlight_file("test.php");

    // second option 
    $phpFileContents = file_get_contents("test.php");
    $phpFileContents = htmlentities($phpFileContents);
    $phpFileContents = str_replace("\n", "<br/>", $phpFileContents);
    $phpFileContents = str_replace("\t", "&nbsp;&nbsp;&nbsp;", $phpFileContents);
    echo $phpFileContents;
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.