Advertisement:

Author Topic: [TIP] Ads Between Listings  (Read 25276 times)

wpark6765

  • Newbie
  • *
  • Posts: 13
Re: [TIP] Ads Between Listings
« Reply #45 on: July 10, 2015, 08:41:46 am »
WORKED LIKE A CHARM!! THanks!!!!

Hi,

I don't know that theme but seems that could be done this way:

1.- Replace:

Code: [Select]
<?php while(osc_has_items()) { $i++; ?>

with:

Code: [Select]
<?php $adSense_middle_pos ceil(osc_count_items()/2);
while(
osc_has_items()) { $i++; ?>


2.- Replace:

Code: [Select]
<?php $class = ($class == 'even') ? 'odd' 'even'?>

with:

Code: [Select]
<?php if ($i+== $adSense_middle_pos) {
         
//AdSense middle ?>

        <div class="col-md-12 <?php echo $class = ($class == 'even') ? 'odd' 'even'?> thumbnail">

         // [Specific AdSense code here]

         </div>
<?php }
$class = ($class == 'even') ? 'odd' 'even'?>


Try and let me know if it works for you.

Regards

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TIP] Ads Between Listings
« Reply #46 on: July 10, 2015, 12:42:24 pm »
You're welcome. :) Could you tell me to which file of Royal theme belongs the code you pasted here?

Regards

wpark6765

  • Newbie
  • *
  • Posts: 13
Re: [TIP] Ads Between Listings
« Reply #47 on: July 11, 2015, 04:59:10 am »
yes, it's from search_list.php

You're welcome. :) Could you tell me to which file of Royal theme belongs the code you pasted here?

Regards

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TIP] Ads Between Listings
« Reply #48 on: July 11, 2015, 02:39:35 pm »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TIP] Ads Between Listings
« Reply #49 on: July 13, 2015, 08:22:40 pm »
Hi,

What theme is that and where can I see a demo? ???

Regards

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TIP] Ads Between Listings
« Reply #50 on: July 17, 2015, 04:39:52 pm »
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...  ???

Given that your One theme seems to work only in Gallery View, this procedure is not appliable as it is.

Regards

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: [TIP] Ads Between Listings
« Reply #51 on: September 25, 2015, 04:11:51 pm »
Today I did a alternative for user profile without pagination. I tried some codes on the forum for pagination, but without success for while, maybe I did something wrong, or my repurpose theme don't liked of these codes. If you know some code functional for pagination on user public profile, post the link, I'll appreciate that.

With this generic code with variables and conditions I can choose the correct position of my banner or other situation.

Some parameters if on case not correspond with total items of user comparing with position number of the banner, it will reset to second position on the listings.

All code is commented for follow the process, if you decide use it for same reasons, you can delete all comments if you want.

I tested the code only without pagination on list mode (I don't use gallery mode on my theme), maybe it works with pagination, and with gallery mode.
If you find some problem post here.

Regards

Code: [Select]
<?php
$adSense_middle_pos 
ceil(osc_count_items());
$selected_position 2/* Change to select position independent of number items per page on public profile. */
if($selected_position >= 2){
$fix_number_position $selected_position 1/* Correct position on listings. */
$regenerate $fix_number_position osc_count_items(); /* Will regenerate the number, subtracting the number position with total of items. */
if($fix_number_position osc_count_items()){/* Verify the selected position number if is bigger than total items. */
$ad_counter osc_count_items() - $regenerate/* Is a bigger number, so need subtract with regenerate value. */
} elseif (
$fix_number_position osc_count_items()){/* Verify the reduced number if is less than total items. */
$ad_counter osc_count_items() - $fix_number_position; /* Is a less number, so need subtract the value of position number fixed, with total number of items. */
} elseif (
$fix_number_position == osc_count_items()){/* Verify the reduced number if is equal to total items. */
$ad_counter osc_count_items() - 1/* Will stay in second position by default */
}
} else {
$reset_second_position 1;
$ad_counter osc_count_items() - $reset_second_position/* Will stay in second position by default if selected position value is less than 2 */
}
?>


servicesmary

  • Newbie
  • *
  • Posts: 37
Re: [TIP] Ads Between Listings
« Reply #52 on: February 22, 2016, 02:39:15 am »
Hello,

I've tried this with osclasswizards without success.
With text "Adsence" for test, i see it one time but don't repeat and change a lot display of grid.
It seems workd in list.

Someone have find the solution for grid ?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TIP] Ads Between Listings
« Reply #53 on: February 22, 2016, 05:27:01 pm »
Hi,

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...  ???

I'm afraid the Gallery/Grid view has a much more complex structure (and maybe not the same depending on theme ???).

Regards

servicesmary

  • Newbie
  • *
  • Posts: 37
Re: [TIP] Ads Between Listings
« Reply #54 on: February 23, 2016, 02:45:39 am »
Hi Teseo,

Thanks for your response.

I think i am near the solution. Time miss me now. If i find it, I'll write it here.

fosg2000

  • Jr. Member
  • **
  • Posts: 82
Re: [TIP] Ads Between Listings
« Reply #55 on: June 20, 2016, 06:55:46 pm »
how to on Boxer theme??

bredis

  • Newbie
  • *
  • Posts: 38
Re: [TIP] Ads Between Listings
« Reply #56 on: November 07, 2016, 12:20:26 pm »
Hi,

I have one question. I use modern theme and have 4 categories. Would be possible to add different banner to each category?

For example if I have category hotels I would like to show some banner typical for the category.

In this way I can show banner in all categories but in some of them it isn't relevant.

Thanks.

p206ab

  • Sr. Member
  • ****
  • Posts: 343
Re: [TIP] Ads Between Listings
« Reply #57 on: August 20, 2017, 05:46:29 pm »
Any updates on gallery view option?  :D

abdul ghany syed

  • Jr. Member
  • **
  • Posts: 55
  • I love awesome Classifieds
Re: [TIP] Ads Between Listings
« Reply #58 on: August 22, 2017, 09:30:05 am »
How to setup ads between listing in veronika,

The above methods not worked for me in veronika theme

is there anyone who know well about this?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [TIP] Ads Between Listings
« Reply #59 on: August 22, 2017, 03:33:48 pm »
Hi,

Any updates on gallery view option?  :D

Sorry, this still applies:

https://forums.osclass.org/tips-and-tricks/(tip)-ads-between-listings/msg136758/#msg136758

The above methods not worked for me in veronika theme

As said, this is only for List view (I can see Veronika uses Gallery view as default), and even for List view you need to understand the logic of the code to adapt it to your theme.

Regards