Keyword

Custom K2 Content Module Assistance

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
7 years 7 months ago #157647 by Joe Campbell
Custom K2 Content Module Assistance was created by Joe Campbell
I need assistance creating a K2 Content Module (override) that renders the current item title, tags and specific extra fields.

I saw that @MohamedAbdelaziz recommended BNR Content for K2 on this forum post:
www.joomlaworks.net/forum/k2-en/46416-solved-how-to-call-k2-viewed-item-s-title-creation-date#156871

I would prefer an override solution instead of using an additional extension.

I would like to render the following example via the K2 Content Override:

<?php echo $item->title; ?>
<?php echo $item->extraFields->bannerOne->value; ?>
<?php echo $this->item->tags[0]->link; ?>

Would you be able to assist me with cut & paste solution.

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
7 years 7 months ago #157648 by Joe Campbell
Replied by Joe Campbell on topic Custom K2 Content Module Assistance
I also see that the extension does not play nice with K2v2.7
bnrjoomla.com/forums/posts/f2/t16/k2-bnr-nonfunctional-since-update-to-k2-2-7.html

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #157651 by Krikor Boghossian
Replied by Krikor Boghossian on topic Custom K2 Content Module Assistance
Cut and paste no.
Copy paste yes.

Actually the code seems correct, apart from the
$this->item->tags[0]->link;

where this should be used instead
$item->tags[0]->link;

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

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
7 years 7 months ago #157655 by Joe Campbell
Replied by Joe Campbell on topic Custom K2 Content Module Assistance
That's for the correction - "Copy & Paste"

Perhaps I did not property present my need.

I want to use a K2 Content Module override to display the title, specific tag(s), and specific extra field(s) of the current item being viewed.

The following sample K2 Content Module override code does not render the desired content for the current item being viewed.
<?php
// no direct access
defined('_JEXEC') or die;
?>

<?php echo $item->title; ?>
<?php echo $item->extraFields->bannerOne->value; ?>
<?php echo $item->tags[0]->link; ?>
<?php echo $item->tags[0]->link; ?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago - 7 years 7 months ago #157657 by Krikor Boghossian
Replied by Krikor Boghossian on topic Custom K2 Content Module Assistance
You would need to query the database in order to retrieve the data.
I'll look into a solution. It is not that simple.

Furthermore I think this should be done as a PHP standalone module.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 7 years 7 months ago by Krikor Boghossian.

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
7 years 7 months ago #157658 by Joe Campbell
Replied by Joe Campbell on topic Custom K2 Content Module Assistance
Ok - Thanks

Do you mean PHP standalone module, as in not a K2 Content Module?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #157660 by Krikor Boghossian
Replied by Krikor Boghossian on topic Custom K2 Content Module Assistance
Yes, a new module would be better imo.

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

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
7 years 7 months ago #157661 by Joe Campbell
Replied by Joe Campbell on topic Custom K2 Content Module Assistance
Ok - any assistance would be much appreciated :)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 7 months ago #157662 by Krikor Boghossian
Replied by Krikor Boghossian on topic Custom K2 Content Module Assistance
A similar concept exists here:
gist.github.com/kricore/1e7ecf5ffdad017e547c

I 'll work on a solution.

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

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
7 years 7 months ago #157663 by Joe Campbell
Replied by Joe Campbell on topic Custom K2 Content Module Assistance
Gratitude :)

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


Powered by Kunena Forum