2

How do libraries work in 5.7? I am trying to utilize a custom library for use on a single page.

I have created the single page view and controller. I am able to access the controller from the view.

I also created a library in application/libraries/ called lobbreeldashboard.php.

In my controller I have Loader::library('lobbyreeldashboard'); Inside of the library there is only one function right now called sayHello()

In my controller I make a call to the function using: sayHello();. However, I receive the following error Call to undefined function sayHello(). What am I missing to make this work in 5.7?

single_pages/stats.php

<?php

defined('C5_EXECUTE') or die("Access Denied.");
$abc = new StatsController();
$abc->view();

controller/stats.php

<?php

defined('C5_EXECUTE') or die("Access Denied.");
Loader::library('lobbyreeldashboard');

class StatsController extends Controller {
    public function view() {
        $bob = sayHello();
    }
}

libraries/library.php

<?php
defined('C5_EXECUTE') or die("Access Denied.");

function sayHello() {
    return 'hello';
}
Sebsemillia
  • 9,366
  • 2
  • 55
  • 70
WhoaItsAFactorial
  • 3,538
  • 4
  • 28
  • 45

1 Answers1

0

First thing is in the example you have "lobbyreeldashboard" being loaded, but your file is called library.php? If that's not the problem, we can go from there, but figured I'd go with the obvious first.

coupdecoop
  • 150
  • 1
  • 8