Can't separate page into header.php, default.php and footer.php

Permalink
Hi everybody, this is a bit strange. Started a new site, brought it into c5 as single page default.php and it worked fine (first site built using v5.6). Chopped the header and footer off and put into /elements. I made sure that I used the correct code to call the header & footer (compared to an existing site) but I'm getting an error. The page displays only the middle part with no CSS formatting and the header and footer have the following error:
Warning: include(/Applications/MAMP/htdocs/sitename/concrete/themes/sitename/elements/header.php) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/sitename/concrete/core/libraries/view.php on line 418

Warning: include() [function.include]: Failed opening '/Applications/MAMP/htdocs/sitename/concrete/themes/sitename/elements/header.php' for inclusion (include_path='/Applications/MAMP/htdocs/sitename/libraries/3rdparty:/Applications/MAMP/htdocs/sitename/concrete/libraries/3rdparty:.:/Applications/MAMP/bin/php5.3/lib/php') in /Applications/MAMP/htdocs/sitename/concrete/core/libraries/view.php on line 418

I'm now totally stuck and can't do a thing. Any help extremely, extremely welcome.
JP

 
mckoenig replied on at Permalink Reply
mckoenig
Is the name of your theme "sitename"? If not, your include path is wrong.
DanK replied on at Permalink Reply
Thanks for replying. I changed the name of the actual site name to "sitename" for privacy reasons as the name is quite unique and the client might find this link when he googles it!
jmonroe replied on at Permalink Reply
jmonroe
Try removing this portion of the path

/Applications/MAMP/htdocs

And see what happens.
DanK replied on at Permalink Reply
Thanks J, I don't know how I would do that as that's where all of my concrete5 sites reside. Could you possibly explain? Thanks anyway.
JP
jmonroe replied on at Permalink Reply
jmonroe
I was referring to removing that section of the path in your coding where you are referencing the header and footer.
mckoenig replied on at Permalink Reply
mckoenig
Could you double-check if your header.php and footer.php REALLY are in concrete/themes/sitename/elements/? Because the path per se seems to be right as your C5 installation is able to read concrete/core/libraries/view.php

Second question: Are you including like this?

<?php 
defined('C5_EXECUTE') or die("Access Denied.");
$this->inc('elements/header.php'); ?>
DanK replied on at Permalink Reply
They are in exactly gnat location and I have included the correct scripts to reference the different parts. I'm totally stumped. Has anything changed in this regard with v5.6?

Thanks again for your help.
JP
mckoenig replied on at Permalink Reply
mckoenig
I'm pretty much out of ideas. Have you tried uploading it to a server, just to see if this has anything to do with your local MAMP installation?

Have you checked your config/site.php? Are BASE_URL and DIR_REL set? If not, maybe you could try doing so.

Still I'm stumped as the error message seems to show a correct directory…
jordanlev replied on at Permalink Best Answer Reply
jordanlev
Try disabling the overrides cache in the dashboard (type "cache" into intelligent search box to get to that dashboard page). There was a bug in 5.6.0 that caused some of my blocks to look for files in the concrete directory instead of the theme or package directory.

(The path in your error shows that it's looking in the /concrete/ directory, but I'm assuming your theme is in the /themes/ directory instead).

-Jordan
DanK replied on at Permalink Reply
Jordan yet again you've got me out of the brown stuff. Huge, huge thanks, that worked a treat. Thanks also to mckoenig and jmonroe for your kind help. It's very much appreciated.
JP
GeoDes replied on at Permalink Reply
I had the same problem exactly and solved it using basic include command, that seems to work all the time:

<?php defined('C5_EXECUTE') or die("Access Denied.");
include('elements/header.php'); ?>

However I don't know if it is recommended.
I would certainly like to hear an answer from a developer if it is a good practice.

Thank you for this post !
jordanlev replied on at Permalink Reply
jordanlev
Go for it -- nothing bad will happen ($this->inc() doesn't provide that much extra functionality -- only matters in certain esoteric situations that I can't even think of right now).
MarkPrima replied on at Permalink Reply
This post was SO HELPFUL!!!!
Thanks everyone
ideagonal replied on at Permalink Reply
Thank you! Same problem, same solution