Sometimes you may need to place identical elements on your website pages or in the site design, or in email/SMS notifications such as text paragraphs, images, Smarty or JavaScript code snippets. If you simply copy & paste the same text or code to several places then might forget where exactly you need to update it when you need to make some changes.
To avoid such problems, you may prefer to save such text or code in only one location so that it is automatically updated everywhere on your website whenever you edit it. To do so, use blocks:
- In the Site → Blocks section, add a new block using the New block button.
- Write any ID for it using only letters, digits and underscore characters.
- Write an optional description for yourself to understand later what you created this block for.
- Write the text or code, which you need to place in several places on your website or in notifications, into the large text area.
- Save the block.
- Upon saving you will see a special code snippet, which you need to add the text or code to the desired templates.
- Copy & paste this snippet to all the places which you needed to add identical text or code to.
When editing website pages, paste this code only in the HTML mode. Blocks do not work in the WYSIWYG mode.
Whenever you will need to edit that text or code, you will have to edit it only in your block’s properties and save the changes.
0 comments
No comments yet.