Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 3.1.0 with XHMVC
#11

(This post was last modified: 02-15-2016, 05:10 AM by XMadMax.)

(02-15-2016, 03:56 AM)nguyenanhnhan Wrote: Hello XMadMax,
How to config default route ?
Ex:
http://mydomain.com -> http://mydomain.com/apps/mytest/www

One thing is 'Default route', another is 'document_root'.

default route is configured in routes.php, in the application, defaults to :
$route['default_controller'] = 'welcome';

If you want to change your document_root, edit the apache conf for this domain (mydomain):
Code:
<VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs/mydomain/apps/mytest/www"
      ServerName mydomain.com
      ServerAlias www.mydomain.com
    <Directory "C:/xampp/htdocs/mydomain/apps/mytest/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted # this line, only for apache >= 2.4
     </Directory>
</VirtualHost>
Reply
#12

(02-15-2016, 04:28 AM)XMadMax Wrote:
(02-15-2016, 03:56 AM)nguyenanhnhan Wrote: Hello XMadMax,
How to config default route ?
Ex:
http://mydomain.com -> http://mydomain.com/apps/mytest/www

One thing is 'Default route', another is 'document_root'.

default route is configured in routes.php, in the application, defaults to :
$route['default_controller'] = 'welcome';

If you want to change your document_root, edit the apache conf for this domain (mydomain):
Code:
<VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs/mydomain/apps/mytest/www"
      ServerName mydomain.com
      ServerAlias www.mydomain.com
   <Directory "C:/xampp/htdocs/mydomain/apps/mytest/www">
       Options Indexes FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
       Require all granted # this line, only for apache >= 2.4
    </Directory>
</VirtualHost>
Hello XMadMax,
default route with:
- MVC: $route['default_controller'] = [controller/method]
- HMVC: $route['default_controller'] = [module/controller/method]
- So XHMVC : ??

I do not want the URL is too long when first visit website.

Ex: http://xhmvc.4amics.com/applications/dem...ser_guide/ instead of http//xhmvc.4amics.com
Reply
#13

(02-15-2016, 07:31 AM)nguyenanhnhan Wrote:
(02-15-2016, 04:28 AM)XMadMax Wrote:
(02-15-2016, 03:56 AM)nguyenanhnhan Wrote: Hello XMadMax,
How to config default route ?
Ex:
http://mydomain.com -> http://mydomain.com/apps/mytest/www

One thing is 'Default route', another is 'document_root'.

default route is configured in routes.php, in the application, defaults to :
$route['default_controller'] = 'welcome';

If you want to change your document_root, edit the apache conf for this domain (mydomain):
Code:
<VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs/mydomain/apps/mytest/www"
      ServerName mydomain.com
      ServerAlias www.mydomain.com
   <Directory "C:/xampp/htdocs/mydomain/apps/mytest/www">
       Options Indexes FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
       Require all granted # this line, only for apache >= 2.4
    </Directory>
</VirtualHost>
Hello XMadMax,
default route with:
- MVC: $route['default_controller'] = [controller/method]
- HMVC: $route['default_controller'] = [module/controller/method]
- So XHMVC : ??

I do not want the URL is too long when first visit website.

Ex: http://xhmvc.4amics.com/applications/dem...ser_guide/ instead of http//xhmvc.4amics.com

Hi,

Same as HMVC, if you type 'home', CI will try to find /modules/home/home.php, and a 'index' method

If you type home/mainpage, CI will try to find modules/home/mainpage.php with a 'index' method

The default_controller must to reside under apps/mytest/application/modules.
There is no reason (I think) to have a common module as a 'default'

Any other call, the XHMVC tries to load the same name under /common/core/modules.
Reply
#14

(This post was last modified: 02-18-2016, 02:42 AM by XMadMax.)

Helo,

From yesterday, XHMVC for Codeigniter 3.0 is ready to be installed from composer.
Also, has been solved some problems, thanks to Vivers for testing.


Install:

Create a directory in your htdocs path, ex: c:/xampp/htdocs/codeigniter-3-xhmvc

Edit a new composer.json:
Code:
{
    "require": {
           "xmadmax/codeigniter-3-xhmvc": "@dev"
    }
}


Use:   composer install

Added HMVC examples to the Welcome module:

Browse to:
http://localhost/codeigniter-3-xhmvc/ven...ww/welcome

Or: (default_controller)
http://localhost/codeigniter-3-xhmvc/ven.../base/www/


Added some XHMVC examples:

/apps/base/appication/modules/welcome/config
/apps/base/appication/modules/welcome/controllers
/apps/base/appication/modules/welcome/helpers
/apps/base/appication/modules/welcome/libraries
/apps/base/appication/modules/welcome/models
/apps/base/appication/modules/welcome/views

A welcome 'common' module is available for testing, try to delete any of the folders of apps...welcome to see how common file is loaded if not found in apps.

When a apps...welcome part is deleted, remember to try with (because there aren't default_controller in common):
http://localhost/codeigniter-3-xhmvc/ven.../base/www/welcome
Reply
#15

(This post was last modified: 03-14-2016, 08:32 AM by XMadMax.)

Default route must to be configured same as CI, in routes.conf:

PHP Code:
$route['default_controller'] = 'test';
// This default route will load /apps/[myapp]/application/modules/test/controllers/Test.php => index 

There is no way to load default route from core/modules.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB