• Osclass Evolution is an official classifieds script based on Osclass v. 3.8 which was officially closed on September 5, 2019.
    This engine maintains support for old templates and plugins, and it is constantly being updated and improved. Using this script, we guarantee that you will get a quality product with all the necessary support.

    All other improvements of this script are Amateur work of third-party developers.

How to... insert Ads Between Search Listings

migrania

Member
Tanks to @teseo (from osc4u) None of the code below are mine.
I think it's important to rescue it, before the site where it was posted disappears.

THEME BENDER
you need to modify oc-content/themes/bender/loop.php
This block at the end of the script:

Code:
while(osc_has_items()) {
                $i++;
                $class = false;
                if($i%4 == 0){
                    $class = 'last';
                }
                $admin = false;
                if(View::newInstance()->_exists("listAdmin")){
                    $admin = true;
                }

                bender_draw_item($class,$admin);

Replace it with:

Code:
 $adSense_middle_pos = ceil(osc_count_items()/2);
        $ad_counter = 0;
  
        while(osc_has_items()) {
            $i++;
            $class = false;
            if($i%4 == 0){
                $class = 'last';
            }
            $admin = false;
            if(View::newInstance()->_exists("listAdmin")){
                $admin = true;
            }
      
            bender_draw_item($class,$admin);
      
            $ad_counter++;
            if ($ad_counter == $adSense_middle_pos && bender_show_as() == 'list') {
            //AdSense middle ?>
                <li class="listing-card">
          
                    // [Specific AdSense code here]
          
                </li>
            <?php }

Important note: I've programmed this in a way that will only work for List View, to insert a single "fake regular ad" on Gallery View would scramble the symmetry of the grid layout.
:(
You'd need to insert 4 AdSenses to keep things pretty...
 

Attachments

  • Screenshot_2021-02-06 impresora - Ofertame.png
    Screenshot_2021-02-06 impresora - Ofertame.png
    380.7 KB · Views: 1
Top