Customizing the webcam grid display order

From Adult Web Scripts Wiki

Jump to: navigation, search

To display a mix of models in private shows and freechat you would normally just use:

  <?= zestoi('webcams', 'status=private_show|free_chat'); ?>

If you really want full control over how many models from a certain status (or from any data) are displayed you ca issue multiple calls to zestoi as follows():

  zestoi('webcams', 'status=private_show&max=5');
  $private = zestoi_results('webcams');
 
  zestoi('webcams', 'status=group_show&max=5');
  $group = zestoi_results('webcams');
 
  zestoi('webcams', 'status=free_chat&max=5');
  $free = zestoi_results('webcams');

Then $private will contain an array() of 5 models in private shows and $free of 5 models in freechat etc.

This code would then display the models in private first, followed by models in group and freechat mixed up:

     $models = array_merge($group, $free);
     shuffle($models);
     $models = array_merge($private, $models);

You can then either loop round the arrays and display individual model data like this:

foreach ($models as $m) echo "NAME: $m[name]";

Or display the models data that will have been rendered by whatever webcams_grid template you have defined in Webcams > Edit Defaults in the web admin interface:

foreach ($models as $m) echo $m['_html'];