Women in Technology

Hear us Roar



Article:
  Implementing MVC in PHP: The Model
Subject:   How to load several modules in a time?
Date:   2007-05-22 08:51:36
From:   Einstijn
Hello,


first of all, thanks to Joe Stump for this great series of articles. It really has been a great help for me!


Now my question :)
Has any body been able to load several modules at a time? I would like to show the latest newspost and a random picture (from my module photoalbum) in the sidebar of my website. But I doen't really now how to do that. I tried to place the following code in the controller (index.php).



require_once('../modules/news/news.php');
$instance = new news();
$module = "news";
$event = '__default';


if (!PM_Module::isValid($instance)) {
die("Requested module is not a valid framework module!");
}


$instance->moduleName = $module;


if ($instance->authenticate()) {
try {
$result = $instance->$event();
if (!PEAR::isError($result)) {
// $presenter = PM_Presenter::factory($instance->presenter,$instance);


/*
if (!PEAR::isError($presenter)) {


$presenter->display();
} else {
die($presenter->getMessage());
}
}
} catch (Exception $error) {
die($error->getMessage());
}
} else {
die("You do not have access to the requested page!");
}


But this off course doesn't work. Is there anyone with a solution for this problem?


thx in advance!

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • How to load several modules in a time?
    2008-07-06 10:27:04  joshsherman [View]

    Probably a bit late on my reply but in case you are still faced with the dilemma, have you thought about creating an additional module that would utilize objects based on the other modules? That would make the most sense as you're adding domain logic to your controller and that's not very MVC.