Allow HTML input from WYSIWYG in Joomla 1.5

A forum with Tips, tricks and small tutorials.

Moderators: mcsmom, unixboymd

Forum rules
Post Reply
snikch
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Mar 09, 2007 1:36 am

Allow HTML input from WYSIWYG in Joomla 1.5

Post by snikch » Tue Nov 20, 2007 3:56 am

Ok, so I was recently pulling my hair out while trying to get the wysiwyg editor to keep the formatting for a textarea. By default it appears Joomla1.5 (RC3) was removing all HTML formatting.

To fix this, you need to add a line to replace the variable with the html allowed version, and this is done in the table.

If you already have a check function in your table, just put the '$this->description' line in, otherwise create the whole check function.

In this case the name of the input is 'description', and I'm telling it to be replaced with the 'description' POST variable, but using the JREQUEST_ALLOWHTML mask.

Code: Select all

function check(){
/**
* replace both instances of 'description' with your input name
*/
$this->description = JRequest::getVar('description','','POST','STRING',JREQUEST_ALLOWHTML);
return true;
}

Haiyang
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Nov 16, 2005 1:10 am
Contact:

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by Haiyang » Sun Nov 25, 2007 3:57 am

I think HTML and WYSIWYG two completely different way of editing, much like MS Word and VIM. Why do you want to combine them together?
English to Chinese Translator
http://www.chineservice.com

snikch
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Mar 09, 2007 1:36 am

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by snikch » Sun Nov 25, 2007 9:17 pm

Haiyang wrote:I think HTML and WYSIWYG two completely different way of editing, much like MS Word and VIM. Why do you want to combine them together?


Um, I'm not sure you know what you're talking about - we're talking about the serverside handling of the WYSIWYG textareas output, which is in HTML.

Try clicking the 'HTML' button next time you see a WYSIWYG and you'll see that it's all actually HTML.

xtreme79
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jul 12, 2007 8:38 am

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by xtreme79 » Mon Nov 26, 2007 6:37 pm

Looks good! But I dont understand which php-file I have to edit or how to do it.

Where do I have to paste this?

function check(){
/**
* replace both instances of 'description' with your input name
*/
$this->description = JRequest::getVar('description','','POST','STRING',JREQUEST_ALLOWHTML);
return true;
}


Thanks!

snikch
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Mar 09, 2007 1:36 am

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by snikch » Mon Nov 26, 2007 8:54 pm

It goes in the 'table' file that correlates to the database table you are trying to edit / create. If you don't know what a table file is, I suggest reading through the admin part of the MVC tutorial that's on the Joomla site somewhere.

adian
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Nov 26, 2007 10:39 pm
Contact:

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by adian » Mon Nov 26, 2007 10:46 pm

I'm a new guy in the forum, will can get the MVC tutorial? Thanks!

snikch wrote:It goes in the 'table' file that correlates to the database table you are trying to edit / create. If you don't know what a table file is, I suggest reading through the admin part of the MVC tutorial that's on the Joomla site somewhere.
Kevin

snikch
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Mar 09, 2007 1:36 am

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by snikch » Mon Nov 26, 2007 10:50 pm

adian wrote:I'm a new guy in the forum, will can get the MVC tutorial? Thanks!


It's a little outdated, but it's how I started writing my first component (don't be afraid, it's only a little hump of a learning curve)

MVC Tutorial

adian
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Nov 26, 2007 10:39 pm
Contact:

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by adian » Mon Nov 26, 2007 10:55 pm

Many thanks!  :D :D :D snikch.

snikch wrote:
adian wrote:I'm a new guy in the forum, will can get the MVC tutorial? Thanks!


It's a little outdated, but it's how I started writing my first component (don't be afraid, it's only a little hump of a learning curve)

MVC Tutorial
Kevin

xtreme79
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Jul 12, 2007 8:38 am

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by xtreme79 » Tue Nov 27, 2007 11:54 am

I need this function because I am trying to insert an image with html code in the description of the link in Joomla weblinks. I tried to paste the function in components/com_weblinks/models/weblink.php but nothing happened. Do I have to change somewhere else?
I am using the Joomla 1.5 latest night build.

User avatar
pointri
Joomla! Apprentice
Joomla! Apprentice
Posts: 38
Joined: Wed Aug 24, 2005 2:02 pm
Location: Rhode Island, USA

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by pointri » Fri Nov 30, 2007 7:55 pm

Looking at that hanging helper file in the administrator portion of com_content, I just noticed that JREQUEST_ALLOWHTML has been switched out sometime back in October with a JREQUEST_ALLOWRAW flag.  So to get marked up editor text from a request, I'm finding

Code: Select all

$object->text = JRequest::getVar('text', '', 'post', 'string', JREQUEST_ALLOWRAW );


in the core components.  Using JREQUEST_ALLOWHTML at the moment appears to strip out HTML tags.

laurahdarling
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Dec 24, 2007 2:48 pm

Re: Allow HTML input from WYSIWYG in Joomla 1.5

Post by laurahdarling » Mon Dec 24, 2007 2:52 pm

HTML and WYSIWYG two completely different way of editing,  Why would you want to combine the 2


Post Reply