Keyword

[SOLVED] Item Title : additional field?

  • jonny jackson
  • jonny jackson's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago - 11 years 2 months ago #115835 by jonny jackson
[SOLVED] Item Title : additional field? was created by jonny jackson
Hello K2 Community,

I am building a website with K2 and I 'd would like to ask you, if anyone could help me this issue:


I'am trying to add an additional "field" in the title area like this.
<h1>
<span>additional title field</span>
Item Title from article 
</h1>

I tried to add this additional <span> throught "Extra Fields" Function of K2, but unfortunately it didn't work for me.


Does anyone have any idea, how I could fix it. Many thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 2 months ago #115836 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Title : additional field?
Hello Jonny,

You should use an extrafield for this field and output directly that field.

You can use the snippet from this post getk2.org/community/New-to-K2-Ask-here-first/171284-Where-to-edit-K2-after-Item-Fields

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • jonny jackson
  • jonny jackson's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago #115837 by jonny jackson
Replied by jonny jackson on topic Re: Title : additional field?
Hello Krikor,

thank you for your reply.

I'll give you feedback, after testing ! :)

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

  • jonny jackson
  • jonny jackson's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago - 11 years 2 months ago #115838 by jonny jackson
Replied by jonny jackson on topic Re: Title : additional field?
Hello Krikor,

the code snippet in another Post works fine. Once more thank you! :)

I have only one little issue with the displaying of the new field. It's displayed twice on the Item-Page. That's because of the code block <!-- Item extra fields --> in the item.php, which generates all fields automatically.

Is there any possibility to ignore a specific "EXTRAFIELDALIAS" in this code block?

It would be actually great, because in this way everyone could simply add any extra-field to any place of the item.php and ignore the new field in the main block of the extrafields.

For now I simply deleted the <!-- Item extra fields --> code block, but it's not very practical in the case, if I would add standard extra fields. (or I'd had to add every "EXTRAFIELDALIAS" manually )

Is there any code snippet for this issue? :blush:

Thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
11 years 2 months ago #115839 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Title : additional field?
You 're welcome Jonny.

You can exclude that particular extrafield from the loop. You can use a snippet like this.

[code]
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if ($extraField->id!=YOUR_EXTRAFIELD_ID): ?>
//code
<?php endif; ?>
<?php endforeach; ?>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • jonny jackson
  • jonny jackson's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago - 11 years 2 months ago #115840 by jonny jackson
Replied by jonny jackson on topic Re: Title : additional field?
Hi Krikor,

thanks again for the snippet!

I added it as recommeded, and its works.

It probably has some side affects (due to my php knowledge :cheer: ), but for now it suits my need absolutely


many thanks again, you can mark this topic as solved (I didn't find the solved-button :))

cheers

JJ

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

  • jonny jackson
  • jonny jackson's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago #115841 by jonny jackson
Replied by jonny jackson on topic Re: Title : additional field?
Hello, me again :)

I finally found the right place for the code, there is no "side effects" anymore. I simply tested some order variations for the exclude function in the loop :silly:

cheers

JJ

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


Powered by Kunena Forum