{cptags} positionning in k2 items

  • pmarty
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 9 months ago #1359 by pmarty
{cptags} positionning in k2 items was created by pmarty
Hello,

As I use a lot of extrafields for a category, I'd like to customize a item view in K2, and I need to gather extrafileds and cptags.
How to position {cptags} in the item template file I use to override default item view?
(eg: \templates\mytemplate\html\com_k2\templates\sports\item.php)

And how must CP plugin be configured for that goal?

I can't find any documentation to explain how to call 'cptags' from a php template file.

Thanks for your help.

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

More
10 years 9 months ago #1364 by andrea_4g
Replied by andrea_4g on topic {cptags} positionning in k2 items
You need to set parameter 'Tags position: custom' in plugin Content - Custom Properties Tags Plugin.
Then you can place the {cptags} placeholder within the text of your K2 article.

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

  • pmarty
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 9 months ago - 10 years 9 months ago #1369 by pmarty
Replied by pmarty on topic {cptags} positionning in k2 items
Hello,

Thanks for your answer.
I was searching for a solution to call cptags from the k2 template file itself (php file) not adding {cptags} in the content area.

In fact in this part of the website, k2 itemss do not have content, but only extrafields, and I rebuild a specific view of information through extrafields reorganization. And I need to call cptags between two line of extrafields :)
Is it possible to call a plugin action from the template php file?

Philippe
Last edit: 10 years 9 months ago by pmarty.

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

More
10 years 9 months ago #1373 by andrea_4g
Replied by andrea_4g on topic {cptags} positionning in k2 items
I understand now. We developed a K2 plugin that is able to retrieve CP Tags and place them into K2 template file, with few lines of code.
I'm not able to send you such plugin at the moment. I'll do that as soon as I get back to the office. (please wait a couple of days)

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

More
10 years 9 months ago - 10 years 9 months ago #1377 by andrea_4g
Replied by andrea_4g on topic {cptags} positionning in k2 items
This is the the K2 plugin:

File Attachment:

File Name: plg_custom...ld10.zip
File Size:2 KB


The plugin adds a cptags object to the k2 item. In your k2 template you can access all cptags associated to the k2 item by reading:
Code:
$this->item->cptags
Inside the object you find a structure like the following
Code:
stdClass Object ( [price] => Array ( [0] => stdClass Object ( [fid] => 1 (value id) [fname] => price [flabel] => Price [vid] => 10 (value id) [vname] => average [vlabel] => Average [url_label] => Average [cid] => 145 (article id ) [article_title] => Average Article [article_intro] => Lorem Ipsum dolor ... [article_fulltext] => ) [1] => stdClass Object ( [fid] => 1 (value id) [fname] => price [flabel] => Price [vid] => 12 (value id) [vname] => expensive [vlabel] => Expensive [url_label] => Expensive [cid] => 131 (article id ) [article_title] => Expensive Article [article_intro] => Lorem Ipsum dolor ... [article_fulltext] => ) ) [spiciness] => Array ( [0] => stdClass Object ( [fid] => 2 [fname] => spiciness [flabel] => Spiciness [vid] => 23 [vname] => mild [vlabel] => Mild [url_label] => Mild [cid] => 235 [article_title] => Mild Article [article_intro] => Lorem ipsum dolor sit maet ... [article_fulltext] => ) ) )
Please note that the plugin retrieves also the title and the content of the article associated to the cptag (if any). An unseful feature that let you embed articles into your k2 item by means of cptags.
Attachments:
Last edit: 10 years 9 months ago by andrea_4g.

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

Time to create page: 0.174 seconds