AutoNav Custom Template Installation HELP Meh! plz ^_^
Permalink/packages/YOUR_PACKAGE_HANDLE/images/
And in the code you can reach it like this:
$pkg = Package::getByHandle('YOUR_PACKAGE_HANDLE'); $imgdir = $pkg->getRelativePath() . '/' . DIRNAME_IMAGES;
1. Have a custom template that can be installed independently of the theme for users who just want the menu so I would need the images to I guess be in the /packages folder for the autonav block.
2. For the theme installation install the custom template that is auto detected but also be able to make sure the images load from the directory inside /blocks this way it's not attached to the theme in any way if that makes sense.
I assumed you are familiar with the packages concept but if not, here's a good page to read:
http://www.concrete5.org/documentation/how-tos/designers/packaging-...
In your situation, I understood that you want to build a theme that includes a custom template and you want people to install those automatically, right? Probably also want to sell it in the marketplace?
If I'm correct, you should include all in a single package you build:
/packages/your_package_handle/blocks/autonav/templates/your_template.php /packages/your_package_handle/images/ <-- All the images you want to include in the theme/custom templates within this theme /packages/your_package_handle/themes/your_theme/ <-- All your theme files
Instead of .../templates/your_template.php, put the template file here:
/packages/YOUR_PACKAGE_HANDLE/blocks/autonav/templates/your_template/view.php
Then, inside that "your_template" directory put any supporting files (view.css, images directory, javascript, whatever). The only annoying part of this is that C5 doesn't provide a way (that I could tell) to consistently give you the directory that the template exists in. So I put this at the top of my template files:
$imgPath = DIR_REL . '/packages/YOUR_PACKAGE_HANDLE/blocks/autonav/templates/your_template/images';
Then all the img src's would be:
<img src="<?php echo $imgPath; ?>/something.jpg" />
...So when you move it outside of this package you have to remember to change that $imgPath thing at the top of the file, but other than that everything is clean and stays in one directory.
http://www.concrete5.org/developers/bugs/5-5-2/blockviewtemplateget...
Antti / Mainio