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
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-24-2010, 09:28 PM   #1 (permalink)
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
fantomel is on a distinguished road
Default small template engine

hello i`m trying to build a small simple parser data from controller to the view but i`m including my files using another function in another class and i would like to use the parse function from bellow code there but without including the file from the parser function i want to include it separated but i can't succeed in doing that can someone please help me i can't figure out by my self why i can't do that. :(

PHP Code:
class View
{
    public 
$values = array();

    public function 
set($key$value)
    {
    
$this->values[$key] = $value;
    }

    public function 
parse()
    {
        if(
is_array($this->values))
        {
            
extract($this->valuesEXTR_OVERWRITE);
        }
        include(
'index.php');
    }

fantomel is offline  
Reply With Quote
Old 03-24-2010, 10:25 PM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Breath between sentences, it'll help us understand the question.

If you don't want to include that class in a separate file, why not copy and paste it into the file you want to use it from? Or as part of another library file in your arsenal?
delayedinsanity is offline  
Reply With Quote
Old 03-25-2010, 12:41 AM   #3 (permalink)
The Wanderer
 
Join Date: Jun 2009
Posts: 7
Thanks: 0
fantomel is on a distinguished road
Default

Quote:
Originally Posted by delayedinsanity View Post
Breath between sentences, it'll help us understand the question.

If you don't want to include that class in a separate file, why not copy and paste it into the file you want to use it from? Or as part of another library file in your arsenal?
i have the controller class (which is extended by each controller), the controller is an abstract class with a final function index in there i have a function that is called before anything else from where i check for headers setup header parse each bit of template header body(controller) footer(each of this accept the controller are defined in a config file for templates) and of course before parsing the template files i need to run the parse() function but as i've mentioned i have troubles at this part.
I don't want to add there this two functions and i keep them separated because in the future i might add new things or change things around there.. and i want to keep everything in it's own class not mix up things.
(that function i have in the controller class is called by the router class).
so the flow would be something like this
http://www.domain.com/ -> check for headers "parse" the $vars from template load the bits call controller -> method ( i think... i`m kinda of tired in this moment prob my judge is not very good :( )
fantomel is offline  
Reply With Quote
Reply



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

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is best template engine? hostpeyma Script Giveaway 7 10-27-2009 05:21 AM
Template Engine hello-world General 20 03-18-2009 01:51 PM
Pure PHP template class. abiko Advanced PHP Programming 1 04-02-2008 05:45 PM
MySQLs new storage engine Alan @ CIT MySQL & Databases 0 01-29-2008 10:58 PM
Need your feedback Tanax Absolute Beginners 29 10-11-2007 04:50 PM


All times are GMT. The time now is 08:11 PM.

 
     

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