Keyword

Where do I find a list of all K2 parameter names?

  • Timothy Michel
  • Timothy Michel's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 4 months ago #128758 by Timothy Michel
For Instance, what are the parameters that go with "if ($this->params->get('catTitleItemCounter')" if I want to restrict the inclusion of content with something like: $this->itemCounter > 1. Is itemCounter the correct param that goes with get('catTitleItemCounter'), or where do Iocate these?.

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

More
10 years 4 months ago #128759 by Lefteris
Hi. The parameters are the variables that come from call like: $params->get('PARAM_NAME') . They are all defined in XML files inside K2. They are divided in three types:
1. Global K2 parameters. You can find them at administrator/components/com_k2/config.xml
2. Category and item parameters. You can find them at administrator/components/com_k2/models/category.xml and administrator/components/com_k2/models/item.xml.
3. Menu link parameters. You can find them under components/com_k2/view/VIEW_NAME/tmpl/LAYOUT_NAME.xml.

Note that these parameters are merged during the runtime depending on context. Regarding the rest variables you see in the template files they either come from the database or are computed during runtime in the view.html.php file of the current view.

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

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

  • Timothy Michel
  • Timothy Michel's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 4 months ago #128760 by Timothy Michel
Replied by Timothy Michel on topic Re: Where do I find a list of all K2 parameter names?
Thank you, I will print these out and tape them to my forehead.

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

  • Timothy Michel
  • Timothy Michel's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 4 months ago - 10 years 4 months ago #128761 by Timothy Michel
Replied by Timothy Michel on topic Re: Where do I find a list of all K2 parameter names?
This is what I settled on:

<?php if($this->params->get('catTitle')): ?>
<!-- Category title -->
<h2><?php echo $this->category->name; ?></h2><?php if($this->params->get('catTitleItemCounter') && $this->pagination->total==1) {echo '<h4 style="color:#a09db1;margin-top:-2.25em;text-shadow:none"><br />(There is 1 item in this section)</h4>';} elseif(!$this->params->get('catTitleItemCounter') && $this->pagination->total==1){ echo '<h4 style="color:#a09db1;margin-top:-2.25em;text-shadow:none"><br />(There are no items in this section yet)</h4>';} else {echo '<h4 style="color:#a09db1;margin-top:-2.25em;text-shadow:none"><br />(There are '.$this->pagination->total.' items in this section)</h4>';} ?>
<?php endif; ?>

I really don't understand this, can someone explain to me why this works?? I created it, but I don't understand what is going on.

catTitleItemCounter is set in params to display or not display, 1, 0; $this->pagination->total counts anything that produces a page including sub-categories and items. Yes I should remove the styles to css, I will do that later.

Is there a way to test for items/articles only and not items + sub-categories? In other word if a category contains 10 sub-categories but none of the subcategories contain any items/articles, is there a way to test for that?

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

More
10 years 4 months ago #128762 by Lefteris
The following variable holds the number of items of each subcategory inside the loop:
$subCategory->numOfItems

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

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

  • Timothy Michel
  • Timothy Michel's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 4 months ago #128763 by Timothy Michel
Replied by Timothy Michel on topic Re: Where do I find a list of all K2 parameter names?
But it has only function scope.

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

More
10 years 4 months ago #128764 by Lefteris
Yes. If you want to use it somewhere else you will have to query the database.

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

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


Powered by Kunena Forum