Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
additional contents sections
#1
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.
Reply
#2
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
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#3
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.
Reply
#4
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.
Reply
#5
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
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#6
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?
Reply
#7
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?
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#8
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.
Reply
#9
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.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#10
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.
My Github Repos: Github
Website: DigiMute
Reply
#11
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!
Reply
#12
Thank you Mike!
Reply
#13
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
Reply
#14
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.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#15
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.
Reply
#16
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 ;-)
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#17
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!
Reply
#18
I'm just starting out with GetSimple and finding this little nugget has really helped, thanks!
Reply
#19
This is now built in to version 3.1

see here

http://get-simple.info/wiki/config:caching-function
My Github Repos: Github
Website: DigiMute
Reply




Users browsing this thread: 1 Guest(s)