Hard-code the default custom template for a block?
Permalink
Hi!
I'm using a modified version of Jordan Lev's awesome "Designer Gallery" block and I'm trying to figure out if what I want to do is even possible.
I want some way to have an editable instance of the block included on a specific page type... AND I want the block to always (and only) use my modified "Gallerific" custom template.
To get the block onto every instance of the "Press Room" page type, I tried adding the block as a Default for the page type... but I can't without also selecting a File Set (this block only requires the input of a file set of images). And I don't want every page generated from this page type to always have the same File Set used... it needs to be customized on a per-page basis.
I had also hoped that I could pre-select the "Custom Template" for the block after adding it as a Default to the Page Type... but, alas, no luck... since I can't save the Page Type without first selecting a File Set for the block! ARRRRGGGGGH! :O LOL!
I could live with the client having to know to add the block into the area when they create a new page... but I would rather NOT have to have them also select the custom template. How can I make my modified "Gallerific" template the default? I tried editing the view.php and replacing the code there with what was in my custom "press_room.php" file... but that didn't work (can you just smell the noob-ness here?!?!)
Thanks!
I'm using a modified version of Jordan Lev's awesome "Designer Gallery" block and I'm trying to figure out if what I want to do is even possible.
I want some way to have an editable instance of the block included on a specific page type... AND I want the block to always (and only) use my modified "Gallerific" custom template.
To get the block onto every instance of the "Press Room" page type, I tried adding the block as a Default for the page type... but I can't without also selecting a File Set (this block only requires the input of a file set of images). And I don't want every page generated from this page type to always have the same File Set used... it needs to be customized on a per-page basis.
I had also hoped that I could pre-select the "Custom Template" for the block after adding it as a Default to the Page Type... but, alas, no luck... since I can't save the Page Type without first selecting a File Set for the block! ARRRRGGGGGH! :O LOL!
I could live with the client having to know to add the block into the area when they create a new page... but I would rather NOT have to have them also select the custom template. How can I make my modified "Gallerific" template the default? I tried editing the view.php and replacing the code there with what was in my custom "press_room.php" file... but that didn't work (can you just smell the noob-ness here?!?!)
Thanks!
DOH! Totally missed the README up on Github... and just a quick scan of it and now I see I could have saved you the trouble, just by paying attention. My bad! :(
Thanks for such an immediate response! I'm digging in right now to see about getting my "custom" template written in as the default... looks like it shouldn't be a problem (by following the README, LOL!).
I really appreciate the help!
- John
Thanks for such an immediate response! I'm digging in right now to see about getting my "custom" template written in as the default... looks like it shouldn't be a problem (by following the README, LOL!).
I really appreciate the help!
- John
OK. A little bit of knowledge is dangerous... MY amount of knowledge is completely safe. ;D
I've got the new block coded up and working perfectly (THANKS!). Now... I want to be able to print out the name of the File Set in the display of the gallery code generated by the view.php... but for the life of me can't figure out how to access it from there.
Anyone have any ideas?
Sorry to be a PITA!
- John
I've got the new block coded up and working perfectly (THANKS!). Now... I want to be able to print out the name of the File Set in the display of the gallery code generated by the view.php... but for the life of me can't figure out how to access it from there.
Anyone have any ideas?
Sorry to be a PITA!
- John
No need to apologize -- this is what the forums are for :)
I think this code should do it:
If that doesn't work, try adding this to the controller's view() method:
I think this code should do it:
<?php Loader::model('file_set'); $fs = FileSet::getByID($fsID); echo $fs->getFileSetName(); ?>
If that doesn't work, try adding this to the controller's view() method:
$this->set('fsID', $this->fsID);
Tell that to my Roman-Catholic mother... growing up in our house, "Guilt" was considered a sacrament! LOL! Guess old habits die hard.
And, dude... you really do rock! That first snippet of code did the trick!
Can't thank you enough!
- John
And, dude... you really do rock! That first snippet of code did the trick!
Can't thank you enough!
- John
OK... so if you (or anyone else) is still with me...
How do most people handle issues surrounding uploading large images into the File Manager (i.e. right of modern digital cameras)?
Right now... if I test by uploading a large image (about 3,000 pixels by 2,000 pixels) and adding it to the File Set being used by the "Designer Gallery" block I'm using, the page barfs and doesn't load. If I use the File Manager's editing tools and re-size it down to a more manageable size (say 800 x 600), everything works great.
So... do you usually just train your clients to use the Piknik editing tools (or other offline tools) to resize their images before adding them to a Gallery file set?
Or is there a way to more gracefully handle it in the code for the gallery?
Thanks!
How do most people handle issues surrounding uploading large images into the File Manager (i.e. right of modern digital cameras)?
Right now... if I test by uploading a large image (about 3,000 pixels by 2,000 pixels) and adding it to the File Set being used by the "Designer Gallery" block I'm using, the page barfs and doesn't load. If I use the File Manager's editing tools and re-size it down to a more manageable size (say 800 x 600), everything works great.
So... do you usually just train your clients to use the Piknik editing tools (or other offline tools) to resize their images before adding them to a Gallery file set?
Or is there a way to more gracefully handle it in the code for the gallery?
Thanks!
https://github.com/jordanlev/c5_designer_gallery...
The intention of the block is to not actually have custom templates, but instead to choose or develop the template you want and move that into the default view (and then get rid of all the other custom templates) so your user never has to choose a template. If you haven't done so already, you should take a careful and thorough read through the README that's on the page I linked to above (scroll down a little bit to see it) -- it explains the process of doing this. Specifically step #6 under "Customization Steps".
As for the default file set, I see how that could be a problem. You can either remove the fileset requirement by deleting the "ccmValidateBlockForm" function from the top of the auto.js file, or you can create an empty "dummy" file set and use that for the default. (You can create file sets independent of images via Dashboard -> File Manager -> Sets).
Hope that helps.
-Jordan