inc() not working

Permalink
I have used the following code to load an element:

$this->inc('elements/header.php');


But it brings up the following error:

Warning: include(/var/www/kev/concrete/themes/theme/elements/header.php): failed to open stream: No such file or directory in /var/www/kev/concrete/core/libraries/view.php on line 447 Warning: include(): Failed opening '/var/www/kev/concrete/themes/theme/elements/header.php' for inclusion (include_path='/var/www/kev/libraries/3rdparty:/var/www/kev/concrete/libraries/3rdparty:.:/usr/share/php:/usr/share/pear') in /var/www/kev/concrete/core/libraries/view.php on line 447


It's pointing to the wrong directory, I have seen people talk of this problem, and the solution being to reinstall the theme, but this hasn't worked for me despite several attempts. Unless I am missing something?

Thanks for any help

 
mnakalay replied on at Permalink Reply
mnakalay
hello,
The first obvious question is where are you calling that include from?
mattylaws replied on at Permalink Reply
I am calling it from "default.php"

I also have a view.php set up according to a tutorial that I'm not sure of the purpose, but I'm assuming that has nothing to do with my problem
mnakalay replied on at Permalink Reply
mnakalay
ok. The error says that you do not have a folder named "elements" with a file named header.php inside it. Do you have that file?

To be more precise:
at the root of your website you have a folder named themes
inside that folder you have a folder named theme
inside that folder you have your file caled default.php from which you are calling a header.php file inside a folder named elements
So next to the default.php file you must have a folder named elements
Inside that folder you must have a file named header.php

view.php is the default file that will be used by single pages such as register, or login
mattylaws replied on at Permalink Reply
I have all the files in the right place. But look at the path closely

/var/www/kev/concrete/themes/theme/elements/header.php


It's pointing to kev/concrete/themes rather than kev/themes
mnakalay replied on at Permalink Reply
mnakalay
oh wow I didn't see that at all. That's really weird. I have no idea right now, will have to think about it.
ahhaweb99 replied on at Permalink Reply
I too have this issue when trying to use an include:
Warning: include(C:\wamp\www\asap\concrete/themes/asap/shared/header.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\asap\concrete\core\libraries\view.php on line 447

I'd like to know a solution too. I'll be watching this thread. Thanks.
alenb replied on at Permalink Reply
alenb
I'm having the same issue as well, is it possible the latest build has an odd quirk in it?

Edit:

It seems it may be an old bug from one of the previous versions of Concrete5 please have a look at this forum post:http://www.concrete5.org/community/forums/themes/single-page-inc-me...

I just tried dzimney solution by setting my theme to another then switching back and it worked! I also cleared my cache (system & settings -> clear cache) just as an extra measure.

Hope this helps you guys.

Edit2:

The issue persists when you try to include new elements as well i.e. footer, etc. The easiest way to solve this is to clear your cache every time you get that error.
jagd replied on at Permalink Reply
jagd
Gosh... Weird and simple - but you saved ma a lot of time.

Thanks!!!

I creted many templates but i saw it probably 1st time in my life...
stewblack23 replied on at Permalink Reply
stewblack23
I was just having the same problem. I just used <?php include 'header.php';?> and it worked just fine.
mnsfield replied on at Permalink Reply
This worked for me, certainly a lot easier than remembering to switch themes and clearing the cache everytime to you create the inc.

Thank you :)
ShardCode replied on at Permalink Reply
ShardCode
I had same issue. go into themes. remove current theme. reinstall the theme your making. then reactivate. :)
bigsisl replied on at Permalink Reply
Persist when the directory (elements) is created when theme is already installed (concrete version 8.0.3)