- Posts: 118
COMMUNITY FORUM
Extra WYSIWYG fields
- Alan Sparkes
- Offline
- Premium Member
Less
More
14 years 2 months ago #68755
by Alan Sparkes
Replied by Alan Sparkes on topic Extra WYSIWYG fields
For anybody not quite getting the expected results this might help
The hack code
if ( $rows[$i]->type=='wysiwyg' ){
$value=$object->value;
}
is for front end /model/item.php
Whereas the code:
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
is for the backend admin model/item.php (on mine this is line 492)
hth
The hack code
if ( $rows[$i]->type=='wysiwyg' ){
$value=$object->value;
}
is for front end /model/item.php
Whereas the code:
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
is for the backend admin model/item.php (on mine this is line 492)
hth
Please Log in or Create an account to join the conversation.
- Keegan Green
- Offline
- New Member
Less
More
- Posts: 4
14 years 2 months ago #68756
by Keegan Green
Replied by Keegan Green on topic Extra WYSIWYG fields
Has this been added to the latest k2? It doesn't seem like it has, I have k2 v2.2 and Joomla 1.5.17. I managed to get it working, but the lines to replace are a bit different:
1/ Edit the administrator/components/com_k2/models/extrafield.php file
Line 186 :
Replace :
$output='';
With :
$editor =& JFactory::getEditor();
$output = $editor->display("K2ExtraField_".$extraField->id."", $active, '550', '400', '60', '20', false);
2/ Edit the administrator/components/com_k2/models/item.php file
Line 491 :
Replace :
$variables = JRequest::get('post');
with :
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
fidelis semper said:Well done.. has anybody even seen this? Thank you FaïWoueb, this works!!!! yo urock. thank you to K2!
FaïWoueb said:I found a solution ! 1/ Edit the administrator/components/com_k2/models/extrafield.php file
Line 164 :
Replace :
$output='';
By :
$editor =& JFactory::getEditor();
$output = $editor->display("K2ExtraField_".$extraField->id."", $active, '550', '400', '60', '20', false);
2/ Edit the administrator/components/com_k2/models/item.php file
Line 462 :
Replace :
$variables = JRequest::get('post');
By :
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
... and that's all folks.
1/ Edit the administrator/components/com_k2/models/extrafield.php file
Line 186 :
Replace :
$output='';
With :
$editor =& JFactory::getEditor();
$output = $editor->display("K2ExtraField_".$extraField->id."", $active, '550', '400', '60', '20', false);
2/ Edit the administrator/components/com_k2/models/item.php file
Line 491 :
Replace :
$variables = JRequest::get('post');
with :
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
fidelis semper said:Well done.. has anybody even seen this? Thank you FaïWoueb, this works!!!! yo urock. thank you to K2!
FaïWoueb said:I found a solution ! 1/ Edit the administrator/components/com_k2/models/extrafield.php file
Line 164 :
Replace :
$output='';
By :
$editor =& JFactory::getEditor();
$output = $editor->display("K2ExtraField_".$extraField->id."", $active, '550', '400', '60', '20', false);
2/ Edit the administrator/components/com_k2/models/item.php file
Line 462 :
Replace :
$variables = JRequest::get('post');
By :
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
... and that's all folks.
Please Log in or Create an account to join the conversation.
- normdouglas
- Offline
- New Member
Less
More
- Posts: 18
14 years 2 months ago #68757
by normdouglas
Replied by normdouglas on topic Extra WYSIWYG fields
Just for someone else finding this (A STICKY PERHAPS?)... the above solution is what I needed.
Essentially I don't care about a WYSIWYG, rather I wanted to be able to use HTML inside a field without it being stripped.
The above solution worked for me, thanks.
Essentially I don't care about a WYSIWYG, rather I wanted to be able to use HTML inside a field without it being stripped.
The above solution worked for me, thanks.
Please Log in or Create an account to join the conversation.
- FaïWoueb
- Offline
- New Member
Less
More
- Posts: 2
14 years 6 days ago #68758
by FaïWoueb
Replied by FaïWoueb on topic Extra WYSIWYG fields
Hello !
I'm happy to discover that in the last release (v 2.4.1), now it's possible to have a wysiwyg editor for extrafields.
But ... it remains 1 problem, the HTML is not save.
I keep my solution founded 1 year ago :
In the file "administrator/components/com_k2/models/item.php",
replace
$variables = JRequest::get('post', 4); - line 510 -
by
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
FaïWoueb said:I found a solution !
1/ Edit the administrator/components/com_k2/models/extrafield.php file
Line 164 :
Replace :
$output='';
By :
$editor =& JFactory::getEditor();
$output = $editor->display("K2ExtraField_".$extraField->id."", $active, '550', '400', '60', '20', false);
2/ Edit the administrator/components/com_k2/models/item.php file
Line 462 :
Replace :
$variables = JRequest::get('post');
By :
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
... and that's all folks.
I'm happy to discover that in the last release (v 2.4.1), now it's possible to have a wysiwyg editor for extrafields.
But ... it remains 1 problem, the HTML is not save.
I keep my solution founded 1 year ago :
In the file "administrator/components/com_k2/models/item.php",
replace
$variables = JRequest::get('post', 4); - line 510 -
by
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
FaïWoueb said:I found a solution !
1/ Edit the administrator/components/com_k2/models/extrafield.php file
Line 164 :
Replace :
$output='';
By :
$editor =& JFactory::getEditor();
$output = $editor->display("K2ExtraField_".$extraField->id."", $active, '550', '400', '60', '20', false);
2/ Edit the administrator/components/com_k2/models/item.php file
Line 462 :
Replace :
$variables = JRequest::get('post');
By :
$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
... and that's all folks.
Please Log in or Create an account to join the conversation.
- Jock
- Offline
- Premium Member
Less
More
- Posts: 90
13 years 2 months ago #68759
by Jock
Replied by Jock on topic Extra WYSIWYG fields
Hi,
I am having troubles adding {gallery},{/gallery} code to extra fields in K2 2.4.1 ... it is just outputting the syntax. It works fine on the content tab but not the extra field tab?
Anyone know what I can try ... I've tried most of the above, what am I missing?
I am having troubles adding {gallery},{/gallery} code to extra fields in K2 2.4.1 ... it is just outputting the syntax. It works fine on the content tab but not the extra field tab?
Anyone know what I can try ... I've tried most of the above, what am I missing?
Please Log in or Create an account to join the conversation.
- Maurizio Peisino
- Offline
- New Member
Less
More
- Posts: 3
13 years 1 week ago #68760
by Maurizio Peisino
Replied by Maurizio Peisino on topic Extra WYSIWYG fields
You just need to take $active[0] instead of $active, these changes work for me:
1/ Edit the administrator/components/com_k2/models/extrafield.php fileLine 208:Replace :$output='<textarea name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" rows="10" cols="40" class="k2ExtraFieldEditor">'.$active[0].'</textarea>';By :$editor =& JFactory::getEditor();$output = $editor->display("K2ExtraField_".$extraField->id."", $active[0], '550', '400', '60', '20', false);2/ Edit the administrator/components/com_k2/models/item.php fileLine 511:Replace :$variables = JRequest::get('post');By :$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
Steve said:
I've been able to get the editor to show up using FaïWoueb's solution, but unfortunately NOTHING will save. The solo word "Array" appears in the text area and cannot be overwritten. Any idea what could be going on? I'm using k2 2.3.
1/ Edit the administrator/components/com_k2/models/extrafield.php fileLine 208:Replace :$output='<textarea name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" rows="10" cols="40" class="k2ExtraFieldEditor">'.$active[0].'</textarea>';By :$editor =& JFactory::getEditor();$output = $editor->display("K2ExtraField_".$extraField->id."", $active[0], '550', '400', '60', '20', false);2/ Edit the administrator/components/com_k2/models/item.php fileLine 511:Replace :$variables = JRequest::get('post');By :$variables = JRequest::get('post',JREQUEST_ALLOWRAW);
Steve said:
I've been able to get the editor to show up using FaïWoueb's solution, but unfortunately NOTHING will save. The solo word "Array" appears in the text area and cannot be overwritten. Any idea what could be going on? I'm using k2 2.3.
Please Log in or Create an account to join the conversation.