?
Solved

htmlentities(), include() and files

Posted on 2005-04-05
1
Medium Priority
?
449 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

765 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