wysiwyg editor and patTemplate

A general technical discussion area for patTemplate.
Locked
ford
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 166
Joined: Thu Aug 18, 2005 11:45 am

wysiwyg editor and patTemplate

Post by ford » Wed Nov 30, 2005 11:00 pm

How does one go about getting patTemplate and wysiwyg editors to work together? How does the PHP code look like? Any help would be deeply appreciated!

Cheers from

Ford

User avatar
Vimes
Joomla! Ace
Joomla! Ace
Posts: 1682
Joined: Fri Aug 19, 2005 12:14 am
Location: United Kingdom
Contact:

Re: wysiwyg editor and patTemplate

Post by Vimes » Fri Dec 02, 2005 1:50 am

As it happens I've been experimenting with this today, trying to feed the editor into a template, unfortunately editorArea appears to be a javascript function (I should have figured that out just by looking at content.html.php, duh!) rather than something that lives in joomla.php or one of the other wonderful little scripts that come with J!.

I'll be following this thread.
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.

goetzi
Joomla! Apprentice
Joomla! Apprentice
Posts: 30
Joined: Fri Aug 19, 2005 3:02 pm
Location: Schwarzach i.V., Austria
Contact:

Re: wysiwyg editor and patTemplate

Post by goetzi » Sun Jan 08, 2006 5:32 pm

Has anyone solved this problem? I also wanted to integrate the WYSIWYG-Editor into a pattemplate, but I didn't get it running.

User avatar
Vimes
Joomla! Ace
Joomla! Ace
Posts: 1682
Joined: Fri Aug 19, 2005 12:14 am
Location: United Kingdom
Contact:

Re: wysiwyg editor and patTemplate

Post by Vimes » Sun Jan 08, 2006 7:46 pm

Nope
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.

ford
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 166
Joined: Thu Aug 18, 2005 11:45 am

Re: wysiwyg editor and patTemplate

Post by ford » Sun Jan 22, 2006 3:09 pm

Still no one who has a clue on what to do? It would be a real pity if this remains unsolved ......  :'(

Cheers

Ford

wene
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 203
Joined: Sat Aug 20, 2005 1:40 am
Location: south of France

Re: wysiwyg editor and patTemplate

Post by wene » Mon Jan 23, 2006 1:51 am

sorry, but i dont use wyg editors ...

User avatar
louis.landry
Joomla! Ace
Joomla! Ace
Posts: 1388
Joined: Wed Aug 17, 2005 11:03 pm
Location: San Jose, California
Contact:

Re: wysiwyg editor and patTemplate

Post by louis.landry » Mon Jan 23, 2006 1:54 am

I found some serious flaws in the way this is handled in the 1.0.x series when trying to use patTemplate.  This is why i've changed the system to use a class called JEditor in 1.1

The main problem i ran into is that the editor functions echo code instead of returning it.  By echoing the code to the output buffer they do not allow you to insert it into the patTemplate object.  One way to get around this may be to capture the output using the php output buffer methods, though i haven't played with it.

Louis
Joomla Platform Maintainer
A hacker does for love what others would not do for money.

ford
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 166
Joined: Thu Aug 18, 2005 11:45 am

Re: wysiwyg editor and patTemplate

Post by ford » Sat Jan 28, 2006 12:38 pm

Okay, thanks for your reply. I'll have a look at this JEditor stuff.

Dang - it's a bit annoying since I was just getting familiar with patTemplate whilst rewriting my component. But patTemplate is still useful though and has some nice advantages.

Cheers

Ford  :)

audienceone
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 214
Joined: Thu Aug 18, 2005 2:01 pm
Contact:

Re: wysiwyg editor and patTemplate

Post by audienceone » Tue Feb 14, 2006 1:01 am

webImagery wrote: The main problem i ran into is that the editor functions echo code instead of returning it.  By echoing the code to the output buffer they do not allow you to insert it into the patTemplate object.  ...
Exactly! Until a core solution is decided or reached, another way to go around this problem is create a function for yourself/component to initialize the template and give you the correct code to push into patTemplate.

All you have to do is lift the code from the editor.php that initializes the editor bots and change the echo code to return. I have already done this (before stumbling upon this thread) on a component I was working on. And of course change a few variables to make sure I can initialize editors inside the logic codes to patTemplate.

If anyone is interested, just give this thread a bump or pm me and i'll post the little hack and implementation
"Speak your truth quietly and clearly; and listen to others; even the dull and ignorant, for they too have their story
...
If you compare yourself with others you may become vain or bitter, for always there will be greater and lesser person than yourself."

AndromAK
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Sat Feb 04, 2006 12:30 am
Location: Bordeaux, France

Re: wysiwyg editor and patTemplate

Post by AndromAK » Thu Mar 23, 2006 3:59 am

hi Audienceone !!

