Block Best Practice
Permalink 1 user found helpful
Hi All,
I'm trying to get my head around the best approach to solve this problem. I have a layout that I want to enable my user to edit. The code looks like this :
This code gives me 3 images in a row and looks like the attachment.
My goal here is to allow a user to add this <DIV> and add in as many images as required into it. The parent div would only show if 1 or more images were added.
I can create an image template which allows me to sort the img classes out but obviously this misses out the parent <div> which is required to set my layout of 3 images across.
How would you guys best solve this problem ?
Thanks in advance for your help.
Cheers,
Mike
I'm trying to get my head around the best approach to solve this problem. I have a layout that I want to enable my user to edit. The code looks like this :
<div class="from-gallery-imgs"> <div class="gallery-img-wrap"> <a class="zoom-img load-img" rel="prettyPhoto[pp_gal]" href="images/portfolio-1col-img-1.jpg"><img src="images/from-gal-1.jpg" alt="gallery" /></a> </div> <div class="gallery-img-wrap"> <a class="zoom-img load-img" rel="prettyPhoto[pp_gal]" href="images/portfolio-1col-img-1.jpg"><img src="images/from-gal-2.jpg" alt="gallery" /></a> </div> <div class="gallery-img-wrap last-img"> <a class="zoom-img load-img" rel="prettyPhoto[pp_gal]" href="images/portfolio-1col-img-1.jpg"><img src="images/from-gal-3.jpg" alt="gallery" /></a> </div> </div>
This code gives me 3 images in a row and looks like the attachment.
My goal here is to allow a user to add this <DIV> and add in as many images as required into it. The parent div would only show if 1 or more images were added.
I can create an image template which allows me to sort the img classes out but obviously this misses out the parent <div> which is required to set my layout of 3 images across.
How would you guys best solve this problem ?
Thanks in advance for your help.
Cheers,
Mike
Thanks John ! Both very simple solutions which I hadn't considered at all. I've been looking for the complex one ! :)
Another question along similar lines, and this one comes from my Drupal background :
Say I have some content that lives in a righthand pane of the site. This same content is repeated on every page. I'd like the user to be able to edit it on any page and see the updated contents on every page. I'd describe this as a global block.
How could I achieve that ?
Cheers,
Mike
Another question along similar lines, and this one comes from my Drupal background :
Say I have some content that lives in a righthand pane of the site. This same content is repeated on every page. I'd like the user to be able to edit it on any page and see the updated contents on every page. I'd describe this as a global block.
How could I achieve that ?
Cheers,
Mike
You could edit the theme and create a page type where the right hand pane is a global area.
Or you could put it in a stack and include the stack on all pages, maybe setting it in page defaults for that page type.
Or you could use the 'Global Area' block on all the other pages to pull content from one 'master' page, again possibly with page defaults.
Or do the similar with a 'Parent Area' block.
On the list files from set addon, I posted a custom template in the addon forum that puts up thumbnail templates, so that could be another starting point.
Or you could put it in a stack and include the stack on all pages, maybe setting it in page defaults for that page type.
Or you could use the 'Global Area' block on all the other pages to pull content from one 'master' page, again possibly with page defaults.
Or do the similar with a 'Parent Area' block.
On the list files from set addon, I posted a custom template in the addon forum that puts up thumbnail templates, so that could be another starting point.
Hi John,
Can you elaborate on the "Global Area" concept ?
At the moment we're hardcoding the global content into each page type via includes.
Cheers,
Mike
Can you elaborate on the "Global Area" concept ?
At the moment we're hardcoding the global content into each page type via includes.
Cheers,
Mike
In a page type in your theme, where you declare an area, you declare a global area. Other methods and way forward is identical.
Have a look at the Greek Yogurt theme code.
Catches to look out for:
- Area names are case sensitive.
- Where it makes sense use the same area names etc as for the standard themes, that way you can switch to a standard theme when problems occur.
http://www.concrete5.org/documentation/developers/pages/themes-2...
I guess that coming from Drupal you are expecting things to be more complicated :)
// gloabl area $a = new GlobalArea('Header Nav'); $a->display(); // regular area $a = new Area('Main'); $a->display();
Have a look at the Greek Yogurt theme code.
Catches to look out for:
- Area names are case sensitive.
- Where it makes sense use the same area names etc as for the standard themes, that way you can switch to a standard theme when problems occur.
http://www.concrete5.org/documentation/developers/pages/themes-2...
I guess that coming from Drupal you are expecting things to be more complicated :)
I just uploaded a bunch of thumbnail templates for List Files from Set to the PRB (the link won't work until approved, so give it a week or so).
http://www.concrete5.org/marketplace/addons/image-list-templates/...
http://www.concrete5.org/marketplace/addons/image-list-templates/...
Hi John,
Wow ! I can't believe how simple that is and it does exactly what I was trying to achieve. C5 really is so simple when compared to Drupal, and the most impressive thing is that simplicity is power !
Thanks again for your help !
Cheers,
Mike
Wow ! I can't believe how simple that is and it does exactly what I was trying to achieve. C5 really is so simple when compared to Drupal, and the most impressive thing is that simplicity is power !
Thanks again for your help !
Cheers,
Mike
(start complex and cut out what you don't want)
You can also do it with a custom template for the 'list files from set' addon.
(start simple and add what you need)