Welcome Guest, Not a member yet? Register   Sign In
Function not working
#1

[eluser]phalkan[/eluser]
Hi
I followed the video tutorial and set up a CI site. When I use the link to the next function, www.mysite.com/index.php/blog/comments/ it does not run the comments function function comments()
{
echo 'testing...';
}

It runs the default function index().

I have set up route default to the blog controller.

Any help would be appreciated.

Thanks
#2

[eluser]David Cassidy[/eluser]
It may be of some help if you include the contents of your Controller and your routes.php file. It sounds like your route may be overriding your page requests. It is hard to tell however, with so little to go on.
#3

[eluser]phalkan[/eluser]
Here is my products controller
<?php

class Products extends Controller {

function Products()
{
parent::Controller();

$this->load->helper('url');
$this->load->helper('form');

}

function index()
{

$this->load->model('categorymodel','', TRUE);
$data['categories']=$this->categorymodel->getCategories();
$this->load->view('category_view',$data);

}

function getCategory()
{
echo 'category testing...';

}

this is what I have set up in my routes page $route['default_controller'] = "products";

When I click on a link it puts in the url http://localhost/mysite/index.php/products/getCategory which is supposed to run the getCategory() function in the products controller and echo "category testing...", it does not.
Any idea why not?

Thanks for any help.
#4

[eluser]phalkan[/eluser]
I found my problem. my URI PROTOCOL
$config['uri_protocol'] = "AUTO";
Was commented out. I un-commented and it works.

Sorry if any one was thinking about this much.

And thanks Dave_C for responding.




Theme © iAndrew 2016 - Forum software by © MyBB