Can I remove dategroups from bulletproof?

Skinning and designing Serendipity (CSS, HTML, Smarty)
d_cee
Regular
Posts: 603
Joined: Wed Jan 18, 2006 6:32 pm
Location: UK
Contact:

Re: Can I remove dategroups from bulletproof?

Post by d_cee »

Hi guys
since you asked YL :-)

This seems like a very reasonable change to me. One of the other things I often do, particularly when making a commercial site, is remove the date altogether. I've thought to make it a configurable option myself but usually just hide it with CSS. Build this option into the config item and I think it would be an excellent addition.

Dave
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Can I remove dategroups from bulletproof?

Post by yellowled »

Hohum.

I just now tried to implement this in the entries.tpl. Seems like something like:

Code: Select all

{if $template_option.dategroup_sort == 'false'}
  {foreach from=$dategroup.entries item="entry"}
{/if}
isn't possible in Smarty, since I get:

Code: Select all

Fatal error: Smarty error: [in file:/var/www/serendipity/templates/bp-svn/entries.tpl line 7]: syntax error: mismatched tag {/if}. expected {/foreach} (opened line 6). (Smarty_Compiler.class.php, line 2324) in /var/www/serendipity/bundled-libs/Smarty/libs/Smarty.class.php on line 1092
Does anybody have a clue why this doesn't work? Is it invalid to just open a foreach within an if statement without closing it within the same if statement?

'cause if that's the case, I think we're gonna have to drop it as a theme option altogether. If can't use the code above, I'd have to basically have the whole entries.tpl twice (if anybody can follow me here), which is definitely way too much overhead for a small detail like this ...

YL
onli
Regular
Posts: 2828
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Can I remove dategroups from bulletproof?

Post by onli »

Can't talk about smarty, but I don't know any programming-language which allows such a construction. Just think about the resulting assembler-code...
sincerely
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can I remove dategroups from bulletproof?

Post by garvinhicking »

Hi!

The proper way to add an option is to place the IF check WITHIN the foreach loop, and simply skips the HTML tags that would be shown between the first foreach loop and the second.

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/
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Re: Can I remove dategroups from bulletproof?

Post by judebert »

What onli said. Everything has to be done in blocks; you can't have blocks that overlap, only blocks that are completely enclosed in other blocks.

In any case, we still want to iterate through the dategroup items; we just don't want them styled or marked as a group. Essentially, we want each entry enclosed in its own dategroup div, even if it's the same date as the entry above it.
Judebert
---
Website | Wishlist | PayPal
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Can I remove dategroups from bulletproof?

Post by Don Chambers »

Thanks for digging into this YL - I have been buried with other obligations.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Can I remove dategroups from bulletproof?

Post by yellowled »

judebert wrote:In any case, we still want to iterate through the dategroup items; we just don't want them styled or marked as a group. Essentially, we want each entry enclosed in its own dategroup div, even if it's the same date as the entry above it.
Hmm ... I think that might work: Putting every entry in it's own dategroup div, but without emitting "double" dates.

I'll have to play with this over the weekend when I actually have time for it :)

YL
Post Reply