Page 1 of 1
Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Tue Nov 20, 2007 3:56 am
by snikch
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;
}
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Sun Nov 25, 2007 3:57 am
by Haiyang
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?
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Sun Nov 25, 2007 9:17 pm
by snikch
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.
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Mon Nov 26, 2007 6:37 pm
by xtreme79
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!
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Mon Nov 26, 2007 8:54 pm
by snikch
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.
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Mon Nov 26, 2007 10:46 pm
by adian
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.
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Mon Nov 26, 2007 10:50 pm
by snikch
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
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Mon Nov 26, 2007 10:55 pm
by adian
Many thanks!
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
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Tue Nov 27, 2007 11:54 am
by xtreme79
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.
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Fri Nov 30, 2007 7:55 pm
by pointri
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.
Re: Allow HTML input from WYSIWYG in Joomla 1.5
Posted: Mon Dec 24, 2007 2:52 pm
by laurahdarling
HTML and WYSIWYG two completely different way of editing, Why would you want to combine the 2