Making a list/services page with multiple columns

Permalink 1 user found helpful
Hey Concrete5 Forum!
I'm relatively new to developing on concrete5 and I am attempting to develop a theme for a friend. One thing I am having an issue is is making a list/services page (look at the attached image for how this should look). I've tried this with a list where it displays all of the 'Services' sub-pages but this doesn't allow me to have a description and image. Can anybody think of a solution to this?
Thanks for your time,
Kenan.

1 Attachment

 
enlil replied on at Permalink Reply
enlil
If there aren't too many services a quick way to do so would be to add a layout to the main area and then place content blocks in each sub-area. Upload the pics you want to use, add content, and link to the services pages!!
juliandale replied on at Permalink Best Answer Reply
juliandale
Assuming each service is a page displayed beneath the 'Services' page, the best way to do this would be to make a custom template for a Page List block, using an image as a custom page attribute.

To do this, first go to the Dashboard and under Pages & Themes, click on Attributes. At the bottom of that page, choose to add an Image/File attribute, give it a handle and a name, e.g. handle as service_page_image and the name as Service Page Image.

Then, copy the view.php file from /concrete/blocks/page_list and paste it into a new folder /blocks/page_list/templates/service_panels

You can then modify the code in order to meet your needs. Here's how you would grab the page name, the description and your new image attribute:

$pageTitle = $th->entities($page->getCollectionName());
$pageDescription = $th->entities($page->getCollectionDescription());
$service_image = $page->getAttribute('service_page_image');
if (!empty($service_image)){
  $imageHelper = Loader::helper("image");
  $tmb = $imageHelper->getThumbnail($service_image, 300, 240);
  $service_image_src = $tmb->src;
}
else {
  $service_image_src = "/path_to_a/default_image.jpg";
}


Within that folder, you can also add a view.css that is used to style the modified view.php code.

To use the custom template, add a Page List block as normal, then once added, click on it and choose Custom Template and then select your 'Service Panels' template from the list.
Kenanball replied on at Permalink Reply
Hello, Thank's for the great reply! I didn't even consider using Page Lists before but that makes a lot of sense. Although I am having a problem with the code you provided below for the view.php file. I pasted it exactly like that (deleted everything else in the file and added PHP tags) but it displayed an error. Thanks again for your help.

EDIT:: I managed to get it working, I was being stupid. Thanks very much for your help :)