Any one can explain shortly ? How to add [google ads] in between the views slideshow after completing four slides .presently am having gallerific slideshow and slides are from specific content type. Thanks by advance.

  • Do you want it every 4 slides? or just after 4 slides? Jun 26, 2012 at 11:10
  • Thanks for your reply syd .. Yes i need the google ads after the 4 slides complete.it will continue by cycle.
    – Dhinesh.ES
    Jun 26, 2012 at 11:27

2 Answers 2


Unlikely I don't know this module but I think you should look for the tpl.php. I've done something similar for a normal view were after 7 node it should show an empty box. In the file views-view-unformatted.tpl.php there is this script that generates the rows.

<?php foreach ($rows as $id => $row): ?> #for all the node, do this
  <div class="<?php print $classes_array[$id]; ?>"> # open div with the classes view-row, view-row-odd, view-row-1
    <?php print $row; ?> #print the node
<?php endforeach; ?>

I've changed in this way

$counter = 0;#it counts the row
 foreach ($rows as $id => $row) {
 $counter++; # add one to the counter
 print '<div class="'.$classes_array[$id].'">';
 if ($counter == 8) { # the views-row-8
   print 'Something'; #it prints "Something" instead of the node.
 }  else {
  print $row;
  print '</div>';

It will print normal row if the row is not the number 8.

Try to adapt this code for yout needs. You need to find the right tpl.php for the slideshow, copy the file and put it into your theme folder inside template. You should be able to rename it taking the name from the view panel clicking on "theme", so the other slideshow view will not be affected.

Let me know


Use the HTML code of google adds . Copy and paste HTML code of google adds in the body of new content. You can also use ck editor.In views also select body field along with image field. Also add global php in which add a if else conditon to show either image or body.

  • Thanks for you valuable reply rishi,here am using gallerific slideshow for displaying slides hope you knew about the module,however the gallerific setting having only four optionsto display the contents ,1)in one section for main slides 2)thumbnails 3)description 4)finally Title below the thumbnails,As you told the google add in body content can taken form views ,but how can i include it within the main slide of the slideshow,we have option to assign only one field for main slide.
    – Dhinesh.ES
    Jun 26, 2012 at 11:20
  • i didn't used that module. But in views you can do this in fields add 2 fields exclude both from display and then add a global php. In this you can add a check using else if. Then assign this global php filed to your module's field. I am guessing here. I don't know more about this module.But I am telling you the general drupal way doing this . May be it help you.
    – Rishi
    Jun 26, 2012 at 11:44
  • :-( if any other idea always welcome rishi.
    – Dhinesh.ES
    Jun 26, 2012 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.