Osclass forums

Support forums => Themes => Twitter => Topic started by: Akhim on April 20, 2015, 12:25:37 am

Title: Adverts between listings on twitter theme? [ SOLVED]
Post by: Akhim on April 20, 2015, 12:25:37 am
I found a topic on how to do this started by Keerthi and Contributed immensely by Teseo.

http://forums.osclass.org/tips-and-tricks/(tip)-ads-between-listings/30/ (http://forums.osclass.org/tips-and-tricks/(tip)-ads-between-listings/30/)

But there is nothing on it about twitter theme. Does anyone know how to? Do i edit search.php, search_list.php, or search_gallery.php. which line and codes do i edit? Thank you in Advance
Title: Re: Adverts between listings on twitter theme? [ SOLVED]
Post by: Akhim on April 23, 2015, 08:54:41 am
 :)
Title: Re: Adverts between listings on twitter theme? [ SOLVED]
Post by: teseo on April 23, 2015, 01:13:43 pm
You're welcome, :) regards.
Title: Re: Adverts between listings on twitter theme? [ SOLVED]
Post by: Akhim on May 24, 2015, 08:07:49 pm
I just want to post Teseo's solution here so a to help other people rather than rummaging through the lengthy topic.


Hi,

Yes, each theme can have a different HTML structure. This should work for Twitter:

search-list.php:

1.- Look for this line:

Code: [Select]
<?php while ( osc_has_items() ) { ?>
and replace it with:

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


2.- Replace:

Code: [Select]
    <?php ?>
<?php ?>
<div class="pagination">

with:

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

        <div class="line span11 columns">
            [Specific AdSense code here]
        </div>
        <?php }
    } 
?>

<?php ?>
<div class="pagination">

Replace "[Specific AdSense code here]" with your actual AdSense code.