Theme file path issue

Permalink
Hi

I've not worked with concrete5 for quite a while so may be a bit out of date but have developed several websites (self coded themes) so understand the basics of tempting - along with Html/CSS/PHP etc

I'm having a couple of issues with file paths, mainly that it seems that concrete is looking in the public_html/concrete/mytheme directory rather than the public_html/mytheme directory where the template is.

If i try to use the code below (in default.php) then I get an error indicating that the file can't be found (it is there!)
$this->inc('elements/header.php');


I'm also getting an error when I try and customise page defaults (as per the composer tutorial -http://www.concrete5.org/index.php?cID=267862)... saying that public_html/concrete/mytheme/view.php can't be found.

I've activated the theme, made sure all the file permissions are set to 755 so can't figure out what to do.

Many Thanks

 
jmonroe replied on at Permalink Reply
jmonroe
<?php
Loader::element('header_required');
?>

Additionally, for concrete5.5 and above, make sure you add the line
<?php
Loader::element('footer_required');
?>

To point to the right path, use the getThemePath syntax

<?=$this->getThemePath()?> for all image & css references

In regards to the error you're getting...your theme should reside in /public_html/themes not /public_html/concrete/themes

If my answer helps you, please remember to mark it as so.

Thanks
davjand replied on at Permalink Reply
Thanks for that.

Sorry for not being clear enough but my theme is in public_html/themes/

When I call the $this->include() function, it tries to include files from public_html/concrete/themes which is what's confusing me.

Thanks
planist1 replied on at Permalink Reply
planist1
Not sure if this will help but:
For Javascript files located in root/themes/mytheme/includes:
<script src="<?php echo $this->getThemePath();?>/includes/filename.js" type="text/javascript"></script>

For CSS files located in root/themes/mytheme/:
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('filename.css');?>" />

For Images located in root/themes/mytheme/images/:
<img src="<?php print $this->getThemePath(); ?>/images/filename.jpg" width="desiredwidth" height="desiredheight" alt="desiredalttag" />


For header.php file located in root/themes/elements:
Must have
<?php 
defined('C5_EXECUTE') or die(_("Access Denied."));
$this->inc('elements/header.php');
?>


For footer.php file located in root/themes/elements:
Must have
<?php 
defined('C5_EXECUTE') or die(_("Access Denied."));
?>


Here is a great tutorial on themes and proper coding of them:
http://www.concrete5.org/documentation/how-tos/designers/making-a-t...

Also, if your concrete installation is in the root directory of your site, it might benefit to put the following in the root/config/site.php file:
define('DIR_REL', '');


Hope this helps.
davjand replied on at Permalink Reply
Hi

Thanks alot for the input. In the end I uninstalled the theme completely and re-installed/ re-activated etc and everything seems to be working now!

Thanks anyway
CWSpear replied on at Permalink Reply
CWSpear
I had the same problem as you. I have installed dozens and dozens of themes. I wonder if it is just a glitch in the recent version? It was able to get some resources (via $this->inc()) in the correct folder, but other resources ($this->getThemePath()), it seemed to try and get from /concrete/themes.

I did what you did, uninstalled and reinstalled, and then everything was okay.
mkly replied on at Permalink Reply
mkly
I would try disabling and clearing your Overrides Cache as well.

Best Wishes,
Mike
tomicio replied on at Permalink Reply
tomicio
Thanks, worked here too.

I had the same problem with a fresh install v5.6.0.2. Not my first C5 theme. Always follow the same steps:

1) create theme in default.php
2) cut default.php into includes (eg. header.php and footer.php)
3) put includes in "/theme/my_theme/inc" folder
4) adjust default.php to point to includes eg.:
<?php $this->inc('inc/footer.php'); ?>


After step 4, I had the following error:
Warning: include(/home/tommy/dev/my_site/www/concrete/themes/my_site/inc/header.php): failed to open stream: No such file or directory in /home/tommy/dev/my_site/www/concrete/core/libraries/view.php on line 419 Warning: include(): Failed opening '/home/tommy/dev/my_site/www/concrete/themes/my_site/inc/header.php' for inclusion (include_path='/home/tommy/dev/my_site/www/libraries/3rdparty:/home/tommy/dev/my_site/www/concrete/libraries/3rdparty:.:/usr/share/php:/usr/share/pear') in /home/tommy/dev/my_site/www/concrete/core/libraries/view.php on line 419


I rolled back my default.php, I removed and re-install the theme, put includes back in default.php, and it worked.
seenelf replied on at Permalink Reply
seenelf
uninstall and reinstall the theme works for me too
iLP replied on at Permalink Reply
iLP
Confirmed the same problem this morning regarding use of:

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


under:

# concrete5 Version
5.6.1.2
# Server Software
Apache/2.4.4 (Win64) PHP/5.4.12
# Server API
apache2handler
# PHP Version
5.4.12
gsullins replied on at Permalink Reply
gsullins
i had the same issue. uninstall/reinstall worked for me to. system:
C5: 5.6.1.2
PHP Version 5.4.6-1ubuntu1.3
Apache/2.2.22 (Ubuntu)
tduncandesign replied on at Permalink Reply
tduncandesign
This issue got me today. Removing/re-installing theme did no good, I even re-installed from a fresh copy of C5 v5.6.1.2.

Apparently I STILL don't know how to build a theme, as I left out "default.php" and had "index.php" in there instead... d'oh! Once I changed that to default.php, bueno!

See this thread:
http://www.concrete5.org/index.php?cID=413099...
wstagl replied on at Permalink Reply
I also ran into this problem with some installations after upgrading to 5.6.2.1. It tries to lookup for the elements (mostly header.php and footer.php) inside the concrete/themes folder instead of the correct directory /themes/my_whatever_theme

All Systems were fine after clearing the whole cache.

So before you install or de-install try removing all files from your "files/cache"-Folder

br Wolfgang