www.it-ebooks.info concrete5 Beginner's Guide Second Edition Create and customize your own feature-rich website in no time with concrete5! Remo Laubacher BIRMINGHAM - MUMBAI www.it-ebooks.info concrete5 Beginner's Guide Second Edition Copyright © 2013 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: March 2011 Second Edition: April 2013 Production Reference: 1160413 Published by Packt Publishing Ltd Livery Place 35 Livery Street Birmingham B3 2PB, UK ISBN 978-1-78216-931-4 www.packtpub.com Cover Image by Jarek Blaminsky (milak6@wp.pl) www.it-ebooks.info Credits Author Remo Laubacher Reviewers Project Coordinator Abhishek Kori Proofreaders Ryan Hewitt Maria Gould Šarūnas Narkevičius Aaron Nash Werner Nindl Stephen Copestake John Steele Indexer Acquisition Editor Tejal Soni Mary Nadar Graphics Lead Technical Editor Sheetal Aute Savio Jose Production Coordinator Technical Editors Conidon Miranda Sharvari Baet Ankita Meshram Kirti Pujari Cover Work Conidon Miranda www.it-ebooks.info About the Author Remo Laubacher grew up in Central Switzerland in a small village surrounded by mountains and natural beauty He started working with computers a long time ago and then, after various computer-related projects, focused on ERP and Oracle development After completing his BSc in Business Administration, Remo became a partner at Ortic, his ERP and Oracle business, as well as a partner at Mesch web consulting and design GmbH At Mesch—where he's responsible for all development-related topics—he discovered concrete5 as the perfect tool for their web-related projects and has since become a key member of the concrete5 community You can find his latest publications on http://www.codeblog.ch/ He has also authored concrete5 Beginner's Guide and Creating concrete5 Themes www.it-ebooks.info About the Reviewers Ryan Hewitt has been a web developer for over 10 years and has worked extensively with concrete5, with it being his content management system of choice Ryan's background includes working for both large and small development companies, wading through oceans of code and fighting SQL beasts, PHP devils, and CSS nasties He has written numerous custom online systems and scripts—finding solace in the advantages that well written frameworks and libraries such as CakePHP, jQuery, Boostrap Twitter, and concrete5 bring forth Ryan started his own web development business in 2011, with his partner Lelita Baldock, called Mesuva Web Development From the beautiful coastal town of Goolwa, in South Australia, Ryan and Lelita build a wide range of websites and online shops using concrete5, often heavily customizing them with custom-built blocks and packages One of concrete5's greatest strengths as a CMS is its active online community, and Ryan takes pride in contributing answers and insights to the online forum, as well as providing free concrete5 packages and support The Mesuva website can be found at https://www.mesuva.com.au and Ryan can be contacted through it Werner Nindl is an Oracle Hyperion consultant by day and a concrete5 web developer by night As a consultant, he has lived and worked in Europe, China, and the US During his day job, Werner manages consulting programs for Financial Consolidation and Reporting www.it-ebooks.info Intrigued by the capabilities of concrete5, he has started to convert his clients' web sites to concrete5 Participating in the review of this book has helped him to plan for future enhancements He believes that he can implement those enhancements now at a much lower resource cost then previously planned I want to thank the publishers for the opportunity to participate First and foremost I want to compliment Remo on his tremendous insight into, and knowledge about, concrete5 John Steele began teaching himself BASIC on a borrowed Atari He purchased his first computer, the Timex Sinclair 1000, later trading it in on a Commodore 64 He then taught himself 6502 Assembly followed by the C language, creating a 3D wireframe program to design a hang-glider He was a Mathematics major, switching to Computer Science as soon as the degree program was available He worked as a Systems Programmer at the IBM Almaden Research Center using C, Fortran, Pascal, and 8086 Assembly Next, he worked as Systems Analyst and Lead Programmer for the largest selling POS software for video stores He was a beta tester for every version of the Microsoft C compiler Fascinated by the Internet, he taught himself PHP3 and MySQL programming and started his business Steelesoft Consulting He's used just about every Unix-based operating system since the DEC PDP-11 and owns the first version of Linux on CD He's also been a technical editor for two PHP4 books by Osborne-McGraw Hill I'd like to thank Remo and all the fine folks at concrete5.org and the wonderful people who help others on the Forums everyday www.it-ebooks.info www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy Get in touch with us at service@packtpub.com for more details At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library Here, you can access, read and search across Packt's entire library of books Why Subscribe? Fully searchable across every book published by Packt Copy and paste, print and bookmark content On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books Simply use your login credentials for immediate access www.it-ebooks.info www.it-ebooks.info Table of Contents Preface 1 Chapter 1: Installing concrete5 Preparing for installation Web browser Text editor Archive utility FTP client Installing Bitnami Time for action – installing Bitnami WAMP stack Downloading concrete5 Time for action – downloading the latest version Creating an empty MySQL database Time for action – creating a MySQL database Installing concrete5 Time for action – installing concrete5 The configuration file Disabling caching 8 8 9 15 16 17 17 19 20 23 24 Time for action – disabling caching Enabling pretty URLs 24 25 Time for action – enabling pretty URLs File and directory structure of concrete5 Dispatcher process Summary 25 26 27 28 Chapter 2: Working with concrete5 Getting familiar with concrete5 Time for action – logging in to concrete5 Adding new blocks Time for action – adding new blocks www.it-ebooks.info 29 29 30 32 32 Pop Quiz Answers Chapter 1, Installing concrete5 Pop quiz – requirements for concrete5 Q1 Q2 Q3 Q4 (All of the above, but keep in mind that Apache is the only officially supported webserver) Pop quiz – the configuration file Q1 Chapter 2, Working with concrete5 Pop quiz – concrete5 inside editing mode Q1 Q2 www.it-ebooks.info Pop Quiz Answers Chapter 3, Managing permissions Pop quiz – permissions in concrete5 Q1 1, 3, and Q2 Chapter 4, Managing Add-ons Pop quiz – what's a package? Q1 1, 3, and Chapter 5, Creating your Own Theme Pop quiz – what are page templates and page types? Q1 1, 3, and Pop quiz – what are attributes? Q1 Pop quiz – what's a single page? Q1 2, 3, and Q2 1, 3, and While you probably won't have several contact forms on your site, you'll have several forms and at the end, there's not much custom functionality in a contact form and therefore not recommended as a single page [ 294 ] www.it-ebooks.info Pop Quiz Answers Chapter 6, Customizing Block Layouts Pop quiz – how to include CSS and JavaScript files Q1 1, 3, and Chapter 7, Adding Site Navigation Pop quiz – parts of image navigation Q1 and Q2 and Chapter 8, Creating Your Own Add-on Block Pop quiz – parts of a block Q1 Chapter 9, Everything in a Package Pop quiz – what does a package do? Q1 1, 2, 3, and Q2 1, 2, and Pop quiz – what can you with events? Q1 1, 2, 3, and Q2 and [ 295 ] www.it-ebooks.info Pop Quiz Answers Pop quiz – benefits of addHeaderItem Q1 Chapter 10, Dashboard Extensions Pop quiz – concrete5 single pages Q1 and Q2 and Q3 and Chapter 11, Deployment and Configuration Pop quiz – concrete5 configuration Q1 and Q2 Q3 [ 296 ] www.it-ebooks.info Index Symbols 7-Zip about URL htaccess 26 A access restricting, to blocks 75 add-ons about 85 installing, from marketplace 86-88 installing, manually 88, 89 moving 225 uninstalling 88 add.php file 200 ADOdb library 183 advanced page permissions managing 77, 78 advanced permission mode activating 76 working with 76 advanced tooltips creating 155, 156 anonymous visitors content, hiding from 115 ApacheBench 288 APC about 286, 287 used, for caching 287 appVersionRequired element 218 archive utility area block template, specifying in 124 block wrapper, inserting in 116, 117 area permissions managing 79, 80 attribute data accessing, from template 120 attributes used, for setting background picture 117-119 autonav block about 35, 159 integration, undoing 160 options 161 autonav block, options autonav page structure 161 page order 161 pages, displaying 162, 163 relevant subpages, displaying 164 relevant subpages, displaying from top 164, 165 autonav block properties searching 122-124 autonav output 165-167 autonav page order 161 autonav page structure 161 B background picture setting, attributes used 117-119 www.it-ebooks.info base URL redirection, production configuration 283 Bitnami Bitnami WAMP stack installing 9-14 block about 94 adding, to concrete5 page 32-34 creating, steps 182 installing 189, 190 structure 94-96 block controller creating 185, 186 block layout modifying, templates used 131-133 block output printing 189 block permissions managing 80, 81 block picture navigation template creating 168-170 blocks access, restricting to 75 adding, to existing pages 46, 47 adding, to page 43, 44 copying, clipboard used 52, 53 inserting, in templates 121 moving, into package 221 styling 55-58 uninstalling 222 blocks, concrete5 Auto-Nav 35 Blog Date Archive 35 Content 35 Date Navigation 35 External Form 35 File 35 Flash Content 35 Form 35 Google Map 35 Guestbook / Comments 35 HTML 35 Image 35 Next & Previous Nav 35 Page List 35 RSS Displayer 35 Search 35 Slideshow 35 Survey 35 Tags 35 Video Player 35 YouTube Video 35 blocks per area restricting 116 block template specifying, in area 124 block wrapper inserting, in area 116, 117 Blog Date Archive block 35 broken link interface adding 247, 248 broken links dashboard extensions creating 248-251 browser fixes, JavaScript 241 C cache disabling, in concrete5 24 displaying 274 performance, improving with 286 caching with APC 287 ccmValidateBlockForm method 190 clipboard about 52 used, for copying blocks 52, 53 columns content, splitting into 49-51 concrete5 caches, disabling 24 directory structure 26, 27 downloading 15, 17 file structure 26, 27 helpers, exploring 138 installation, prerequisites 7, installing 19-23 jobs, executing 231 logging in 30 theme footer, creating 107, 108 theme header, creating 105-107 toolbar elements 30-32 URL 86 [ 298 ] www.it-ebooks.info concrete5 language modifying 283-285 performance, improving with cache 286 translation file, installing 284, 285 concrete5 page block, adding to 32-34 concrete5 site deploying 273 concrete5 site, deploying cache, displaying 274 file permissions, setting 279-282 files, transferring to server 277, 278 MySQL database, transferring 274-277 pretty URL, displaying 274 concrete5 theme CSS, converting to 104 HTML, converting to 104 config directory 23 configuration file about 23, 24 updating 279-283 constants, PHP 112 listing 112, 113 content hiding, from anonymous visitors 115 splitting, into columns 49-51 Content block 35 controller without logic 270 controller.php file 200 core events hooking into 225 cPanel 279 cron 232 CSS about 55 converting, to concrete5 theme 104 CSS3 hover effect adding 170 CSS3 transition autonav template creating 171-173 CSS fix integrating, in package 241, 242 CSS rules, layout 102 cURL 88 customizable themes creating 128, 129 custom template duplicate code, avoiding in 145, 146 D dashboard about 38 file editor, embedding in 259-261 working with 39 database access moving, into model 252-255 database schema creating 183, 184 Date Navigation block 35 db.xml file 200 default blocks adding, to page type 45, 46 default block template 131 dimension thumbnail, restricting to 137, 138 directory structure, concrete5 26, 27 dispatcher process 27 drop-down navigation about 173 building 174-176 duplicate code avoiding, in custom template 145, 146 E editing interface creating 187, 188 edit mode checking for 114, 115 exiting 37, 38 edit.php file 200 elements, package controller appVersionRequired 218 getPackageDescription 218 getPackageName 218 install 218 pkgHandle 218 pkgVersion 218 empty MySQL database creating 17-19 event extending 228, 229 [ 299 ] www.it-ebooks.info event types on_before_render 227 on_file_add 227 on_file_download 227 on_file_set_password 227 on_file_version_add 227 on_file_version_approve 227 on_file_version_deny 227 on_file_version_duplicate 227 on_file_version_update_description 227 on_file_version_update_tags 227 on_file_version_update_title 227 on_group_delete 226 on_page_add 227 on_page_delete 226 on_page_duplicate 226 on_page_move 226 on_page_update 226 on_page_version_approve 227 on_page_view 227 on_render_complete 227 on_user_add 226 on_user_change_password 226 on_user_delete 226 on_user_enter_group 226 on_user_exit_group 226 on_user_friend_add 226 on_user_friend_remove 226 on_user_login 227 on_user_update 226 existing blocks adding, on site 36, 37 External Form block 35 F file attributes adding, to gallery 152-154 adding, to slideshow 151 File block 35 file editor embedding, in dashboard 259-261 file editor add-on creating 262-270 extending 271 file manager permission granting, steps 68, 69 file permissions setting 279-282 files transferring, to server 277, 278 file structure, concrete5 26, 27 file structure, theme 92-94 FileZilla 277 Flash Content block 35 folder creating, for template 139 Form block 35 form_setup_html.php file 200 FTP client functionalities, package 216 functions, PHP 112 listing 113, 114 G gallery file attributes, adding to 152-154 slideshow, transforming into 147 gallery template creating, for slideshow 147, 148 generate_pdf.php file 208 getAttribute() method 120 getOriginalCollection() method 200 getPackageDescription method 218 getPackageName method 218 global tooltips creating 239, 240 Google Map block 35 Gravatar about 142 URL 142 Gravatar picture adding, to guestbook 143-145 group expiration options 63 groups adding, steps 62, 63 guestbook Gravatar picture, adding to 143-145 Guestbook / Comments block 35 H header area replacing, with template block 121 [ 300 ] www.it-ebooks.info header items injecting 238 header_menu template 124 helpers exploring 138 HTML converting, to concrete5 theme 104 HTML block 35 HTML code, layout 101, 102 jQuery about 140 URL 140 jQZoom block moving, into package 222, 223 jQZoom plugin 204 L I Image block 35 index.php file 27 installation, add-ons from marketplace 86-88 manually 88, 89 installation, Bitnami WAMP stack 9-14 installation, block 189, 190 installation, concrete5 19-23 installation prerequisites, concrete5 about archive utility FTP client text editor web browser installation, theme 111 installation, translation file 284, 285 installBlockTypeFromPackage method 223 install method 218, 221 isEditMode() method 115 IZArc about URL J JavaScript browser fixes 241 JavaScript gallery creating 142 jobs about 232 creating 233-238 executing, periodically 231 working with 230, 231 LAMP layout about 100 CSS rules 102 HTML code 101, 102 layouts 125 lightbox gallery building, steps 141 login errors handling, variables used 126, 127 M maintenance tasks working with 230, 231 MAMP mandatory fields checking for 190 marketplace add-ons, installing from 86-88 md5 hash 143 Memcached 286 mobile navigation building 177-179 model database access, moving into 252-255 Model-View-Controller (MVC) 35, 94 MooTools about 140 URL 140 multi-column layout creating 49-51 multiple block versions handling 194-196 multiple controller methods working with 255-258 MVC 246 [ 301 ] www.it-ebooks.info MVC pattern working with 245, 246 my.ini file 12 MySQL database transferring 274-277 on_user_friend_remove event 226 on_user_login event 227 on_user_update event 226 N package about 96, 97, 216 blocks, moving into 221 creating 243 CSS fix, integrating in 241, 242 functionalities 216 jQZoom block, moving into 222, 223 PDF block, moving into 223-225 structure 216 templates, moving to 219-221 theme, moving into 221 package controller about 216 creating, steps 217, 218 package model creating 252-255 packages directory 216 page attributes creating, for navigation pictures 168 working with 117 page defaults managing 45 page editing permissions granting 70, 72 page list thumbnails, adding to 133-136 Page List block 35 pages adding, to site 40-42 blocks, adding to 43-47 moving 48, 49 sorting 48, 49 stacks, adding to 53-55 PageSlide 177 page template creating 108, 110 page type default blocks, adding to 45, 46 partial dashboard access granting 74, 75 P navigation images adding 168 navigation pictures page attributes, creating for 168 news section creating 40-42 Next & Previous Nav block 35 Notepad++ about URL O on_before_render event 227 on_file_add event 227 on_file_download event 227 on_file_set_password event 227 on_file_version_add event 227 on_file_version_approve event 227 on_file_version_deny event 227 on_file_version_duplicate event 227 on_file_version_update_description event 227 on_file_version_update_tags event 227 on_file_version_update_title event 227 on_group_delete event 226 on_page_add event 227 on_page_delete event 226 on_page_duplicate event 226 on_page_move event 226 on_page_update event 226 on_page_version_approve event 227 on_page_view event 227 on_render_complete event 227 on_user_add event 226 on_user_change_password event 226 on_user_delete event 226 on_user_enter_group event 226 on_user_exit_group event 226 on_user_friend_add event 226 [ 302 ] www.it-ebooks.info PDF block moving, into package 223-225 PDF generation block about 204 creating 205-208 performance improving, with cache 286 permissions managing 61 removing 78 time restriction 69, 70 PHP constants 112 functions 112 PHP information getting 286 picture magnifier block about 200 creating 201-204 pkgHandle element 218 pkgVersion element 218 pretty URL displaying 274 enabling 25, 26 product categories adding 191-193 product information block building 182 production configuration base URL redirection 283 concrete5 language, modifying 283-285 updating 282 product list building 194 extending 200 product list block creating 197-200 protected website section creating 72, 73 PSPad about URL public function add method 212 public function edit method 212 public function view method 212 R RSS Displayer block 35 S Search block 35 server files, transferring to 277, 278 simple gallery block about 208 creating 209-212 single page about 125 theme, applying to 124, 125 single page layout creating 125 single pages 216 site existing blocks, adding 36, 37 pages, adding 40-42 sitemap permissions granting, steps 66, 67 site name modifying 40 site performance measuring 288, 289 site.php file 23 slideshow file attributes, adding to 151 gallery template, creating for 147, 148 transforming, into gallery 147 Slideshow block 35 slideshow gallery adding, steps 149, 150 sliding mobile navigation 177 SooperFish about 173 parameters, modifying 176 SooperFish template creating 174-176 SQLite 286 stacks about 40, 53 adding, to pages 53-55 working with 53-55 [ 303 ] www.it-ebooks.info Static 286 styles customizing 59 subpage permissions managing 81, 82 Survey block 35 translation file installing 284, 285 U user attributes working with 65 users adding, steps 64, 65 T Tags block 35 template attribute data, accessing from 120 template block header area, replacing with 121 template folder creating 139 templates blocks, inserting in 121 moving, to package 219-221 used, for modifying block layout 131-133 templates directory 131 text editor TextWrangler about URL theme about 90, 91 applying, to single page 124, 125 file structure 92-94 installing 111 moving, into package 221 parts 91 theme footer, concrete5 creating 107, 108 theme header, concrete5 creating 105-107 thumbnail page list improving 138 thumbnails adding, to page list 133-136 restricting, to custom dimension 137, 138 time restriction for permissions 69, 70 title tag tooltips, adding for 238 tooltips adding, for title tag 238 V variables used, for handling login errors 126, 127 Video Player block 35 view.php file 131, 200, 208 views 125 W WAMP web browser WYSIWYG editor 34 X XCache 286 XML 183 Y YouTube Video block 35 YUI about 140 URL 140 Z Zend platform 286 Zend server 286 [ 304 ] www.it-ebooks.info Thank you for buying concrete5 Beginner's Guide: Second Edition About Packt Publishing Packt, pronounced 'packed', published its first book "Mastering phpMyAdmin for Effective MySQL Management" in April 2004 and subsequently continued to specialize in publishing highly focused books on specific technologies and solutions Our books and publications share the experiences of your fellow IT professionals in adapting and customizing today's systems, applications, and frameworks Our solution based books give you the knowledge and power to customize the software and technologies you're using to get the job done Packt books are more specific and less general than the IT books you have seen in the past Our unique business model allows us to bring you more focused information, giving you more of what you need to know, and less of what you don't Packt is a modern, yet unique publishing company, which focuses on producing quality, cutting-edge books for communities of developers, administrators, and newbies alike For more information, please visit our website: www.packtpub.com About Packt Open Source In 2010, Packt launched two new brands, Packt Open Source and Packt Enterprise, in order to continue its focus on specialization This book is part of the Packt Open Source brand, home to books published on software built around Open Source licences, and offering information to anybody from advanced developers to budding web designers The Open Source brand also runs Packt's Open Source Royalty Scheme, by which Packt gives a royalty to each Open Source project about whose software a book is sold Writing for Packt We welcome all inquiries from people who are interested in authoring Book proposals should be sent to author@packtpub.com If your book idea is still at an early stage and you would like to discuss it first before writing a formal book proposal, contact us; one of our commissioning editors will get in touch with you We're not just looking for published authors; if you have strong technical skills but no writing experience, our experienced editors can help you develop a writing career, or simply get some additional reward for your expertise www.it-ebooks.info concrete5 Beginner's Guide ISBN: 978-1-849514-28-6 Paperback: 320 pages Create and customize your own website with the concrete5 Beginner's Guide Follow the creation of a sample site, through the installation, configuration, and deployment of a concrete5 site Use themes and add-ons to create a personalized site Part of Packt's Beginner's Guide series – lots of practical examples, screenshots, and less of the waffle Creating concrete5 Themes ISBN: 978-1-782161-64-6 Paperback: 160 pages Create high quality concrete5 themes using practical recipes and responsive techniques to make it mobile-ready Get to grips with the concrete5 architecture Learn how to create a concrete5 theme Discover how to make a theme responsive to improve it for small devices Please check www.PacktPub.com for information on our titles www.it-ebooks.info Joomla! 2.5 Beginner’s Guide ISBN: 978-1-849517-90-4 Paperback: 426 pages An easy to use step-by-step guide to creating perfect websites with the free Joomla! CMS Create a Joomla! website in an hour with the help of easy-to-follow steps and screenshots Go beyond a typical Joomla! site to make a website that meets your specific needs Learn how to secure, administrate, and fill your site with content Update to the popular Joomla! 1.5 Beginner's Guide by Eric Tiggeler Drupal Development by Example Beginner’s Guide ISBN: 9780-1-849516-80-8 Paperback: 366 pages Follow the creation of a Drupal website to learn, by example, the key concepts of Drupal development and HTML5 A hands-on, example-driven guide to programming Drupal websites Discover a number of new features for Drupal through practical and interesting examples while building a fully functional recipe sharing website Learn about web content management, multi-media integration, and e-commerce in Drupal Please check www.PacktPub.com for information on our titles www.it-ebooks.info .. .concrete5 Beginner's Guide Second Edition Create and customize your own feature-rich website in no time with concrete5! Remo Laubacher BIRMINGHAM - MUMBAI www.it-ebooks.info concrete5. .. directory structure of concrete5 Dispatcher process Summary 25 26 27 28 Chapter 2: Working with concrete5 Getting familiar with concrete5 Time for action – logging in to concrete5 Adding new blocks... Installing concrete5, helps you to get a test-site running on your local computer, from where we'll continue to work with concrete5 Chapter 2, Working with concrete5, discusses the basics of concrete5