CodeIgniter Forums
Need help getting the current page id from the url - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Need help getting the current page id from the url (/thread-60126.html)



Need help getting the current page id from the url - El Forum - 01-20-2014

[eluser]Unknown[/eluser]
So what iam trying to do is make it to were i click on my category i want to go into. on that page there are titles from that category. now iam making it to were i can create new topics inside the category but what i need help with is inserting that topic into the septic category_id in the data base that i would get from the URL. i really cant find out how to do this what so ever.

if some one could post maby a sample code or any help possible would be great if you guys need any thing from me to post on here to better explain this let me know.


Need help getting the current page id from the url - El Forum - 01-20-2014

[eluser]CroNiX[/eluser]
http://yoursite.com/your_controller/your_method/id/something_else

Code:
class Your_controller extends CI_Controller {

  public function your_method()
  {
    $id = $this->uri->segment(3);
    $something_else = $this->uri->segment(4);
  }
}
http://ellislab.com/codeigniter/user-guide/libraries/uri.html


Need help getting the current page id from the url - El Forum - 01-20-2014

[eluser]Unknown[/eluser]
Thanks for showing me that that is exactly what i wanted to know how to do