Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Foren / Cotonti / Extensions / Plugin Wishlist

What plugins would you like to see? Post your ideas here.

GHengeveld
#34726 19. Juni 2012, 07:10

This is what you need. Just make it into a plugin.

$randomusers = $db->query("
  SELECT user_id FROM $db_users
  WHERE user_avatar != '' ORDER BY RAND() LIMIT 16
")->fetchAll();

if ($randomusers)
{
  foreach ($randomusers as $user)
  {
    $t->assign(cot_generate_usertags($user['user_id'], 'RANDOMUSER_'));
    $t->parse('MAIN.RANDOMUSERS.ROW');
  }
  $t->parse('MAIN.RANDOMUSERS');
}

The template will look like this:

<!-- BEGIN: MAIN -->
  <!-- BEGIN: RANDOMUSERS -->
  <ul id="randomusers">
    <!-- BEGIN: ROW -->
    <li>{RANDOMUSER_NAME} <img src="{RANDOMUSER_AVATAR}" /></li>
    <!-- END: ROW -->
  </ul>
  <!-- END: RANDOMUSERS -->
<!-- END: MAIN -->

Dieser Beitrag wurde von GHengeveld (am 19. Juni 2012, 07:16, vor 9 Jahre) bearbeitet