5.5 - Put all templates (block templates, single pages) in one directory
Permalink
Hi There,
Is there a simple way to have your single pages (login, profile, cart, checkout etc) and block templates in the one directory?
This would simplify the installation of our base-theme a lot.
We've tried placing templates and directories into the theme folder and using site_theme_paths.php but this seems to render c5's default layout into view.php.
But a lot of our single pages use more sophisticated layouts (and the core_commerce ones have a lot of other associated files) - which means they only work in the single pages directory.
Hopefully that makes sense - any help would be much appreciated.
Cheers
Ben
Is there a simple way to have your single pages (login, profile, cart, checkout etc) and block templates in the one directory?
This would simplify the installation of our base-theme a lot.
We've tried placing templates and directories into the theme folder and using site_theme_paths.php but this seems to render c5's default layout into view.php.
But a lot of our single pages use more sophisticated layouts (and the core_commerce ones have a lot of other associated files) - which means they only work in the single pages directory.
Hopefully that makes sense - any help would be much appreciated.
Cheers
Ben
Thanks for that - any tips for putting together a package if you're a designer?
Will give it a go anyway!
Will give it a go anyway!
You need to be able to do a little bit of PHP to take advantage of this.
When you put files into the override directories (SITE_ROOT/themes, SITE_ROOT/single_pages, etc.) Concrete5 just finds them magically. However concrete will not look into package directories unless explicitly directed.
The way things are loaded is not uniform. There are basically two ways:
1) For things that have a Loader, like elements, or libraries or models, you need to modify your code to pass in a reference to which package to look into. See this for a complete example:http://www.concrete5.org/api/Core/Loader.html...
Example:
2) Other things that are directly invoked by the core, like single pages, page types, and blocks, have to be explicitly installed by the package during the install() routine. For example, you might use:
In general, if C5 can't find your thing, it's because you didn't install it, or you are loading it from Core and not from your package.
When you put files into the override directories (SITE_ROOT/themes, SITE_ROOT/single_pages, etc.) Concrete5 just finds them magically. However concrete will not look into package directories unless explicitly directed.
The way things are loaded is not uniform. There are basically two ways:
1) For things that have a Loader, like elements, or libraries or models, you need to modify your code to pass in a reference to which package to look into. See this for a complete example:http://www.concrete5.org/api/Core/Loader.html...
Example:
<?php Loader::element('my_awesome_packaged_up_element'); // FAIL ?> <?php Loader::packageElement('my_awesome_packaged_up_element', 'awesome_pack'); // Cool element, bro ?>
2) Other things that are directly invoked by the core, like single pages, page types, and blocks, have to be explicitly installed by the package during the install() routine. For example, you might use:
public function install() { $pkg = parent::install(); BlockType::installBlockTypeFromPackage('hello_world', $pkg); PageTheme::add('theme_booya', $pkg); CollectionType::add($data, $pkg);}; }
In general, if C5 can't find your thing, it's because you didn't install it, or you are loading it from Core and not from your package.
Awesome - thank you so much for the info!
Will give this a go later today.
Cheers
Ben
Will give this a go later today.
Cheers
Ben
http://www.concrete5.org/documentation/developers/system/packages/...