Theme file path issue
PermalinkI'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
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
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
For footer.php file located in root/themes/elements:
Must have
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.
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
I did what you did, uninstalled and reinstalled, and then everything was okay.
Best Wishes,
Mike
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.
$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
C5: 5.6.1.2
PHP Version 5.4.6-1ubuntu1.3
Apache/2.2.22 (Ubuntu)
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...
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
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