Posts: 110
Threads: 3
Joined: Sep 2010
I was thinking about a way to deal with pages that have a lot of complex markup, and be able to enable users to edit the relevant areas, without breaking that part of the code that is being hidden by the editor, such as divs, classes, columns, lists, tables etc..
so i propose a plugin where you can define a template in html, and then specify editable areas with some sort of tag; then users would create a page using this 'page template'; and the areas that you have defined as editable would be text areas or maybe wysiwyg;
i think this kind of plugin would be useful and i've only seen something like this on mail marketing sites like campaign monitor...
-marc
Posts: 346
Threads: 27
Joined: Sep 2010
Could what you are asking be achieved with CustomFields? Create a field and give it a default value (basically the regular markup that would show up if it went unedited). Place the code:
Code: <?php get_custom_field('fieldname'); ?>
in your template where you want the markup to be editable, then the user could edit the markup within the page by clicking "Page Options" and editing the content of your custom field. You can also decide whether to make it a WYSIWYG field or a Multi line text field.
Posts: 110
Threads: 3
Joined: Sep 2010
i'm thinking of those simple occasions where you have columns, blockquotes, tabs, and the like where you want to somehow prevent the user from messing up the markup...
maybe shortcodes would be a possible solution... there are some joomla plugins that do complex formatting, like tabs, using tags like {tab=Title} some text {/tab} {tab=Title2} some text {/tab} {/tabs}..
-marc
Posts: 1,108
Threads: 70
Joined: Aug 2009
I have shortcodes plugin that hasn't been released to the public if you want to give it a try...
works exactly like Wordpress shortcodes...
let me know if your interested and I can put the code up somewhere
Info on WP shortcodes here http://codex.wordpress.org/Shortcode_API
Posts: 346
Threads: 27
Joined: Sep 2010
2012-04-19, 06:26:54
(This post was last modified: 2012-04-19, 06:27:29 by logonsf.)
Perhaps DynPages?
You can define the piece of markup that you want to be editable as a component. Then you place identifiers that say where the content is editable. So for example, with your one for columns you would make two components: column and column-end:
column
Code: <?php global $args; ?>
<div style="float: <?php echo $args[0]; ?>; width: <?php echo $args[1]; ?>;">
column-end
Then on your page you would simply use the following content to call the whole column:
Code: {% column 'FLOAT', 'WIDTH' %} COLUMN CONTENT {% column-end %}
Changing 'FLOAT' to the direction of alignment, 'WIDTH' to the width of the column and 'COLUMN CONTENT' to whatever content you want.
Basically, form your markup in a component with the code <?php global $args; ?> at the beginning of your component, then for every part of it that you want to be editable, use <?php echo $args[#]; ?>, numbering the arg accordingly starting from 0. When you use the placeholders on the page, you simply use the format { componentname 'arg0' 'arg1' etc... }. The markup can be as complicated as you need it to be.
Posts: 3,491
Threads: 106
Joined: Mar 2010
Maybe something can be done with CKeditor Read-only blocks. (No idea how this works, I just did a quick search...)
Posts: 110
Threads: 3
Joined: Sep 2010
2012-04-19, 06:50:40
(This post was last modified: 2012-04-19, 06:51:27 by nwlinux.)
Angryboy Wrote:Perhaps DynPages?
You can define the piece of markup that you want to be editable as a component. Then you place identifiers that say where the content is editable. So for example, with your one for columns you would make two components: column and column-end:
column
Code: <?php global $args; ?>
<div style="float: <?php echo $args[0]; ?>; width: <?php echo $args[1]; ?>;">
column-end
Then on your page you would simply use the following content to call the whole column:
Code: {% column 'FLOAT', 'WIDTH' %} COLUMN CONTENT {% column-end %}
Changing 'FLOAT' to the direction of alignment, 'WIDTH' to the width of the column and 'COLUMN CONTENT' to whatever content you want.
Basically, form your markup in a component with the code <?php global $args; ?> at the beginning of your component, then for every part of it that you want to be editable, use <?php echo $args[#]; ?>, numbering the arg accordingly starting from 0. When you use the placeholders on the page, you simply use the format { componentname 'arg0' 'arg1' etc... }. The markup can be as complicated as you need it to be.
right on AngryBoy! - that's pretty much what i arrived at over the last 40 minutes..
Code: <?php global $args; ?>
<div class="<?php echo $args[0]; ?> <?php echo $args[1]; ?>">
and the css has all of the column definitions..
it's working great - all the columns on this page are done like that:
http://dev.propellant23.com/gs31b/index....s-a-tables
and my editor has this:
Heading 1
Code: {% columns one-half %}
ANam laoreet rutrum ligula, at tincidunt ligula sagittis semper. Integer congue vehicula lectus eu faucibus. Maecenas ante lectus, placerat et venenatis quis, dictum quis orci. Curabitur lacus nisi, vestibulum id aliquam sit amet, dictum sit amet lacus.
{% end-column %}
{% columns one-half last %}
BNam laoreet rutrum ligula, at tincidunt ligula sagittis semper. Integer congue vehicula lectus eu faucibus. Maecenas ante lectus, placerat et venenatis quis, dictum quis orci. Curabitur lacus nisi, vestibulum id aliquam sit amet, dictum sit amet lacus.
{% end-last-column %}
Posts: 110
Threads: 3
Joined: Sep 2010
n00dles101 Wrote:I have shortcodes plugin that hasn't been released to the public if you want to give it a try...
works exactly like Wordpress shortcodes...
let me know if your interested and I can put the code up somewhere
Info on WP shortcodes here http://codex.wordpress.org/Shortcode_API
@n00dles101 - i would be really interested in trying the shortcodes.. in the meantime, the dynpages solution seems to work pretty well, but i could see the possibility for something more complex that dynpages wouldn't be able to accomodate... like tabs, since the ouput isn't linear..
-marc
Posts: 110
Threads: 3
Joined: Sep 2010
Carlos Wrote:Maybe something can be done with CKeditor Read-only blocks. (No idea how this works, I just did a quick search...)
wow - that's interesting - this is sort of what i was thinking of - i'll have to research this later...!
-marc
Posts: 346
Threads: 27
Joined: Sep 2010
You're welcome alienee22 :-) (did say that you come up with the same conclusion at the same time?)
Another example is with embeding youtube videos.
Component: youtube
Code: <?php global $args; ?>
<iframe width="<?php echo $args[0]; ?>" height="<?php echo $args[1]; ?>" src="<?php echo $args[2]; ?>" frameborder="<?php echo $args[3]; ?>" allowfullscreen></iframe>
Placeholder
Code: {% youtube width, height, url, border %}
Posts: 1,108
Threads: 70
Joined: Aug 2009
@alienee2, let me clean up the code a little and i'll post it up.
Posts: 110
Threads: 3
Joined: Sep 2010
n00dles101 Wrote:@alienee2, let me clean up the code a little and i'll post it up.
@n00dles101 -thanks - that's great - no rush, but i am keen to try shortcodes..!
I was able to get jquery tabs working with DynPages, and after reading the worpress wiki on shortcodes, the usage is very similar..
i'm wondering how you would use shortcodes differently that dynpages;
i'm thinking that being able to use more php code in the processing is the main advantage; for example, with the tabs, i have to manually specify the id # of the tab heading to match the tab content div, and i'm thinking that in shortcodes i could just code the id #s to generate automatically... this is how i'm doing it now:
Code: {% tab-heading %}
{% tab-name 1 "This is" %} {% tab-name 2 "Tabbed" %} {% tab-name 3 "Content" %}
{% tab-heading-end %}
{% tab-content 1 %}
Some content
{% tab-end %}
{% tab-content 2 %}
Some content
{% tab-end %}
{% tab-content 3 %}
Some content
{% tab-end %}
-marc
Posts: 110
Threads: 3
Joined: Sep 2010
Carlos Wrote:Maybe something can be done with CKeditor Read-only blocks. (No idea how this works, I just did a quick search...)
Hey Carlos - good tip!
it's super simple - you add contenteditable="false" to any element and then the user can't edit it.... the only slight drawback is that they can still delete it... but it does freeze whatever block of content and prevent inadvertent editing of that..
-marc
Posts: 110
Threads: 3
Joined: Sep 2010
@n00dles101 - i would be interested in testing out the shortcodes plugin...any word on a beta release?
Also - the matrix looks awesome; would you be able to post on how to output the data, i'm guessing one needs to use a foreach statement with the variable holding the query...
Posts: 1,108
Threads: 70
Joined: Aug 2009
@alienee2 - shortcodes is up on github @ https://github.com/n00dles/gs_shortcodes
its fully working and I've included a lot of working shorcodes in gs_sortcodes/shortcodes.php
I'll be releasing it at the same time as TheMatrix as both of them work very well together.
The Plugin Tab - shortcodes info list the included shortcodes and the syntax...
|