php - Which is better? Passing parameters from controller or using uri? -


i need make dynamic page : example.com/nameofbook/1 - 1 number of page.

this 2 parameters.

i know 2 ways of doing it. 1. in controller have function page($book, $page) 2. take link parameters this->uri->segment.

what should use , why , 1 safer?

anyhow when use controller 2 parameters css code doesn't load. when use 1 loads. route $route['page/(:any)/(:any)']='main/page/$1/$2'.

thanks in advance.

using $this->uri->segment same using parameters in controller.. parameters passed controller if part of uri whether have defined them in method or not.

i.e:

page() {     // array of passed arguments     $args = func_get_args(); } 

i not sure why css doesn't load 1 method on another. judging uri, route won't work.. because 'page' part not in uri, uri should example.com/page/nameofbook/1

either way 'safe' makes no difference in 2 ways suggest.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -