Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - (HMVC) - Version 3.1.9
#61

[eluser]gerben[/eluser]
It would be great if the value for MODBASE could be an array. I'd like to create several types of modules (modules, widgets, site-parts), which all have their own folders. Would that be possible? Maybe you can add a config file to the config directory, where the user can configure how he or she wants to use it.

Maybe that would also solve Edemilson's problem, because that could be set as a config variable too. Though personally I really like the fact that modules are small self-containing packages that you can drop in or take out.
#62

[eluser]wiredesignz[/eluser]
I'm thinking you could save a copy of modules_helper.php as widgets_helper.php and change MODBASE and the class name appropriately. Then you have the best of both worlds.
#63

[eluser]wiredesignz[/eluser]
Current Version is 3.1.9
Improved module instantiation methods.
Altered load->module->view to return TRUE unless directed otherwise.
Added class checking prior to module load to prevent duplicate class name being used in different modules.

Improved modules loader to scan module directories when looking for module. ie: scan for a_module.php
Code:
application/modules/a_module.php
application/modules/a_module/a_module.php
application/modules/a_module/controllers/a_module.php
This allows modules to be used as either view partial libraries or HMVC style controllers.
#64

[eluser]jbowman[/eluser]
Nice work. Just started writing code on my site this afternoon and decided to give this a try. It's working out perfectly for what I was most interested, being able to call controllers from other controllers. My first implementation is a layout module, that is allowing me to do things like this

Code:
function index()
    {
        $data['header'] = modules::run('layout', '', 'header');
        $data['footer'] = modules::run('layout', '', 'footer');
        $this->load->view('admin/main', $data);
    }

Then a view like this

Code:
<?=$header?>
this is the main admin interface
<?=$footer?>

Hello partials Smile Great library/helper. I think I'm going to have a lot of fun with it.

The only thing I notice me doing out of the norm is not storing my models in the modules. I kind of feel those belong in a place available to all controllers.
#65

[eluser]sikkle[/eluser]
wait wait wait,

are you telling me, that i can call by example in my view, load module whatever, so the controller from this module will do entire cycle, send the view and the view continue to be display ?

like a 100% stand alone partial ?

i'm right ?

thanks.
#66

[eluser]wiredesignz[/eluser]
Thanks jbowman. Smile

There's no requirement to store models in module directories. Its up to the developer.

@sikkie: Yes HMVC controllers as partials.


But wait theres more...

Version 4.0.0 is a complete rewrite, faster and smaller, there is no need to use $this->load->module->whatever, anymore $this->load->normal works in modules just like is does elsewhere.

If you have a model in application/models the loader will find it and use it in your module also.

Version 4.0.0 is a few hours away yet. Thansk for your interest.
#67

[eluser]wiredesignz[/eluser]
As an after-thought jbowman, why not do this:
Code:
// 'admin/main' view
<?= modules::run('layout', '', 'header') ?>
this is the main admin interface
<?= modules::run('layout', '', 'footer') ?>
#68

[eluser]sikkle[/eluser]
Wireddesignz :

ME and the community will enjoy you write a little tutorial about totally separate stuff calling partial.

Let's say you have the basic application, in your view at some place you want to grab last ten user connected to the website, so you will be able directly in the view to call <?= modules::run('modulenamer', '', 'controller ?') ?>

Something like that ?

thanks!
#69

[eluser]jbowman[/eluser]
[quote author="wiredesignz" date="1204545833"]As an after-thought jbowman, why not do this:
Code:
// 'admin/main' view
<?= modules::run('layout', '', 'header') ?>
this is the main admin interface
<?= modules::run('layout', '', 'footer') ?>
[/quote]

Mainly just preference. eventually that layout module will handle data such as sessions, or which header to show, etc etc. Those functions really will be controllers, not just shortcuts to views, so I think they should be called from the main controllers. The site I'm working on will have some ajax, so some controllers will make the determination whether it needs use the layout module at all.
#70

[eluser]wiredesignz[/eluser]
[quote author="sikkle" date="1204572072"]Wireddesignz :

ME and the community will enjoy you write a little tutorial about totally separate stuff calling partial.

Let's say you have the basic application, in your view at some place you want to grab last ten user connected to the website, so you will be able directly in the view to call <?= modules::run('modulenamer', '', 'controller ?') ?>

Something like that ?

thanks![/quote]

You would create a module something like this:
Code:
<?php

class Find_last10 extends Module
{
    function Find_last10()
    {
        parent::Module();
        $this->load->model('user_log');
    }

    function index()    //default modules::run method is index
    {
        $data['result'] = $this->user_log->findPaged("ORDER DESC", 10);
        return $this->load->view('last_login_view', $data);  
    }
}
[/code]




Theme © iAndrew 2016 - Forum software by © MyBB