TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   hook sytem (http://www.talkphp.com/advanced-php-programming/4574-hook-sytem.html)

ChrisR 06-19-2009 06:55 AM

hook sytem
 
Okay after hours and hours of Google i have had it.

So what i am trying to do is make a hook system but unsure on how to do it.

so i can have a pages with say

Code:

<?php

code here blah blah
$hook->load('me_start');
more code b;lah blah
$hook->load('me_end');

and in the page that gets included some where it has
Code:

<?php
$hook->use('me_start', 'coolfunc');

function coolfunc () {
$wow = 'sup';
echo $sup;
}

?>

so all up it will just put that code whats in that function to were $hook->load is.

something along them lines.

ioan1k 06-19-2009 03:07 PM

http://lmgtfy.com/?q=PHP+Observer+Design+Pattern

Read about Observer Design Pattern, and you can accomplish exactly what you are looking to do


All times are GMT. The time now is 12:54 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0