Welcome Guest, Not a member yet? Register   Sign In
Helper - Call to undefined function
#8

(This post was last modified: 03-02-2021, 12:39 AM by Corsari.)

(03-01-2021, 02:28 AM)daveontheciforum Wrote: The URI class needs an actual URI to work with. So instead of creating one directly, you can get the current URI from the current request:


PHP Code:
// $uri = new \CodeIgniter\HTTP\URI();

$request = \Config\Services::request();

$uri $request->uri

Thank you Dave

it works! , I conceived and created my first helper !

Though as seen in the layout HTML above, I went for

PHP Code:
        $request = \Config\Services::request();
        
        $uriSegment 
$request->uri->getPath(); 

since in the navigation menu items, anybody and in any situation will use the same strings

Thank you
Reply


Messages In This Thread
Helper - Call to undefined function - by sjender - 10-16-2020, 03:09 AM
RE: Helper - Call to undefined function - by Corsari - 03-01-2021, 09:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB