Header/Footer 'copies' generate error

Permalink
Hello
This is an odd one that I never ran into before. Been using C5 for years and this is my first post as I am stumped.

I have the following structure in /elements:

/elements/header.php
/elements/header2.php
/elements/footer.php

The only difference between header and header2 is that there is a different class on a <div> ( <div class="wrapper"> and <div class="wrapper2"> ). This is for a change in background position between templates.

if I use the following code in my page, I have no problems:
<?php $this->inc('elements/header.php'); ?>


when I change this code to the following
<?php $this->inc('elements/header2.php'); ?>


I get:
Warning: include(/Applications/MAMP/htdocs/triad-c5/concrete/themes/responsive/elements/header2.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/triad-c5/concrete/core/libraries/view.php on line 484

Warning: include(): Failed opening '/Applications/MAMP/htdocs/triad-c5/concrete/themes/responsive/elements/header2.php' for inclusion (include_path='/Applications/MAMP/htdocs/triad-c5/libraries/3rdparty:/Applications/MAMP/htdocs/triad-c5/concrete/libraries/3rdparty:.:/Applications/MAMP/bin/php/php5.5.3/lib/php') in /Applications/MAMP/htdocs/triad-c5/concrete/core/libraries/view.php on line 484

Yes, header2.php IS in the /elements/ directory. It's almost like C5 doesn't like ANY file that isn't named either header.php or footer.php (tested this w/ footer2.php and returned the same Warning.

Anyone have any ideas?

 
drbiskit replied on at Permalink Reply
drbiskit
You should be fine naming the include files whatever you want them to be. I use all sorts all the time.

Just try clearing your cache, that should help kick things back in to touch.

** EDIT **

Just as an aside - Looking at your reasoning for doing this - rather than having 2 seperate header files to maintain - you may be better off adding some classes to your 'body' tag that you can use in your CSS to solve this issue.

There are loads that you can use for this, and they are so useful - A quick example would be:
<body class="<?php echo $c->getCollectionHandle() ?> <?php echo $c->getCollectionTypeHandle() ?>">


This adds your page handle, and page type handle as classes to the body tag, which you can then call in your CSS to add page/page type specific styles. eg:
body.home div.wrapper {
background-position: 50px 50px;
}

Hope that helps!