Welcome Guest, Not a member yet? Register   Sign In
Reserve addresses routes
#1

(This post was last modified: 06-26-2018, 03:14 AM by Nome.)

I'm using code modules, and when i need a module in another module, use "use modules\name\controller-or-model" ...

When need to specify a path for each of them, i create a separate Routes.php inside each module...

But how do specify the default module? When i write on the site https: //example.com/about-how-i-spent-the-summer

I indicate in the application/Config/Routes.php
Code:
$routes->setDefaultController('Article');
$routes->setDefaultMethod('getArticle/$1');

When it does not find any of the existing modules, it accesses the default module. But this does not happen.
 
How to set the default value correctly? 
Or specify a list of reserved addresses? 
Or do you specify the path in the controller in cases and if the article is not found?

Same in the subject of routes, i want to ask how to remove the index.php when sending a form?
Example: 
Code:
echo form_open('controller/method',array('...'));
...

http: //example.com/index.php/controller/method
In other cases, there is no index.php (because it is removed by the .htaccess).

P.s

Also specified the default controller and method in the modules/default_module/config/Routes.php , but this, for some reason, did not work either...
Reply
#2

Sounds like to me that you need a modules controller in the main app.

But also remember that everything now is Namespaces.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(06-26-2018, 04:52 AM)InsiteFX Wrote: Sounds like to me that you need a modules controller in the main app.

But also remember that everything now is Namespaces.

Create a module in the main application to assemble all parts using the "use" command, building the application logic?
And after have defined the route for it as the default? 
If so, how will the routes that lie inside each module go?
And what do you mean by the common namespace?

It's interesting, thanks..!
Reply
#4

Use a route group that should help you.

If the route cannot resolve the path then adding the namespace will tell it where to look.

SEEThe CodeIgniter 4 Users Guide - Grouping Routes
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(This post was last modified: 07-07-2018, 02:26 PM by Nome.)

(06-27-2018, 03:47 AM)InsiteFX Wrote: Use a route group that should help you.

If the route cannot resolve the path then adding the namespace will tell it where to look.

SEEThe CodeIgniter 4 Users Guide - Grouping Routes

The groups proved to be a very convenient solution (I also used them earlier). However, a new dilemma arose ...

Nodes use:
example.com/address1

The other service routes begin with the word "node"

Taxonomy received similar routes:
example.com/address 2

And service routes, begin with the "taxonomy"...

for this I created a table of routes, where alias = nid(node_id) or tid(term_id) for check is busy of the route when adding a new one.

But now I do not know what to do with categories, for example if I want to create breadcrumbs..? 

example.com/address2/address3 

That routes from Routes.php did not intersect.

Tell me how to do it, thanks!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB