Problems with element folder

Permalink 1 user found helpful
I converting a theme to concrete5 on my local dev right now. I created an elements folder and put this code at the top of my page
<?php $this->inc('elements/header.php'); ?>
then the same one but for footer on the bottom. I then created the header and footer.php files and saved them in the elements folder. When I refreshed my page this is what came up for the header

Warning: include(C:\xampp\htdocs\concrete\concrete/themes/testtheme/elements/header.php): failed to open stream: No such file or directory in C:\xampp\htdocs\concrete\concrete\core\libraries\view.php on line 419
Warning: include(): Failed opening 'C:\xampp\htdocs\concrete\concrete/themes/testtheme/elements/header.php' for inclusion (include_path='C:/xampp/htdocs/concrete/libraries/3rdparty;C:\xampp\htdocs\concrete\concrete/libraries/3rdparty;.;C:\xampp\php\PEAR') in C:\xampp\htdocs\concrete\concrete\core\libraries\view.php on line 419


and this for the footer
Warning: include(C:\xampp\htdocs\concrete\concrete/themes/testtheme/elements/footer.php): failed to open stream: No such file or directory in C:\xampp\htdocs\concrete\concrete\core\libraries\view.php on line 419
Warning: include(): Failed opening 'C:\xampp\htdocs\concrete\concrete/themes/testtheme/elements/footer.php' for inclusion (include_path='C:/xampp/htdocs/concrete/libraries/3rdparty;C:\xampp\htdocs\concrete\concrete/libraries/3rdparty;.;C:\xampp\php\PEAR') in C:\xampp\htdocs\concrete\concrete\core\libraries\view.php on line 419


why cant it find the header and footer files, why is it looking in this paths? any help is much appreciated

(i attached a picture for a visual)
|
|
|
V

1 Attachment

sambrody24
 
mkly replied on at Permalink Reply
mkly
Hello,
I'm wondering if you are confusing the common convention of an "elements" directory in a concrete5 theme with the root /elements folder in a concrete5 installation.

Many themes make use of an "elements" folder for code reuse so that they do not have to retype(or copy paste) the header and footer code into every page type of the theme.

So you would create a theme with a directory structure like

/themes/
---/testtheme/
------/elements/
----------/header.php
----------/footer.php
------/default.php
------/view.php
------/sidebar.php
------/full.php

Then you would include those elements in your various page type with
$this->inc('elements/header.php');

The use of "elements" is arbitrary and could be something like "partials", "includes" and included like
$this->inc('partials/header.php');


On the other hand there are Elements.
In this case you would place a file in the /elements/ directory like this
/elements/report_results.php
and include that with
Loader::element('report_results');


The inc() version is typically for themes, whereas the Loader::element() version is typically for single pages, like if you were developing an dashboard interface for something.

Best Wishes,
Mike
drbiskit replied on at Permalink Reply
drbiskit
Just had this problem myself + Looks like a bug with the latest version. I've never come across it before in any previous versions, but it seems it has been around for a little while... More here:
http://www.concrete5.org/community/forums/themes/theme-file-path-is...

Anyway, the way to get around it, is to uninstall your theme, and then re-install it. This fixed the issue for me.
webdewd replied on at Permalink Reply
webdewd
Your method worked for me drbiskit. Many thanks. Last time it happened I reinstalled concrete5 from scratch. At least I know it's not me now and it is a bug.
webdewd replied on at Permalink Reply
webdewd
Please note this is still a bug in 5.6.1.2. How should bugs be reported? Work around as above is to reinstall the theme.
drbiskit replied on at Permalink Reply
drbiskit
webdewd replied on at Permalink Reply
webdewd
chameleondesign replied on at Permalink Reply
chameleondesign
not even uninstalling and reinstalling themes works for me....