GetSimple Support Forum

Full Version: additional contents sections
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there any way to have additional contents sections within a template? For example, enable the user to edit the top part of the page with text, and also the bottom part with text. I know you can add components and add/edit text but it doesnt allow you to change the font or make it a link etc.
thats one of the biggest splits on how components should be used... some want PHP enabled, some want a WYSIWYG editor on them... the problem we cant have both. Right now, it's PHP enabled
ok, so in the component field you can actually put php code?

Is there any way to do something like "get_page_content()1", "get_page_content()2", "get_page_content()3" So the user can edit different sections? I'm guessing this would probably be some heavy customization but we want to try to avoid that so we can keep the ability to upgrade when you have new versions come out or so that we at least dont have to do to much work.... any suggestions?


ps. nice steelers win on sunday. that was brutal for chargers fans.
nevermind, we just used the components option and just have the formatting done via css so the user doesnt have the option to change the design only the words.
good idea on the CSS... you might be able to also do something like this too: http://get-simple.info/forum/viewtopic.p...1025#p1025
I was thinking (always dangerous) if the
Code:
get_page_content()
function accepted an optional argument of a page-slug - we could in fact have as many content areas per page as we want - each with a WYSIWYG editor - so components could stay code only
if you used a structured naming system

page_slug: 'about-us'
Code:
get_page_content()
and we could concatenate a sidebar 'sidebar-about-us'
Code:
get_page_content(<? 'sidebar-'.return_page_slug(); ?>)
etc..

a simple addition to the codex that IMHO expands the scope substantially - and since it's an optional argument - really nothing else needs to change.

thoughts?
Would be interesting, but I think the idea will need a little more work. As now it sounds a lot like the already shared per page components function. That way when you call the component sidebar in your template it will try to get slug-sidebar first.

Is that anything like you wanted this to work?
IMHO the interface for components although functional for small snippets of content (which as I understand it, was it's actual intention) isn't as functional for anything more complex - the addition of this optional argument would allow us to create templates that pulls in multiple pages of content each of them manageable vis TinyMCE. Perhaps the next release has already 'friendlied' up the components interface - even so I think this addition has merit.
There was a reason the components interface didn’t use any friendlier way of inputting content. The reason can be found somewhere here on the forum but the gist of it is that with TinyMCE or any other system PHP input would break while Chris wanted to offer PHP support in the components.
One way you could do it is.

o - create a normal page
o - create as many pages as you need sections. Give them a title say "toppart" , "bottompart" etc..
o - make them private and make the parent the first page you created. This isn't required but they look better in the admin page as they'll all show as subpages.
o - Put the following function in your templates functions.php.

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));;
}

o - then call it in your template like so.

Code:
<div id="bottom">
<?php get_content('bottompart'); ?>
</div>


This will give you all the editable section you need.

Mike.
n00dles101 Wrote:One way you could do it is...

This will give you all the editable section you need.

Mike.

Yikes! That's just too easy. Thanks!
Thank you Mike!
I'm currently working on my first GS site. Just wanted to let you know how useful this was. Made a minor edit to strip the <p> tags added by the editor (because I was calling the content into a pre-existing <p> tag)

Code:
<?php


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));;
}

function get_naked_content($page){  
        $path = "data/pages";
        $thisfile = @file_get_contents('data/pages/'.$page.'.xml');
        $data = simplexml_load_string($thisfile);
        echo strip_tags(stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES)), '<h1><h2><h3><a><b><i><strong><em>');;;
}

?>

thanks so much
DanielCoulbourne Wrote:
Code:
echo strip_tags(stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES)), '<h1><h2><h3><a><b><i><strong><em>');;;
Just my thoughts: You are allowing a very small amount of HTML, CKEditor allows for a lot more elements. (For one, you’re also stripping images.) Also, if this should be displayed inside a P-element those headers (H1, H2, H3) are not allowed if you want to follow web standards.
This was a pretty specific implementation. I wanted to use the same function a couple places, which is why I allowed the <h1> etc. There was no need to allow images because the images I need were already floated inside the <p> tabs.

It's pretty hackish right now, but I'm just trying to make everything work for now.

Just wanted to get the idea out there in case anyone else was thinking to try it.
OK, in that case I have no problems with the function. (Not that you would have had to care whether I have problems with it or not ;-)
n00dles101 Wrote:One way you could do it is.

Code:
<div id="bottom">
<?php get_content('bottompart'); ?>
</div>

This will give you all the editable section you need.

Mike.

Thanks Mike, exactly what i was searching for.
Just one question: Is it possible to replace the specific content, in this case 'bottompart', and to use instead a kind of placeholder/function/whatever, which is calling ALL the elements from the parent page?

What i want to do, is kind of looping it. Like this:
get_(all the)_content assigned to the current page (= the private subpages)

Any ideas? Thx!
I'm just starting out with GetSimple and finding this little nugget has really helped, thanks!
This is now built in to version 3.1

see here

http://get-simple.info/wiki/config:caching-function