change background color in blog view

More
14 years 7 months ago #6745 by micker
hello
i try to change the blog template in order to a a different color on two item of my blog display
for exemple 10 results
result 1 -blue background
result 2 -red background
result 3 -blue background .........
i created 2 class of css ligne1 end lign2
i do this with this code in my template
Code:
<div class="content"> <?php $leadnum = $this->params->get('lead_num', 2); $leadnum = ($leadnum >= $count) ? $count : $leadnum; if ($this->limitstart == 0) : ?> <ul class="leadingblock"> <?php for ($i=0; $i<$leadnum; $i++) : { for($j=0; $j<2; $j++) { $class = ($j%2) ? '1' : '2'; ?> <li> <div class="ligne<?php echo $class; ?>" style="overflow: hidden;"> <?php if ($this->params->get('show_title', 1)) : ?> <h2 class="contentheading"> <?php if ($this->params->get('link_titles', 0)) : ?> [url=<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $this->category->slug)); ?>]<?php echo $this->escape($items[$i]->title); ?>[/url] <?php else : echo $this->escape($items[$i]->title); endif; ?> </h2> <?php endif; ?> <?php if ($this->params->get('lead_use_image', 1)) : if ($this->params->get('lead_image')) : if (isset($items[$i]->fields[$this->params->get('lead_image')]->value[0])) : $dir{$i} = $items[$i]->fields[$this->params->get('lead_image')]->parameters->get('dir'); $value{$i} = unserialize($items[$i]->fields[$this->params->get('lead_image')]->value[0]); $image{$i} = $value{$i}['originalname']; $scr{$i} = $dir{$i}.($this->params->get('lead_image_size') ? '/'.$this->params->get('lead_image_size').'_' : '/l_').$image{$i}; else : $scr{$i} = ''; endif; $src = $scr{$i}; else : $src = flexicontent_html::extractimagesrc($items[$i]); endif; $w = '&w=' . $this->params->get('lead_width', 200); $h = '&h=' . $this->params->get('lead_height', 200); $aoe = '&aoe=1'; $q = '&q=95'; $zc = $this->params->get('lead_method') ? '&zc=' . $this->params->get('lead_method') : ''; $conf = $w . $h . $aoe . $q . $zc; if (!$this->params->get('lead_image_size')) : $thumb = JURI::base().'components/com_flexicontent/librairies/phpthumb/phpThumb.php?src='.JURI::base(true).'/'.$src.$conf; else : $thumb = $src; endif; if ($src) : // case source ?> <div class="image<?php echo $this->params->get('lead_position') ? ' right' : ' left'; ?>"> <?php if ($this->params->get('lead_link_image', 1)) : ?> <a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $this->category->slug)); ?>" class="hasTip" title="<?php echo JText::_( 'FLEXI_READ_MORE_ABOUT' ) . '::' . $this->escape($items[$i]->title); ?>"> <img src="<?php echo $thumb; ?>" alt="<?php echo $this->escape($items[$i]->title); ?>" /> <?php else : ?> <img src="<?php echo $thumb; ?>" alt="<?php echo $this->escape($items[$i]->title); ?>" /> <?php endif; ?> <div class="clear"></div> </div> <?php endif; // case source endif; ?> <!-- BOF above-description-line1 block --> <?php if (isset($items[$i]->positions['above-description-line1'])) : ?> <div class="lineinfo line1"> <?php foreach ($items[$i]->positions['above-description-line1'] as $field) : ?> <span class="element"> <?php if ($field->label) : ?> <span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span> <?php endif; ?> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF above-description-line1 block --> <!-- BOF above-description-nolabel-line1 block --> <?php if (isset($items[$i]->positions['above-description-line1-nolabel'])) : ?> <div class="lineinfo line1"> <?php foreach ($items[$i]->positions['above-description-line1-nolabel'] as $field) : ?> <span class="element"> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF above-description-nolabel-line1 block --> <!-- BOF above-description-line2 block --> <?php if (isset($items[$i]->positions['above-description-line2'])) : ?> <div class="lineinfo line2"> <?php foreach ($items[$i]->positions['above-description-line2'] as $field) : ?> <span class="element"> <?php if ($field->label) : ?> <span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span> <?php endif; ?> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF above-description-line2 block --> <!-- BOF above-description-nolabel-line2 block --> <?php if (isset($items[$i]->positions['above-description-line2-nolabel'])) : ?> <div class="lineinfo line1"> <?php foreach ($items[$i]->positions['above-description-line2-nolabel'] as $field) : ?> <span class="element"> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF above-description-nolabel-line1 block --> <p> <?php if ($this->params->get('lead_strip_html', 1)) : echo flexicontent_html::striptagsandcut( $items[$i]->introtext, $this->params->get('lead_cut_text', 400) ); else : echo $items[$i]->introtext; endif; ?> </p> <?php if ($this->params->get('show_readmore', 1)) : ?> <span class="readmore"> <a href="<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $this->category->slug)); ?>" class="readon"> <?php if ($items[$i]->params->get('readmore')) : echo ' ' . $items[$i]->params->get('readmore'); else : echo ' ' . JText::sprintf('FLEXI_READ_MORE', $items[$i]->title); endif; ?> </span> <?php endif; ?> <!-- BOF under-description-line1 block --> <?php if (isset($items[$i]->positions['under-description-line1'])) : ?> <div class="lineinfo line3"> <?php foreach ($items[$i]->positions['under-description-line1'] as $field) : ?> <span class="element"> <?php if ($field->label) : ?> <span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span> <?php endif; ?> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF under-description-line1 block --> <!-- BOF under-description-line1-nolabel block --> <?php if (isset($items[$i]->positions['under-description-line1-nolabel'])) : ?> <div class="lineinfo line3"> <?php foreach ($items[$i]->positions['under-description-line1-nolabel'] as $field) : ?> <span class="element"> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF under-description-line1-nolabel block --> <!-- BOF under-description-line2 block --> <?php if (isset($items[$i]->positions['under-description-line2'])) : ?> <div class="lineinfo line4"> <?php foreach ($items[$i]->positions['under-description-line2'] as $field) : ?> <span class="element"> <?php if ($field->label) : ?> <span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span> <?php endif; ?> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF under-description-line2 block --> <!-- BOF under-description-line2-nolabel block --> <?php if (isset($items[$i]->positions['under-description-line2-nolabel'])) : ?> <div class="lineinfo line4"> <?php foreach ($items[$i]->positions['under-description-line2-nolabel'] as $field) : ?> <span class="element"> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF under-description-line2-nolabel block --> </div> <?php endfor; ?> </li> <?php endfor; ?> </ul> <?php endif; ?> </div>
but it doesn't works on frist <?php endfor; ?> ...
any body can help me ?
Thanks for all

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
14 years 7 months ago #6787 by micker
nobody ??
:lol:

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
14 years 7 months ago - 14 years 7 months ago #6812 by Rehne
I do not know if I understand correctly
can you give me one more example
in my template
www.flexicontent.org/forum/index ... c&start=10

