about adding ads between listing
« on: May 12, 2022, 10:03:18 AM »
hello i edit on file loop.php to adding ads between listing but it add once in middle of listing i want to add ads every three listing in home page   
code below

<?php
$loopClass = '';
$type = 'items';
if(View::newInstance()->_exists('listType')){
    $type = View::newInstance()->_get('listType');
}
if(View::newInstance()->_exists('listClass')){
    $loopClass = View::newInstance()->_get('listClass');
}
?>
<ul class="listing-card-list row <?php echo $loopClass; ?>" id="listing-card-list">
    <?php
        $i = 0;

        if($type == 'latestItems'){
            $adSense_middle_pos = ceil(osc_count_latest_items()/2);
            $ad_counter = 0;
            while ( osc_has_latest_items() ) {
                $class = '';
                if ($i % 3 == 0) {
                    $class = 'first';
                }
                dreamfree_draw_item($class);
                $i++;

                $ad_counter++;
                if ($ad_counter == $adSense_middle_pos && dreamfree_show_as() == 'list') {
                    //AdSense middle
                    ?>
                    <li class="listing-card">

                        // [Specific AdSense code here]

                    </li>
               
                <?php }
            }
        } elseif($type == 'premiums'){
            while ( osc_has_premiums() ) {
                $class = '';
                if($i%3 == 0){
                    $class = 'first';
                }
                dreamfree_draw_item($class,false,true);
                $i++;
                if($i == 5){
                    break;
                }
            }
        } else {
            while(osc_has_items()) {
                $i++;
                $class = false;
                if($i%4 == 0){
                    $class = 'last';
                }
                $admin = false;
                if(View::newInstance()->_exists("listAdmin")){
                    $admin = true;
                }

                dreamfree_draw_item($class,$admin);
          }
        }
    ?>
</ul>
« Last Edit: May 12, 2022, 11:00:45 AM by Ahmed Abdelhamed »

*

MB Themes

Re: about adding ads between listing
« Reply #1 on: May 12, 2022, 11:46:04 AM »
@Ahmed
You have similar function with $class already. .. if($i==5) { do something }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots