2 column design

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
reinhardl
Regular
Posts: 258
Joined: Wed Jun 20, 2007 8:54 am
Location: Germany

2 column design

Post 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
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: 2 column design

Post by yellowled »

Why don't you use {cycle values="evenpost,oddpost"} instead?

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 2 column design

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 2 column design

Post by garvinhicking »

Screw my posting. Yellowled's suggestion makes much more sense.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: 2 column design

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: 2 column design

Post by garvinhicking »

Hehe. :-)

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

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
reinhardl
Regular
Posts: 258
Joined: Wed Jun 20, 2007 8:54 am
Location: Germany

Re: 2 column design

Post by reinhardl »

{cycle values="evenpost,oddpost"} works fine - Thanks a lot !!
Sara Martin
Posts: 2
Joined: Thu Mar 17, 2011 6:52 am

Re: 2 column design

Post 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?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: 2 column design

Post by Timbalu »

There is a restricting Access posting to quickly. Just wait 10 seconds.... :D
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply