GetSimple Support Forum
how to place user-editable blocks in template - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Themes (http://get-simple.info/forums/forumdisplay.php?fid=10)
+--- Thread: how to place user-editable blocks in template (/showthread.php?tid=3472)



how to place user-editable blocks in template - trysky - 2012-08-27

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)


how to place user-editable blocks in template - shawn_a - 2012-08-27

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


how to place user-editable blocks in template - trysky - 2012-08-28

Ok, great - thanks!


how to place user-editable blocks in template - Carlos - 2012-08-28

@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'); } ?>