Step 1:

kunal@kunal:/var/www/html/p/phalcon$ sh phalcondevtool/phalcon project multimod –type=modules

kunal@kunal:/var/www/html/p/phalcon$ cd multimod

kunal@kunal:/var/www/html/p/phalcon/multimod$ cd apps/

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ ls

frontend

Step 2:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ cp -r frontend/ admin/

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ ls

admin  frontend

kunal@kunal:/var/www/html/p/phalcon/multimod/apps$ cd admin/

Step 3:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin$ sudo vi Module.php

In the above file make changes in namespace and in registerAutoloaders

namespace Multimod\Frontend;

Change to

namespace Multimod\Admin;

And

$  loader->registerNamespaces(array( 
            'Multimod\Frontend\Controllers' => __DIR__ . '/controllers/', 
            'Multimod\Frontend\Models' => __DIR__ . '/models/', 
));

Change to

$  loader->registerNamespaces(array( 
            'Multimod\Admin\Controllers' => __DIR__ . '/controllers/', 
            'Multimod\Admin\Models' => __DIR__ . '/models/', 
));

Step 4:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin$ cd controllers/

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin/controllers$ sudo vi ControllerBase.php

In above file change the namespace.

namespace Multimod\Frontend\Controllers;
Change to

namespace Multimod\Admin\Controllers;

Step 5:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin/controllers$ sudo vi IndexController.php

In above file change the namespace.

namespace Multimod\Frontend\Controllers;
Change to

namespace Multimod\Admin\Controllers;

Step 6:

kunal@kunal:/var/www/html/p/phalcon/multimod/apps/admin$ sudo vi views/index/index.phtml

Add following line in above file to make sure that your admin view is different.

Congratulations! you are in admin view

Step 7:

kunal@kunal:/var/www/html/p/phalcon/multimod/config$ sudo vi modules.php

Add new register modules.

 'frontend' => array( 
        'className' => 'Multimod\Frontend\Module', 
        'path' => __DIR__ . '/../apps/frontend/Module.php' 
    )



Add new line below to this is as follow….

'admin' => array( 
        'className' => 'Multimod\Admin\Module', 
        'path' => __DIR__ . '/../apps/admin/Module.php' 
    )


Step 8:

kunal@kunal:/var/www/html/p/phalcon/multimod/config$ sudo vi services.php

You foud the default module is frontend so we need to add the routing for admin module. So here is the code.

$  router->add("/admin", array( 
                'module'     => 'admin', 
                'namespace'  => 'Multimod\Admin\Controllers', 
                'controller' => 'index', 
                'action'     => 'index', 
        ));

URL for front end : http://localhost/p/phalcon/multimod/

URL for Backend Admin : http://localhost/p/phalcon/multimod/admin

By |December 12th, 2014|Technology|0 Comments

About the Author:

 Phalcon Working with Multi Modules
Kunal Pingalkar has a total experience of 9 years with expertise in PHP, Ruby on Rails, MySQL, PgSL. Currently, he is working with PHP and Ruby on Rails. He came into the industry after completing his MS in Software Systems. Apart from computers, travelling and reading about tech trends interest him.

This entry passed through the Full-Text RSS service – if this is your content and you’re reading it on someone else’s site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.
Want something else to read? How about ‘Grievous Censorship’ By The Guardian: Israel, Gaza And The Termination Of Nafeez Ahmed’s Blog

e-Zest | India | USA | UK | Germany | Europe