Page 1 of 1

2 column design

Posted: Mon Feb 07, 2011 2:12 pm
by reinhardl
Hi,
I have a problem with a 2 column design

I have create a entries2col.tpl file like this:

Code: Select all

 {serendipity_hookPlugin hook="entries_header" addData="$entry_id"}
 {foreach from=$entries item="dategroup" name=LOOP1}  
 {foreach from=$dategroup.entries item="entry" name=LOOP2}
           <div class="post indexpost {if $smarty.foreach.LOOP1.iteration is even}evenpost{else}oddpost{/if}" >
 	  	<div class="top"></div>
 	  	<div class="mid">
 	  		<div class="title">
 	  			<a class="text2" href="{foreach from=$entry.categories item="entry_category"}{$entry_category.category_link}{/foreach}">{foreach from=$entry.categories item="entry_category"}{$entry_category.category_name|@escape}{/foreach}</a> 
   				<h5> <a class="title" href="{$entry.link}" rel="bookmark">{$entry.title|@default:$entry.id}&raquo;</a></h5>
 	  			<p>By <a href="http://www." title="Posts by admin">admin</a> on December 18, 2008</span></p>
 	  		</div>
 	  		<div class="entry">
 	  			{if $entry.properties.ep_MimboImage != ''} <img class="header" alt="Permanent link: {$entry.title}" src="{$entry.properties.ep_MimboImage}" />{/if}	  				 
 	  			<div class="text">
 	  				<p>{$entry.body|strip_tags|truncate:100:" ..."}<a class="text" href="{$entry.link}" rel="bookmark"> [mehr..]</a></p>	
 	  			</div>
 	  		</div>
 		  </div>
 	 	 <div class="bot"></div>
 	 </div>
         {/foreach}	  		
      
 {/foreach}
 

{serendipity_hookPlugin hook="entries_footer"}


in my index.tpl file I call the entries2col.tpl with :

Code: Select all

{serendipity_fetchPrintEntries category=$template_option.catx3 full=true fetchDrafts=false noSticky=true limit="0,6" template="entries_2Cols.tpl"}

{if $smarty.foreach.LOOP1.iteration is even}evenpost{else}oddpost{/if}" >
will decide if the class is evenpost or oddpost

This works as long as I have only one entry with the same date. I guess I have to query the LOOP2 but I do not know how?


Thanks

Re: 2 column design

Posted: Mon Feb 07, 2011 2:20 pm
by yellowled
Why don't you use {cycle values="evenpost,oddpost"} instead?

YL

Re: 2 column design

Posted: Mon Feb 07, 2011 2:21 pm
by garvinhicking
Hi!

I suggest to create your own counter variable for that. You can then use {counter} before each title for example to place a counter token. See http://www.smarty.net/docs/en/language. ... on.counter for details. It also has an option to assign the conter to a smarty variable that you can then check.

I don't have the time right now to write down the exact code, but maybe this helps already. Raise your voice if you need more input and I'll try to get back to you :)

Regards,
Garvin

Re: 2 column design

Posted: Mon Feb 07, 2011 2:22 pm
by garvinhicking
Screw my posting. Yellowled's suggestion makes much more sense.

Re: 2 column design

Posted: Mon Feb 07, 2011 2:27 pm
by yellowled
garvinhicking wrote:Screw my posting. Yellowled's suggestion makes much more sense.
I think I'm gonna print this and hang it over my desk. :wink:

YL

Re: 2 column design

Posted: Mon Feb 07, 2011 2:34 pm
by garvinhicking
Hehe. :-)

Good to know, because I'll stopp posting here once my postcount reaches 31337. :-)

Regards,
Garvin

Re: 2 column design

Posted: Mon Feb 07, 2011 9:05 pm
by reinhardl
{cycle values="evenpost,oddpost"} works fine - Thanks a lot !!

Re: 2 column design

Posted: Fri Mar 25, 2011 8:12 am
by Sara Martin
I want to post many threads and post here.But i am not permitted to do more postings .I do not know why?

Re: 2 column design

Posted: Fri Mar 25, 2011 9:28 am
by Timbalu
There is a restricting Access posting to quickly. Just wait 10 seconds.... :D