IMPORTANT MESSAGE REGARDING THE FORUM

As you may already know, the JoomlaWorks Forum is powered by Kunena (the only decent forum component for Joomla).

Unfortunately, the latest update for Kunena has seemingly broken all code snippets (old and new) in the forum.

Until this message is removed, please paste any code as regular text - in other words, don't use the [code]...[/code] tags in Kunena's post editor.

Keyword

Adding HTML code into Extra Fields

More
10 years 2 months ago #76453 by Jock
Replied by Jock on topic Adding HTML code into Extra Fields
Yup ... so you change:

 

<?php echo $extraField->value; ?>

 

to this:

 

<?php echo JHTML::_('content.prepare', $extraField->value); ?>

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76454 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
Thank you.

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76455 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
When adding code into the extra fields, are you putting it into the "default value" for the "textarea" type?

 

I can only get the code to function if I put it into the k2 item's extra field tab directly.  This seems to not be the point of the extra field associated with a category.  I don't want to past in the code into each k2item.  I want to apply an extrafield to the whole category of items.

 

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76456 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
Which extra field type are you using for your code?

Jock said:
Hi Josh,

 

I am trying desperately to add some {gallery},{/gallery} code in an extra field but it is simply outputting the syntax.

 

I tried what you suggested above but it is not doing the job. I am using K2 2.4.1Is there something im missing here?

 

Many thanks if anyone has time to help me out here!

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76457 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
This is what I want to type into the textarea type extra field:

{modal url=http://www.primocraft.com/images/primo-craft-custom-bar-layouts.png}<img alt="mt_ignore:primocraft-master-bar-layout-icon" src="/images/primocraft-master-bar-layout-icon.jpg" height="76" width="88" />{/modal}

 

But when I save the extra field it reverts to:

{modal url=http://www.primocraft.com/images/primo-craft-custom-bar-layouts.png},{/modal}

 

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76458 by matthew turner
Replied by matthew turner on topic Adding HTML code into Extra Fields
Hi Modernmagic,

Please read the full posts re gallery plugins in extrafields here :

community.getk2.org/forum/topics/simple-image-gallery-does-not

All done via template over rides.... various options posted...

 

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76459 by josh tischer
Replied by josh tischer on topic Adding HTML code into Extra Fields
If the image html tag is being removed you need to ensure that html is allowed for that field when its saved.

 

originally when I worked on this issue I found that you needed to allow html content in the if statement before the variables are set then saved to the database.

 

Open up Administrator/components/com_k2/models/extrafield.php

 

You can always put in a die() command and print_r sections just after the variables are set so you know whats about to be saved, then adjust as needed. The below should help.

 

//line 32 - replaced if (!$row->bind(JRequest::get('post',JREQUEST_ALLOWHTML))) //around line 53 - replaced $objects = array (); $values = JRequest::getVar('option_value','','post','string',JREQUEST_ALLOWRAW); $names = JRequest::getVar('option_name','','post','string',JREQUEST_ALLOWRAW);

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76460 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
I have made the replacements to the extrafield.php as you described.

 

Now the code stays as is and nothing is stripped out in the extra fields editor.  Thank you Josh.

 

But even after the extra field group is assigned to the category, the code does not appear in the item editor extra field tab. And therefore does not appear in the frontend.

 

If I past the same code in the item editor extra field it works in the frontend.

 

1. Is the code from the extra field editor suppossed to be automatically copied into the item editor extra field tab?

2. If so then maybe there is something wrong that wont let it update.  Is there a cache for the extra fields?

3. The extra field title updates from the extra fields editor into the item extra field tab, but not the code in the textbox. Does that help solve this issue?

 

Here is the code for reference:

{modal url=http://www.primocraft.com/images/primo-craft-custom-bar-layouts.png}<img alt="mt_ignore:primocraft-master-bar-layout-icon" src="/images/primocraft-master-bar-layout-icon.jpg" height="76" width="88" />{/modal}

 

 

 

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76461 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
I don't know if this helps but I added a new item in that same category and the extra field's code gets automatically placed in the item extra fields tab.   And it works on the front end.

 

Therefore it appears that there is a saved state for the first item.  I have cleared the joomla cache, unpublished and republished the extra field but the code never gets updated.  However, the extra field's Name gets updates, as I have changed it to verify what gets updated.

 

 

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #76462 by josh tischer
Replied by josh tischer on topic Adding HTML code into Extra Fields
Have you tried testing with an extra field without the editor? Its my guess that the editor is causing issues. Try it in a normal text input not a text area.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum