Page 2 of 2

Re: Can I remove dategroups from bulletproof?

Posted: Wed Apr 15, 2009 5:01 pm
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

Re: Can I remove dategroups from bulletproof?

Posted: Thu Apr 16, 2009 5:57 pm
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

Re: Can I remove dategroups from bulletproof?

Posted: Thu Apr 16, 2009 6:09 pm
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

Re: Can I remove dategroups from bulletproof?

Posted: Thu Apr 16, 2009 6:49 pm
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

Re: Can I remove dategroups from bulletproof?

Posted: Thu Apr 16, 2009 7:08 pm
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.

Re: Can I remove dategroups from bulletproof?

Posted: Fri Apr 17, 2009 3:58 am
by Don Chambers
Thanks for digging into this YL - I have been buried with other obligations.

Re: Can I remove dategroups from bulletproof?

Posted: Fri Apr 17, 2009 11:42 am
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