Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to place user-editable blocks in template
#1
My custom template has 8 blocks of content on the first page. These blocks are small pieces like "About us" etc, there are 8 of them. I already have the html file (created elsewhere) and now need to translate it to GS template.

I would like to achieve 2 goals:
1. the small blocks must be editable by user in wysiwyg - so probably each block must be a page
2. but the block should not be possible to display directly as a full page

In GS, each page automatically has a slug, so each page is possible to display directly. Perhaps it has to be that way. I just would like to know, what is the common method of creating such small pieces of user-editable content (blocks of text)
Reply
#2
Use components

Create a page called aboutus

Make a component
say
"block_aboutus"
put
Code:
get_page_content('aboutus');


In your template
put
Code:
get_component('block_aboutus');

psuedo code
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
Ok, great - thanks!
Reply
#4
@shawn_a It should be getPageContent, not get_page_content

@trysky This is the way it has been suggested before:

- Create your editable blocks as private pages (take note of their slugs or change them to what you want)
- Insert this code in your template file or component:
Code:
<?php getPageContent('block-slug'); ?>

If you want some block to be shown only on some page, e.g. the index page, use this code instead:
Code:
<?php if (return_page_slug()=='index') { getPageContent('block-slug'); } ?>
Reply




Users browsing this thread: 1 Guest(s)