#1
Hi,

I tried to recreate Online shop with new trongate app. please note i am following the old videos. and i got stuck on retrieving URL String.

Code bellow:

$url_string = $this->url->segment(3);
$data['item_obj'] = $this->model->get_one_where('url_string', $url_string, 'items');


Error Message :

Fatal error: Uncaught Error: Class "url" not found in C:\xampp\htdocs\resto\engine\Dynamic_properties.php:36 Stack trace: #0 C:\xampp\htdocs\resto\modules\items\controllers\Items.php(7): Trongate->__get('url') #1 C:\xampp\htdocs\resto\engine\Core.php(303): Items->display('delicious-chick...') #2 C:\xampp\htdocs\resto\engine\Core.php(258): Core->invoke_controller_method() #3 C:\xampp\htdocs\resto\engine\Core.php(21): Core->serve_controller() #4 C:\xampp\htdocs\resto\public\index.php(5): Core->__construct() #5 {main} thrown in C:\xampp\htdocs\resto\engine\Dynamic_properties.php on line 36

Please help me on this and tell me how to use it..

Regards
Biju K Sankar
#2
Hi Biju,

It's all in the wonderful docs

https://trongate.io/docs/information/reading-values-from-the-url
#3
Hi Dafa,

Thanks for the solution. it really worked out..

Its really greatful to make me understand how segment is working in new TG app.

Regards/Biju K Sankar
#4
That is great Biju, I'm glad I managed to help you out. You may also want to consider using the second argument which will convert the 3rd segment to an intiger - it will help with security and also while it will still work without it, it is better practice to pass same types for database queries.

Also, if you could close off this thread by clicking the green button?

?