Welcome Guest, Not a member yet? Register   Sign In
Can't use costum library
#1
Sad 
(This post was last modified: 10-06-2020, 09:30 AM by SimonsCode22.)

Hello,
I'm a newbie to this framework and I wanted to create a simple library and load it into a Controller.

I created a library called "GmodServerAction.php" in "Libraries":
PHP Code:
<?php
namespace App\Libraries\GmodServerAction;

class 
GmodServerAction {
    public function __construct()
    {

        
    
}


Now I'm loading it in my Home-Controller:

PHP Code:
<?php namespace App\Controllers;
use 
App\Libraries\GmodServerAction\GmodServerAction;

class 
Home extends BaseShopController
{
    public function 
index()
    {

        $test = new GmodServerAction();

    
        $this
->render("home"$assign);
    }


When I'm trying to open the Homepage it just says:

Class 'App\Libraries\GmodServerAction\GmodServerAction' not found

Any idea? (Btw I'm using XAMPP)
Reply
#2

namespace = path
So change to:
namespace App\Libraries;

Learning CI4 from my works, from errors and how to fix bugs in the community

Love CI & Thanks CI Teams

Reply
#3

(10-06-2020, 10:46 PM)nc03061981 Wrote: namespace = path
So change to:
namespace App\Libraries;

Thank you very much Big Grin
Reply




Theme © iAndrew 2016 - Forum software by © MyBB