Cannot get 'Loader::elements...' to work

Permalink
Hi!

I am in the process of learning to use C5 to its full and utilising the integtral core components.

The problem I am having on a website that I am developing is getting the C5 Loader command to work. On my site I have one standard 'header.php' which I then call from all the pages within my theme. When I use the standard PHP command
include 'elements/header.php;'
it works just fine. As soon as I use the C5
Loader::element('elements/header');
it tells me there is 'No such file or directory...' in 'htdocs/dev/mysite.com/concrete/core/libraries/loader.php on line 80'.

I believe I have followed the directions and have not seen anywhere that I have to declare it within the Dashboard.

Thank you in advance for your assistance.

Simon.

dclmedia
 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
If it is a theme, you should be using
$this->inc('elements/header.php');


Loader::elements is for site or package level elements.
dclmedia replied on at Permalink Reply
dclmedia
Awesome!

Thanks John
JohntheFish replied on at Permalink Reply
JohntheFish
There is pretty much everything you need to know in this howto:
http://www.concrete5.org/documentation/how-tos/designers/making-a-t...