Replacing Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Replacing Problem

Post by AbraCadaver »

It's really hard to tell what's going on without debugging it myself, so to pytrin's point, forget the eval() and include the file:

Instead of:

Code: Select all

$data = (file_exists($data)) ? join("", file($data)) : $data;
Try:

Code: Select all

if(file_exists($data)) {
    ob_start();
    include($data);
    $data = ob_get_clean();
}
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Trahb
Forum Commoner
Posts: 36
Joined: Sat Jan 30, 2010 9:09 pm

Re: Replacing Problem

Post by Trahb »

AbraCadaver wrote:It's really hard to tell what's going on without debugging it myself, so to pytrin's point, forget the eval() and include the file:

Instead of:

Code: Select all

$data = (file_exists($data)) ? join("", file($data)) : $data;
Try:

Code: Select all

if(file_exists($data)) {
    ob_start();
    include($data);
    $data = ob_get_clean();
}
Wow.
It worked <3 Saved my life! :D :drunk:
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Replacing Problem

Post by AbraCadaver »

Well thank pytrin. That was the path he was trying to get you to follow. I was was trying to give you a quick change to allow PHP code in your templates.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Trahb
Forum Commoner
Posts: 36
Joined: Sat Jan 30, 2010 9:09 pm

Re: Replacing Problem

Post by Trahb »

Well thanks to both of you :D
Post Reply