Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rich text editor in components
#1
Hello,

I was trying to find some plugin that will be able to replace the endlines with <br> in theme components - so there would not be neccesary to use HTML tags when editing components...

Is there some solution for this? Or maybe something that will use rich text editor in components? Anything usefull would be nice Smile
Reply
#2
How are you running the component ?

There is the php function nl2br(); You could wrap your text in it.

PHP Code:
<?php

$text 
"faskldfjasdkfaskdfasdfsdf
asdfklsjdfasdf
sdf
as
df
asdfasdfasdf
"
;

echo 
nl2br($text);
?>

or for the component

PHP Code:
echo nl2br(get_component(blah)); 
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
I'm using
PHP Code:
<?php get_component('component-name'); ?>

I've tried the to use that funkction - but since I'm more designer didn't get the BR's - just single line Sad[/i]
Reply
#4
actually that wont work sorry, raw text just gets output, hmm, i might be able to do it with output buffering
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
PHP Code:
<?php
    ob_start
();
    
get_component('tagline');
    echo 
nl2br(ob_get_clean());
?>

That should work inside a theme file for a text only component
rich text components are coming in next major version.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#6
It would be nice to have a return_component function in GS. Could be useful for this and other uses...
Reply
#7
Yeah but we have to eval components since they contain php blocks, That is why we have to add "snippets" for non code templates.

Not sure there is a way to eval and not output non-code blocks, aside from wrapping components in output buffering.

We might be able to use http://www.php.net/manual/en/function.cr...nction.php instead of eval for components. I have never used it, it might have some advantage but I am not sure it would solve this problem.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#8
I mean a function that just returns the component as a string, unprocessed. Just like I18N's return_i18n_component.

Components can be used for other things, not only php scripts. Or you can have some component to be processed by a plugin, not just by get_component. (In fact some of mvleck's plugins do it -for custom rendering-, but I suppose they the above mentioned function to get the component content.)
Reply
#9
I think that creates inconsistencies. If you want the raw then you can always grab it manually from the array or xml.

Maybe if there was an additional parameter instead to $processphp(false), for get and return. Or get_components_text or similar?

I still prefer the idea of a seperate "component" type for static content.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#10
(2013-08-06, 00:37:03)shawn_a Wrote:
PHP Code:
<?php
    ob_start
();
    
get_component('tagline');
    echo 
nl2br(ob_get_clean());
?>

That should work inside a theme file for a text only component
rich text components are coming in next major version.

thank, it works....
Reply




Users browsing this thread: 1 Guest(s)