Created
March 31, 2011 11:07
-
-
Save nautilebleu/896184 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// in application/app/php/lib/app_manager/app_manager.class.php | |
class AppManager extends WebApplication | |
// ... | |
/** | |
* render the component | |
*/ | |
public function render($template, $params) | |
{ | |
$this->display_header($trail); | |
$path = sprintf('%s/../templates/%s.php', | |
dirname(__FILE__), | |
$template); | |
foreach ($params as $name => $value) { | |
$$name = $value; | |
} | |
include($path); | |
$this->display_footer(); | |
} | |
?> | |
<?php | |
// in application/app/php/lib/app_manager/component/browser.class.php | |
class AppManagerBrowserComponent extends AppManager | |
{ | |
function run() | |
{ | |
$form = new AppForm($this->get_view_url()); | |
$form->build(); | |
if (Request::post('test') !== null) { | |
if ($form->validate()) { | |
$form->save(); | |
$this->redirect('Message', false); | |
} | |
} | |
$this->render('browse', | |
array('form' => $form)) ; | |
} | |
} | |
?> | |
// in application/app/php/lib/templates/browse.html.php | |
<h2>Hello world</h2> | |
<a href="<?php echo $this->get_browse_url(); ?>">Link</a> | |
<?php echo $form->toHtml(); ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment