Keyword

k2 tools tag

  • claudio
  • claudio's Avatar Topic Author
  • Offline
  • New Member
More
8 years 2 months ago #151134 by claudio
Replied by claudio on topic k2 tools tag
this is the foreach in
/components/com_k2/views/itemlist/tmpl/tag.php
<?php foreach($this->items as $item): ?>

I think I have to do something before this code ...

I wait your help.

thank you

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 2 months ago #151138 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 tools tag
This function will allow you to read data from the URL
php.net/manual/en/reserved.variables.get.php

You need to use these two functions in order to get the array of ids.

php.net/manual/en/function.explode.php
php.net/manual/en/function.in-array.php

In order to check if that item's category id ($item->category->id) belongs in the following value

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

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

  • claudio
  • claudio's Avatar Topic Author
  • Offline
  • New Member
More
8 years 2 months ago #151240 by claudio
Replied by claudio on topic k2 tools tag
in top of this file
/components/com_k2/views/itemlist/tmpl/tag.php
I wrote
<?php 
$taggs = $_GET["category"]; 
$cat_tag = explode(",", $taggs);
?>
now I have an array with categories id. right?

the next step ... it' more difficult (for me)
I have to work befor this foreach?
<?php foreach($this->items as $item): ?>

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

  • claudio
  • claudio's Avatar Topic Author
  • Offline
  • New Member
More
8 years 2 months ago #151259 by claudio
Replied by claudio on topic k2 tools tag
works!!
<?php foreach($this->items as $item): ?>
        <?php if (in_array($item->category->id, $cat_tag)) { ?>		<!-- Item Layout -->
	<?php } ?>  	
		<?php endforeach; ?>


thank you

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


Powered by Kunena Forum