That's even better. You can strip it out completely. :)

Rick

On Dec 5, 3:40 am, Andy C <[email protected]> wrote:
> Many thanks, Rick.
>
> You're probably expecting me to say 'Works fine'. However when I
> delved deeper, this array wasn't even used. It was some legacy cruft I
> inherited when plagiarising the theme way back when.
>
> However, I'm sure it does work and hope the tip may prove useful to
> someone else.
> --
> Andy
>
> On Dec 5, 1:19 am, rick c <[email protected]> wrote:
>
> > On Dec 4, 3:17 pm, Andy C <[email protected]> wrote:
>
> > > Just sync'ed to r3855 and I need some help with some code in my
> > > Whitespace theme that manipulates the database directly. Tsk, tsk.
>
> > >         if( !$this->template_engine->assigned( 'tags' ) ) {
> > >             $tags= DB::get_results( 'SELECT * FROM ' . DB::table
> > > ('tags') );
> > >             $tags= array_filter($tags, create_function('$tag', 'return
> > > (Posts::count_by_tag($tag->tag_slug, "published") > 0);'));
> > >             $this->assign('tags', $tags);
> > >         }
>
> > > I presume this block can be simplified now.
>
> > > If you're wondering why I am incapable of fixing this trivial issue,
> > > given I wrote it myself, well I didn't write it myself, I mindlessly
> > > plagiarised the code from Michael's port of the WP Connections
> > > theme :-)
>
> > Andy C,
>
> > I think this will work:
>
> > if( ! $this->template_engine->assigned( 'tags' ) ) {
> >         $tags = array_filter( Tags::get(), create_function( '$tag', 'return
> > ( Posts::count_by_tag( $tag->tag_text, "published" ) > 0);' ) );
> >         $this->assign('tags', $tags);
>
> > }
>
> > Rick

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/habari-users

Reply via email to