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