Keyword

Adding HTML code into Extra Fields

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 4 months ago #76433 by Red Evolution
Adding HTML code into Extra Fields was created by Red Evolution
Hi,

Is it possible to allow HTML code to be added into extra fields. Currently this is 'zapped' when you save. I'd like to add RomanCart shopping cart code (HTML and Javascript) into extra fields.

cheers

d

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

More
15 years 4 months ago #76434 by ronildo
Replied by ronildo on topic Adding HTML code into Extra Fields
It is possible, but you have to hack K2 core files.
Here is a link: k2community.joomlaworks.gr/forum/topics/extra-wysiwyg-fields?x=1&id=3536014%3ATopic%3A1366&page=2#comments

I did that and it worked quit nice to me.

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 4 months ago #76435 by Red Evolution
Replied by Red Evolution on topic Adding HTML code into Extra Fields
I may be wrong but I don't think this is what I need. I want to past an HTML form into a simple text area (no WYSIWYG editor needed) and for the code to be untouched on save.

d

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

More
15 years 4 months ago #76436 by ronildo
Replied by ronildo on topic Adding HTML code into Extra Fields
Then just do second part:
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);

Try it.

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 4 months ago #76437 by Red Evolution
Replied by Red Evolution on topic Adding HTML code into Extra Fields
Fantastic, thanks. I wonder if this could be added to the global parameters so we don't create a non standard install of K2?

d

Ronildo Costa said:Then just do second part: 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);

Try it.

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

More
15 years 4 months ago #76438 by ronildo
Replied by ronildo on topic Adding HTML code into Extra Fields
Let's wait the new version... it supposed to be available this week.

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 4 months ago #76439 by Red Evolution
Replied by Red Evolution on topic Adding HTML code into Extra Fields
Good plan! ;) Thanks for your help, it's very much appreciated.

d

Ronildo Costa said:Let's wait the new version... it supposed to be available this week.

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 3 months ago #76440 by Red Evolution
Replied by Red Evolution on topic Adding HTML code into Extra Fields
For the record I tried this and it worked a treat!

d

Dave Robinson said:Good plan! ;) Thanks for your help, it's very much appreciated.
d

Ronildo Costa said:Let's wait the new version... it supposed to be available this week.

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

  • Red Evolution
  • Red Evolution's Avatar Topic Author
  • Offline
  • Premium Member
More
15 years 3 months ago #76441 by Red Evolution
Replied by Red Evolution on topic Adding HTML code into Extra Fields
To allow raw html in K2 v2.2 extra fields I've done this....

administrator/components/com_k2/models/item.php

line 491 replace this:

$variables = JRequest::get('post');

with this:

$variables = JRequest::get('post',JREQUEST_ALLOWRAW);

Hop this helps

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

More
15 years 3 months ago #76442 by ckka
Replied by ckka on topic Adding HTML code into Extra Fields
Thanks Dave.... I wish I would have seen your solution prior to posting. Worked for me.

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

More
14 years 3 months ago #76443 by Amy L Dent Beebe
Replied by Amy L Dent Beebe on topic Adding HTML code into Extra Fields
I can't seem to find the code above anywhere in any of my files...I ran a search on the entire site and it didn't come up, and I looked at the specific line.

 

I'm also confused because in the forums it seems to say that in any version after 2.3, this functionality is built in. I just downloaded 2.4 and I can't find any ability for an html field.

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

More
14 years 3 months ago #76444 by william white
Replied by william white on topic Adding HTML code into Extra Fields
Try looking in administrator/components/com_k2/controlers/ for the files

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

More
14 years 3 months ago #76445 by Amy L Dent Beebe
Replied by Amy L Dent Beebe on topic Adding HTML code into Extra Fields
I used Dreamweaver to do a search of the source code for the entire site, and neither of the pieces of code mentioned in the solution were found.

William White said:
Try looking in administrator/components/com_k2/controlers/ for the files

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

More
14 years 3 months ago #76446 by william white
Replied by william white on topic Adding HTML code into Extra Fields
You are correct - I used grep to search 2.4 and cannot locate it either. The code must have been changed. The files in question are there, but do not contain that particular code. Im not sure exactly what was changed

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

More
14 years 1 month ago #76447 by josh tischer
Replied by josh tischer on topic Adding HTML code into Extra Fields
in k2 2.4.1 this hack didn't exactly work I had to modify some other code.

 

details and documentation

 

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

More
13 years 9 months ago #76448 by Jock
Replied by Jock on topic Adding HTML code into Extra Fields
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
13 years 9 months ago #76449 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
I too would like to do this with 2.4.1

 

Anyone have any solutions?

 

 

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
13 years 9 months ago #76450 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
I found this info online but have yet to get it to work:

blog.codepyro.com/2011/03/enable-html-in-joomla-k2-extra-fields.html

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

More
13 years 9 months ago #76451 by Jock
Replied by Jock on topic Adding HTML code into Extra Fields
I ended up changing the code where it outputs the extrafields in item.php to this

 

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

 

Worked a treat ^

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

More
13 years 9 months ago #76452 by Odin Mayland
Replied by Odin Mayland on topic Adding HTML code into Extra Fields
This appears to be the extrafields output in the item.php

 

<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?> <!-- Item extra fields -->
<div class="itemExtraFields">
<h3><?php echo JText::_('Additional Info'); ?></h3>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField):?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<br class="clr" />
</li>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>

 

Assuming this is the same code you have, can you past in yours so that I can see where your line goes?

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


Powered by Kunena Forum