TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 10-25-2008, 12:49 AM   #1 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Angry help in a templating class

Hi guys, this is my first actual php post here and it's about a problem with a line in the simple templating class that i have. the class it's this:

PHP Code:
<?php
class View {
    public 
$template;
    public 
$d='%'//delimiter
    
    
function load($f) {
        
$f=WEB_HOST.'components/'.$f;
        if(!
file_exists($f)) return FALSE;
        
$this->template file_get_contents($f);
    }
    
    function 
delimit($delimeter) {
        
$this->d=$delimeter;
    }
    
    function 
replace($var$content) {
        
$this->template str_replace($this->d.$var.$this->d$content$this->template);
    }
    
    function 
publish() {
        eval(
"?>".$this->template."<?");
    }
}
?>
the problem seems to be in the function file_get_contents() because nothing seems to be saved in the template variable. I have tried change it by using file, fopen, fread functions and also even using curl, but nothing seems to save the text of the file in the variable. I am lost with this. Any help would help me, and thanks in advance

Also I would like your opinion in the publish function, i feel not very secure using the eval() function.
tony is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:11 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design