I have add the following in the category-item.php
Code:
<ul class="introblock <?php echo ($this->params->get('intro_cols', 2) == 1) ? 'one' : 'two'; ?>"> <?php for ($i=($this->limitstart == 0 ? $leadnum : 0 ); $i<$count; $i++) : ?> <li class="li_content <?php echo (($this->limitstart == 0) ? ($i+$leadnum)%2 : $i%2) ? 'even' : 'odd'; ?>">

so the li in the intro block gets different style css classes
so you can make difference styles for the left and the right on

corresponds that to your wish?
Last edit: 14 years 7 months ago by Rehne.

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

More
14 years 7 months ago #6814 by micker
cool thanks

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
14 years 7 months ago #6816 by Rehne
maybe I have a solution for you

Remove your code (for .... endfor)

and replace
Code:
<div class="ligne<?php echo $class; ?>" style="overflow: hidden;">

with
Code:
<div class="<?php echo (($this->limitstart == 0) ? ($i+$leadnum)%2 : $i%2) ? 'ligne1' : 'ligne2'; ?>">

I test it in may template with the sytling of li and it works
Code:
<div class="content"> <?php $leadnum = $this->params->get('lead_num', 2); $leadnum = ($leadnum >= $count) ? $count : $leadnum; if ($this->limitstart == 0) : ?> <ul class="leadingblock"> <?php for ($i=0; $i<$leadnum; $i++) : ?> <li class="li_content <?php echo (($this->limitstart == 0) ? ($i+$leadnum)%2 : $i%2) ? 'leadingblock_line1' : 'leadingblock_line2'; ?>"> <div class="leadingblock_content"> <?php if ($this->params->get('show_title', 1)) : ?> <h2 class="contentheading"> <?php if ($this->params->get('link_titles', 0)) : ?> [url=<?php echo JRoute::_(FlexicontentHelperRoute::getItemRoute($items[$i]->slug, $this->category->slug)); ?>]<?php echo $this->escape($items[$i]->title); ?>[/url] <?php else : echo $this->escape($items[$i]->title); endif; ?> .....

is this the right thing for you

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

More
14 years 7 months ago #6850 by micker
yes it's works !!!!
thanks !

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.924 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline