Grid with Videos and Webcams

From Adult Web Scripts Wiki

Jump to: navigation, search

This code example could be saved as home.php for use on a sites homepage - or as any other name with the approriate urlconfig rule added.

It will display a grid with videos and webcam models mixed together in a TABLE of 4 cols and 20 rows:

    // select our content
 
    zestoi('webcams', 'status=!offline&age=..30&max=40&template=webcams_grid.tpl');
    zestoi('videos', 'mode=random&max=40&template=videos_grid.tpl');
 
    // we want the prerendered html content
 
    $cells = array();
 
    $webcams = zestoi_results('webcams');
    $videos = zestoi_results('videos');
 
    if (is_array($webcams)) foreach ($webcams as $cell) $cells[] = $cell['_html'];
    if (is_array($videos)) foreach ($videos as $cell) $cells[] = $cell['_html'];
 
    // shuffle the array
 
    Zestoi::array_shuffle($cells);
 
    // print them out in a table
 
    for ($row=0, $num=0; $row<20; $row++)
    {
        echo '<tr>';
 
        for ($col=0; $col<4; $col++, $num++)
        {   
            if (isset($cells[$num])) echo '<td valign="top">' . $cells[$num] . '</td>';
        }
 
        echo '</tr>';
    }