GetSimple Support Forum

Full Version: wysiwyg snippets solution overview
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Another CMS I used to work with offered a component system similar to that of Get Simple, with the difference that one could also set the component to html and use a wysiwyg editor to fill the component.

Which very much came in handy since often enough you find yourself in need of editable sections in the website next to the main content section.

Of course Get Simple currently only offers the options to create components without a wysiwyg editor. While I do understand the reasoning behind it and love the fact that you can use it drop php code and such into your page, it doesn't really work for customers that aren't too technically savvy.

So being new to Get Simple I have been going through the forum to find out what kind of solutions exist to still offer the option of editable sections without people having to learn html and needing to delve into the theme tab to edit their component(s).

I thought it would come in handy to have a overview of them on the forum, hence this thread Smile

Ladies and gentlemen of the jury, here are my findings:

Snippet solution 1 by mvlcek (see also: http://get-simple.info/forum/post/17628/#p17628)

Needed plugin:
- I18N

Include the following call to your template or component for the snippets needed:
Code:
<?php get_i18n_content('slug/url of the snippet page in question'); ?>

Snippet pages shouldn't show in the menu, set to private

Make sure that in 'Page management' you clearly mark your snippet page so as to not confuse the client


Snippet solution 2 by noodles101 (see also: http://get-simple.info/forum/post/1574/#p1574)

No plugin needed

Add the following code to functions.php of your theme:

Code:
function get_content($page){  
        $path = "data/pages";
        $thisfile = @file_get_contents('data/pages/'.$page.'.xml');
        $data = simplexml_load_string($thisfile);
        echo stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES));;
}

Snippet pages shouldn't show in the menu, set to private

Include the following call to your template for the snippets needed:
Code:
<?php get_content('slug/url of the snippet page in question'); ?>

Make sure that in 'Page management' you clearly mark your snippet page so as to not confuse the client


Snippet solution 3 by mvlcek (see also: http://get-simple.info/forum/post/17628/#p17628)

Needed modules:
- I18N
- Dynpage

Can be used to include content within the content section of your page (could come in handy in some cases)

Create a component with the following name: 'content'

Paste the following code:
Code:
<?php
global $args;
if (count($args) > 0) get_i18n_content($args[0]);
?>


Call the content of your snippet page inside the page in question by using:

Code:
{% content slug/url of the snippet page in question %}

This last solution however has the drawback that it will include the content of the snippet page inside <p></p> tags already in the page.

@mvlcek:
is there a way to make sure that doesn't happen? Otherwise I think this will not really validate.

@all:
If I missed something or didn't correctly explain the solution in question by all means chime in but I all in all I think this can be a really handy thread for newcomers to Get Simple.
Hej, this is an impressive collection.

It seems to me that you really invested a lot of detective energy, thank you for that!

I found another possibility which can help in this situation and that needs no tweaking in the theme, plugin etc. Only requirement: users will have to work with Firefox

It is a browser-side-solution which I found on my quest about CKEditor-Integration:

There is a plugin for Firefox which will change any textarea to a CKEditor-area.
When you have installed that browser plugin, you can click into the context-menu of any textarea (by that also in the components' textarea), choose "Edit in WriteArea" and you will get a ckeditor instance

see here:
[Image: writearea.jpg]

see here: www.writearea.com (blog of the developer) or here in the addon-repository:
https://addons.mozilla.org/de/firefox/ad...src=search

Cheers, Connie
Draxeiro Wrote:This last solution however has the drawback that it will include the content of the snippet page inside <p></p> tags already in the page.

@mvlcek:
is there a way to make sure that doesn't happen? Otherwise I think this will not really validate.

The DynPages plugin already removes the <p></p> if there is no other content (besides whitespace) in the paragraph.
mvlcek Wrote:The DynPages plugin already removes the <p></p> if there is no other content (besides whitespace) in the paragraph.

When I tested it I dropped in the tag in between two existing paragraphs, then the included content ended up between the <p></p> tags.

Should I have done it differently or do you mean it basically has to be placed into an empty page?
Draxeiro Wrote:
mvlcek Wrote:The DynPages plugin already removes the <p></p> if there is no other content (besides whitespace) in the paragraph.

When I tested it I dropped in the tag in between two existing paragraphs, then the included content ended up between the <p></p> tags.

Should I have done it differently or do you mean it basically has to be placed into an empty page?

If you have something like
Code:
<p>
    {% mycomponent %}</p>
on your page, the whole paragraph is replaced with the output/content of the component.