Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

htmlentities(), include() and files

Posted on 2005-04-05
1
Medium Priority
?
454 Views
Last Modified: 2013-11-18
Hi,

So far i use htmlentities() to translate strings but i need to do the same thing with the content of the file included in a PHP script thanks to include(). It doesn't work !!!

What can I do ?

TIA
0
Comment
Question by:Richard Coffre
1 Comment
 
LVL 32

Accepted Solution

by:
Batalf earned 500 total points
ID: 13706096
If there aren't any php tags in your include file, you could of course read  it by the fopen(), fread() commands.

if there are PHP code, then you could buffer the content.

example:

ob_end_flush(); // Clear buffer
ob_start(); // Start buffer content
include("yourFile.php"); // Include file
$data= ob_get_contents(); // Put data from buffer into a variable
ob_end_clean(); // Clear buffer

echo htmlentities($data);
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question