ActaNonVerba1 Posted January 21, 2011 Share Posted January 21, 2011 Hey guys, I'm opening a HTML file from my server, and i can successfully echo it both as code to show the page, and as code which the person can then edit in a <textarea>. However, there are certain sections of the code i do not what echo'd to the page. What is the best way to go about stipping them? For example i do not want the user to be able to edit the doctype, head element, <header> or <nav> sections of the code. Thanks in advance Danny. Quote Link to comment https://forums.phpfreaks.com/topic/225209-how-to-display-only-certain-code-from-an-fopen/ Share on other sites More sharing options...
BlueSkyIS Posted January 21, 2011 Share Posted January 21, 2011 typically the content is stored in a database and PHP is used to add the non-editable elements. alternatively, you could store the content in a separate file and use PHP to add the non-editable elements. in the end, creating individual HTML files and stripping off the non-editable parts, then re-adding them is going to be more difficult than other options. Quote Link to comment https://forums.phpfreaks.com/topic/225209-how-to-display-only-certain-code-from-an-fopen/#findComment-1163111 Share on other sites More sharing options...
ignace Posted January 21, 2011 Share Posted January 21, 2011 strip_tags to strip out all HTML tags, it has an optional argument that allows you to tell which should be kept. Quote Link to comment https://forums.phpfreaks.com/topic/225209-how-to-display-only-certain-code-from-an-fopen/#findComment-1163113 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.