I think using pattemplates is a very good thing, because when html and php code are together, it's very ugly. Pat template is a very elegant way to do. But joomla is not yet prepared to it. There is too much echoooes functions.

But I am very interested about using wysiwyg editor with pattemplates.

could you show us the hack to do so?

because I can't find how to do with patTemplate without hack...

Thanks

(excuse me for my poor english!!!  :'( )
Signature rules: http://forum.joomla.org/index.php/topic,65.0.html
No images allowed.

Maik
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Mar 01, 2006 9:35 pm

Re: wysiwyg editor and patTemplate

Post by Maik » Wed Mar 29, 2006 10:15 pm

If anyone is interested, just give this thread a bump or pm me and i'll post the little hack and implementation
i am interestedt

runing j107 an ark_cornerdemo not getting any editor in the frontend to work

can anybody hep?

thx
Maik

davidrrm
Joomla! Explorer
Joomla! Explorer
Posts: 251
Joined: Mon Sep 05, 2005 3:50 pm

Re: wysiwyg editor and patTemplate

Post by davidrrm » Mon Apr 10, 2006 1:58 pm

This is the code I use to return an "HTMLEditor" string that I then add to the template as a variable.

Code: Select all

	// Returns the editor area as a text string for inclusion in a template
function editorAreaText( $name, $content, $hiddenField, $width, $height, $col, $row ) {
    global $mainframe, $_MAMBOTS, $my;

    $ret = "";
		
    // ensure editor-xtd bots are loaded only once
    if (!defined( '_JOS_EDITORXTD_INCLUDED' )) {
        define( '_JOS_EDITORXTD_INCLUDED', 1 );
        $_MAMBOTS->loadBotGroup( 'editors-xtd' );
    }
		
    $mainframe->set( 'loadEditor', true );

    $results = $_MAMBOTS->trigger( 'onEditorArea', array( $name, $content, $hiddenField, $width, $height, $col, $row ) );
        foreach ($results as $result) {
            if (trim($result)) {
                $ret .= $result;
            }
        }
		
    return $ret;
}
It's just the existing editorArea() code but creates a string rather than echoing the results. It could probably be done more elegantly with output buffers, but I didn't try that.

david

User avatar
Vimes
Joomla! Ace
Joomla! Ace
Posts: 1682
Joined: Fri Aug 19, 2005 12:14 am
Location: United Kingdom
Contact:

Re: wysiwyg editor and patTemplate

Post by Vimes » Mon Apr 10, 2006 2:50 pm

Looks like a fab idea, unfortunately $name isn't being seen and the text area is simply returning "". (Your mileage may vary).

Gonna haveta dig deepa, I think.

Edit: Strangely enough, when I call editorArea, the same thing happens, although other forms are fine.
Last edited by Vimes on Mon Apr 10, 2006 3:02 pm, edited 1 time in total.
http://www.jomres.net THE online hotel booking and reservation system for Joomla and Wordpress.

Alejo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 19, 2005 12:28 pm
Contact:

Re: wysiwyg editor and patTemplate

Post by Alejo » Thu Aug 24, 2006 2:20 pm

So, is there really no solution to this?
JReviews • Directory and reviews extension https://www.jreviews.com

Alejo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 19, 2005 12:28 pm
Contact:

Re: wysiwyg editor and patTemplate

Post by Alejo » Thu Aug 24, 2006 5:36 pm

I will have to answer myself ;)

I had tried several things, including the extended Php funtion for patTemplate that allows php code inside templates, but it did not always load the editor, especially in Firefox. To add to that, I really need to load the editor through xajax, and in that case it was not loading the editor at all. So I did some searching and found this page:

http://wiki.xajaxproject.org/Tips_and_Tricks:tinyMCE

and it works! At least it displays the editor, I have not tried submitting anything yet, but I thought I would share it here. I just have an empty div in patTemplate and send the editor to that div using xajax.

The only thing is that am not able to use the initEditor() to load the editor javascript. So right now I added this code to the template:

Code: Select all

		<script type="text/javascript" src="{LIVE_SITE}/mambots/editors/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
		<script type="text/javascript">	
		tinyMCE.init({mode : "none"});
                </script>
And then followed the example in the link above.

I will continue playing with it to see if I can use Joomla's built in editor functions to load the javascript.
JReviews • Directory and reviews extension https://www.jreviews.com

Alejo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Fri Aug 19, 2005 12:28 pm
Contact:

Re: wysiwyg editor and patTemplate

Post by Alejo » Thu Aug 24, 2006 8:13 pm

Ok, I got as far as figuring out that:

$mainframe->set( 'loadEditor', true );

loads the editor javascript, but that's it, if anyone has more luck in getting this to work without having it tied to a single editor please post the solution here.
JReviews • Directory and reviews extension https://www.jreviews.com


Locked

Return to “patTemplate”