Adding identical elements to website pages using blocks

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:

  1. In the Site → Blocks section, add a new block using the New block button.
  2. Write any ID for it using only letters, digits and underscore characters.
  3. Write an optional description for yourself to understand later what you created this block for.
  4. Write the text or code, which you need to place in several places on your website or in notifications, into the large text area.
  5. Save the block.
  6. Upon saving you will see a special code snippet, which you need to add the text or code to the desired templates.
  7. 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

    Add comment

    To add a comment please sign up or login

    Раздел помощи работает на основе приложения «Хаб»