Welcome Guest, Not a member yet? Register   Sign In
Problems with routing - Missing argument 1
#1

[eluser]loathsome[/eluser]
Hello,

I have a function in the "main" controller that looks like this:

function category($cat)

When I access the url: example.com/main/category/random everything works flawlessly. Though, I'm trying to strip away the "main"-part of the page. So I set up a route that looks like this: $route['category/:any'] = 'main/category';. Now, when I go to example.com/category/random it doesn't read the uri segment ($cat) and I get
Quote:Message: Missing argument 1 for Main::category()

Filename: controllers/main.php

What am I doing wrong? Thanks!
#2

[eluser]MaDe[/eluser]
Try something like this (from the manual):

Code:
$route['product/(:num)'] = "catalog/product_lookup_by_id/$1";

Or in your case:

Code:
$route["category/(:any)"] = "main/category/$1";

Regards,
Marc
#3

[eluser]loathsome[/eluser]
Ah, thanks! That did the trick.

I actually tried that, but forgot to add brackets around the expression.

Smile




Theme © iAndrew 2016 - Forum software by © MyBB