set col number instead odd/even as class for cols!?

8 years 2 months ago #30460 by pabro
Hi,

can anyone help me to customize the code in category_items.php to get numbered cols (li.classes) instead odd/even in each row?

<?php for ($i=($this->limitstart == 0 ? $leadnum : 0 ); $i<$count; $i++) : ?><li class="<?php echo (($this->limitstart == 0) ? ($i+$leadnum)%2 : $i%2) ? 'even' : 'odd'; ?>">

So if cols are set in backend to 3:
the cols (li) should has the classes col1, col2, col3 for each row.

if cols are set to 2:
col1, col2 for each row.

Thanks!

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

8 years 2 months ago #30463 by ggppdk
<li class="<?php echo 'col'.(($this->limitstart == 0) ? $i%3 : ($i-$leadnum)%3); ?>">

this should give you col0, col1, col2

test and correct ... regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

8 years 2 months ago #30465 by pabro
After inserting the "?" it works great :)
Thank you!
<li class="<?php echo 'col'.(($this->limitstart == 0) ? $i%3 : ($i-$leadnum)%3);?>">

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

8 years 2 months ago #30467 by ggppdk
Right, i have corrected it in my previous post


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

8 years 2 months ago #30477 by ggppdk
Hello,
I guess we could have both classes :
a. odd or even
b. coln

i will be in next commit,

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

8 years 2 months ago #30488 by ggppdk
To get a both odd / even classes and colN depending on number of columns configured replace:
<?php
	endif;
	if ($count > $leadnum || $this->limitstart != 0) :
		//added to intercept more columns (see also css changes)
		$classnum = '';
		if ($this->params->get('intro_cols', 2) == 1) :
			 $classnum = 'one';
		elseif ($this->params->get('intro_cols', 2) == 2) :
			 $classnum = 'two';
		elseif ($this->params->get('intro_cols', 2) == 3) :
			 $classnum = 'three';
		elseif ($this->params->get('intro_cols', 2) == 4) :
			 $classnum = 'four';
		endif;
?>
	<ul class="introblock <?php echo $classnum; ?>">	
		<?php for ($i=($this->limitstart == 0 ? $leadnum : 0 ); $i<$count; $i++) : ?>
		<li class="<?php echo (($this->limitstart == 0) ? ($i+$leadnum)%2 : $i%2) ? 'even' : 'odd'; ?>">
			<div style="overflow: hidden;">

with:
<?php
	endif;
	if ($this->limitstart != 0) $leadnum = 0;
	if ($count > $leadnum) :
		//added to intercept more columns (see also css changes)
		$intro_cols = $this->params->get('intro_cols', 2);
		$intro_cols_classes = array(
			1=>'one',2=>'two',3=>'three',4=>'four'
		);
		$classnum = $intro_cols_classes[$intro_cols];
?>
	<ul class="introblock <?php echo $classnum; ?>">	
		<?php 
		for ($i=$leadnum; $i<$count; $i++) :
			$li_item_classes  = $i%2 ? 'odd' : 'even';
			$li_item_classes .= ' col'.$i%$intro_cols;
		?>
		<li class="<?php echo $li_item_classes; ?>">
			<div style="overflow: hidden;">


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

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

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.