Keyword

Tag Listing Layout as Cat Listing Layout

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 6 months ago #164370 by Goble002
Hello,

I have an override for my category_item.php with is displaying category items nicely. Am looking for a way to display the items in tag listings with the same layout.

Am thinking of using the codes from category_item.php to include in tag.php. Any idea about the important lines of codes that should not be overwritten ?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 6 months ago #164377 by Krikor Boghossian
Replied by Krikor Boghossian on topic Tag Listing Layout as Cat Listing Layout
Only alter the HTML code (classes etc..) Do not alter any PHP stuff.

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

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

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 6 months ago #164381 by Goble002
Replied by Goble002 on topic Tag Listing Layout as Cat Listing Layout
Hello & many thanks Krikor,

this is what I was planning to do. However, the columns (for leading & primary) defined in Category 'Layout Grid' and being inherited by the items would not apply to the items in tag listings right ?

Any workaround you might think of ?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 6 months ago #164389 by Krikor Boghossian
Replied by Krikor Boghossian on topic Tag Listing Layout as Cat Listing Layout
You can check the $key ($key=>item) and print custom classes (grid classes maybe) which imitate the ones used in the category view.

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

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

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
6 years 6 months ago #164392 by Goble002
Replied by Goble002 on topic Tag Listing Layout as Cat Listing Layout
Thanks Krikor,

In category Layout grid: Leading count is set to 0. I'm using only Primary count (12) for which columns is set to 3. Very straight forward.

So it should be quite easy to load classes directly instead of using php to apply classes. I've identified the code in category.php as hereunder.

I have tested tried several times to include the lines with "$key ($key=>item)" but no luck.

<?php if(isset($this->primary) && count($this->primary)): ?>
		<!-- Primary items -->
		<div id="itemListPrimary">
		 <?php 
                      $primarycount=(count($this->primary));
                      $counter=0;
                      foreach($this->primary as $key=>$item): 
			
			 $customSpans = '';
			 $pcols = $this->params->get('num_primary_columns');
			 $spaces = 12; $cs = 0;
			 if (is_array($customSpans)) {
			 	$cs = count($customSpans);
			 }
	
			 $spanClass = floor($spaces / ($pcols - $cs));
			 if ($spanClass == 0) $spanClass = 1;
                         
			 $key= ($key-0)+1;
			 $rowcount=( ((int)$key-1) %	(int) $pcols) +1;
			 $row = $counter / $pcols;
			 if ($rowcount==1) : ?>
			 <div class="primary-row primarycols-<?php echo (int) $pcols;?> <?php echo 'row-'.$row ; ?> row-fluid">
			 <?php endif; ?>
			
			<div class="span<?php echo $spanClass;?>">
				<?php
					// Load category_item.php by default
					$this->item=$item;
					echo $this->loadTemplate('item');
				?>
			</div>
			 <?php $counter++; ?>
			 <?php if (($rowcount == $pcols) or ($counter ==$primarycount)): ?>
				</div>
			<?php endif; ?>
			<?php endforeach; ?>
			<div class="clr"></div>
		</div>
		<?php endif; ?>

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


Powered by Kunena Forum