Published on May 27th, 2017 | by Guest0
What You Need to Know to Keep Your CMS Blocks Organized
CMS static blocks are particular sections of code which Magento web development creates and adds to its webpages wherever the user needs them to be. One major advantage to this method of creating blocks and content management is that once a block has been created, it can be reused many times, something which will speed the entire content creation process up. CMS blocks themselves are a means for administrators to be able to control the content they and others have written – rather than needing to work through the entire program\site\page again, a static block allows for chunks of code to be isolated and viewed in seconds, thus cutting down on the time needed for making changes and shifting code. In terms of Magento itself, CMS blocks are particularly useful for creating things like banners and charts, all self-contained blocks of code which can be moved without changing them.
These blocks are very useful features in Magento, particularly in the way in which they can be used multiple times throughout a site, or in how they can serve to highlight and isolate certain blocks of code as a means of speeding up the process of code creation and maintenance. However, the nature of Magento as an open-source platform which many web development companies can use and make changes to can actively work against streamlining the code as a means of streamlining the creation process itself: having multiple people working on code creates a situation where there may be multiple static blocks in use simultaneously – all of which differ from each other in terms of the coding used and the terms and ideas behind the blocks themselves. Far from streamlining the process, having to work around all these blocks can create time constraints on the people doing the work. So far, Magento dashboard only has the most basic search and filter options, so this problem with the static block build-up is something which can only be tackled in fits and starts. These options are very powerful in the own right, however, and this article is dedicated to showing how these features can be used in Magento E-commerce development to organise the static blocks and keep them in the coherent order.
- By name
- Arranging the static blocks and folders by name is perhaps the simplest way to organise the blocks so that they are easy to find and work with. While many sites have hundreds of CMS blocks, making this a daunting task, using the search function to find all the blocks is the first step. Name the most used folder with A, and then all the blocks which are specific to that folder ‘a’, work from there, and things will become much easier.
- To give an example, using a website name:
|[No-value]||Only one website|
|Multi||Block can be found in multiple websites|
|[Store Name]||Block only found in a specific website|
- By product area
- Grouping blocks by product area can work in multiple ways; it can be something which has a general view of the products being sold – i.e. kitchen\bathroom, soft furnishings, etc. – or it could be more specific such as grouping all similar products under the heading of tiles or couches.
- By access rights
- If there are several editors working on the same project, or several brands using the same framework, then creating access rights might not be a bad plan for your own work. Using access rights restricts who has access to the work and can change it, as well as keeping your work safe from opposing brands.
- By usage
- A particularly useful method of organising static blocks is by what they are used for. So, for example, all banner blocks will be grouped together, as will all news blocks. Magento users could even expand this into a more general outlook, keeping folders of all the blocks which are used on the landing page separate from others, and so on.
|Multi||Component appears on multiple containers on a page|
|Contents||Main contents, main container|
|Sidebar left||Left sidebar container|
|Sidebar right||Right sidebar container|
Tips to Remember
- Blocks are best organised in such a way as to ensure the people using the framework know about the block, what it is, and where it fits in the overall code
- Blocks are best created in such a way as to be easily changed, filtered, or blocked, depending on what each user wants to do
- Give a unique title for each block, one which shows the purpose of the block, the place it holds in the overall coding system, and how it can be used
- Make sure the organisation doesn’t depend on the existence of an extension – this will make it easier for people to make repairs and do maintenance from different access points
While CMS static blocks are extremely useful in that they can break up code, and can also be used in several different places in the coding, with the repetition cutting down on time and effort which needs to be put into coding, there is no fixed method of sorting them, which can be problematic when there are a number of people working in the same framework. While Magento itself has no search function, there are many ways in which static blocks can be sorted and condensed, allowing for easier use of the overall framework.
About the author:
Amanda Brown is a technical writer at WillbeCoded and a blogger. She loves to feed her brains with new knowledge and to create engaging content. Apart from her profession, Amanda also has a passion for history and traveling.