Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plugin: enable use of components within WYSIWYG editor
#1
Hey there

If I got it right, the only place to use components is within templates (or plugins) where you can use php code.
Sometimes it would be nice, to use components right while creating a site.
So, I wrote a plugin to enable you to do so.

While editing a site using the WYSIWYG editor you simply have to insert a placeholder like:

[[Component::component-name]]

This will be replaced with the components content while rendering the page.
This way, you don't have to enable php parsing within site content (there's a plugin for that).

May be useful for some people.. Smile

Btw: Some sort of plugin repsoitory would be nice
Reply
#2
blazer82 Wrote:May be useful for some people.. Smile

Btw: Some sort of plugin repsoitory would be nice

Initial tests with this make my install of GS 2.01 shut down the admin section - white screen.
I do agree re: a plugin Repository Smile
Reply
#3
badcat Wrote:
blazer82 Wrote:May be useful for some people.. Smile

Btw: Some sort of plugin repsoitory would be nice

Initial tests with this make my install of GS 2.01 shut down the admin section - white screen.
I do agree re: a plugin Repository Smile

I do also work on 2.01
But, oh.. I see. I used some feature only available since php 5.3
This may cause your problem.

I'll attach a version that should also work with other versions of php.
Reply
#4
blazer82 Wrote:But, oh.. I see. I used some feature only available since php 5.3

If I understand this correctly, I would have a component normally place in my theme as:
Code:
<?php get_component('tagline'); ?>

But now I can simply paste into my Wysiwyg editor:
Code:
[[Component::tagline]]

Is this correct? If so, it's not working for me. I've tried it with components that have PHP in them and also ones that do not have PHP in them - but neither works for me. What did I miss?

And FYI, yes - I was running PHP 5.2.9
Reply
#5
badcat Wrote:If I understand this correctly, I would have a component normally place in my theme as:
Code:
<?php get_component('tagline'); ?>

But now I can simply paste into my Wysiwyg editor:
Code:
[[Component::tagline]]

Is this correct?

Yes, that's how it is supposed to work.
Is your placeholder [[Component::tagline]] gonna be replaced by an empty string or is it not gonna be replaced at all?
Reply
#6
blazer82 Wrote:Is your placeholder [[Component::tagline]] gonna be replaced by an empty string or is it not gonna be replaced at all?
Hmm - now I'm really confused. I *thought* it would be replaced with what was in the component. My component is pre-exisiting.
I see the problem now... I was trying to use your plugin along with n00dle's "Custom Fields" which is allowing me to load page content into other pages. The 2 plugins do not mix well.

Adding your shortcode into the wysiwyg of a top level page does work as intended.
Reply




Users browsing this thread: 1 Guest(s)