one parameter to index() function ;)

I've been trying to use this like urls, but i suppose it doesn't work. I'm newbie on this and i followed phpandstuff CI & Doctrine tutorial
class Home extends Controller {

    public function index() {

         $vars['categories'] = Doctrine::getTable('Category')->findAll();

        $vars['title'] = 'Home';
        $vars['content_view'] = 'forum_list';
        $vars['container_css'] = 'forums';

        $this->load->view('template', $vars);


All i need is to use urls that will provide argument to funcion index($param); The parametr which will allow me to select one row in table category. In example i go to url
that makes content is gathered from category 'waiting' that has some ID...
and like that for all categories. For not specified category, like url: localhost/ci/
This goes for example to default category...

This ...
doesn't work ;p

My answer below assumes that your base_url is "localhost/ci/".

you are trying to shorten your url by leaving out both the controller and the method.
I can give you an answer, but if your application needs more then 1 controller, it will be rather difficult to maintain.

if you are looking for a way to pass in a category, without necessarily looking to shorten your url, you can always set a default in your function parameter:
public function index( $category="books" )

and then point the other links to "localhost/ci/home/index/[category to pass in]"

If you want the other way, and are willing to take the extra work to maintain it, let me know.

[eluser]Colin Williams[/eluser]
Look at the FAQ in the Wiki

would be good if i hadn't had o use htacces for shortening and manipulating urls... I just need to query wchich will allow me to get by address etc: localhost/ci/waiting localhost/ci/accepted <- waiting and accepted are in table category and it's the column called title. And second thing, how can i get rig of home/index/blablabla and use instead /blablabla, which will defintely be better. Thank you Wink


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.