From d815d5ada99f13aa3fa5f48a57da311254af1e4d Mon Sep 17 00:00:00 2001 From: Bruno Ribeiro Date: Sat, 22 Jul 2017 19:48:38 -0300 Subject: [PATCH] Fix passing parameter on index View I did a simple example passing a parameter to identify the pagination ID. I use : mysite.com/product/2 (It'sn works, printed 1) but just works if I using /index/ mysite.com/product/index/2 (It's works, printed 2) My ProductController.php is https://pastebin.com/aYVEqvjK With this pull request solved the problem. --- application/core/Application.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/application/core/Application.php b/application/core/Application.php index d84b3499b..fe268cf52 100644 --- a/application/core/Application.php +++ b/application/core/Application.php @@ -36,7 +36,13 @@ public function __construct() // example: if controller would be "car", then this line would translate into: $this->car = new car(); require Config::get('PATH_CONTROLLER') . $this->controller_name . '.php'; $this->controller = new $this->controller_name(); - + // check View is index and if are passing any value + if ((int) $this->action_name > 0) + { + $this->parameters[] = (int) $this->action_name; + $this->action_name = 'index'; + } + // check for method: does such a method exist in the controller ? if (method_exists($this->controller, $this->action_name)) { if (!empty($this->parameters)) {