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

Hello dear CI4 experts

I'm in a similar situation

I have

the content of isactive_helper.php is

PHP Code:

if ( ! function_exists('setActive')){

    function setActive($uriCheck)
        $uri = new \CodeIgniter\HTTP\URI();

        if ( $uriSegment == $uriCheck ) {

            echo "active";


I then use this helper inside a view (which is the main layout view of my app)

        24        <ul class="navbar-nav mr-auto">
        25            <li class="nav-item <?php setActive("tasks"); ?>">
        26                <a class="nav-link" href="<?= site_url("tasks") ?>">Tasks</a>
        27            </li>

but as I open the app URL, I get

Call to undefined function setActive()

and it is highlighted exactly line 25 of the view

Can you kindly hint with what's wrong?

Thank you

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 - 02-28-2021, 12:21 PM

Theme © iAndrew 2016 - Forum software by © MyBB