Hello, I have a script displaying posts 10 posts on the index/pages. i would like to display a banner after the 3 posts. Anyone got any idea on how to edit my PHP file ? Best regards, <?php include("include/config.php"); include("include/functions/import.php"); $thebaseurl = $config['baseurl']; $page = intval($_REQUEST[page]); $s = stripslashes(strip_tags($_REQUEST['s'])); STemplate::assign('s',$s); if($s == "t") { $ftime = time() - (24 * 60 * 60); $addsql .= " AND time_added>='$ftime'"; $addsql2 .= " AND A.time_added>='$ftime'"; } elseif($s == "w") { $ftime = time() - (7 * 24 * 60 * 60); $addsql .= " AND time_added>='$ftime'"; $addsql2 .= " AND A.time_added>='$ftime'"; } elseif($s == "m") { $ftime = firstDayOfMonth2(); $addsql .= " AND time_added>='$ftime'"; $addsql2 .= " AND A.time_added>='$ftime'"; } elseif($s == "y") { $ftime = firstDayOfYear2(); $addsql .= " AND time_added>='$ftime'"; $addsql2 .= " AND A.time_added>='$ftime'"; } if($page=="") { $page = "1"; } $currentpage = $page; if ($page >=2) { $pagingstart = ($page-1)*$config[items_per_page]; } else { $pagingstart = "0"; } $query1 = "SELECT count(*) as total from posts where active='1' $addsql order by time_added desc limit $config[maximum_results]"; $query2 = "SELECT * from posts A, categories B where A.active='1' $addsql2 AND A.category=B.CATID order by A.time_added desc limit $pagingstart, $config[items_per_page]"; $executequery1 = $conn->Execute($query1); $totalvideos = $executequery1->fields['total']; if ($totalvideos > 0) { if($executequery1->fields['total']<=$config[maximum_results]) { $total = $executequery1->fields['total']; } else { $total = $config[maximum_results]; } $toppage = ceil($total/$config[items_per_page]); if($toppage==0) { $xpage=$toppage+1; } else { $xpage = $toppage; } $executequery2 = $conn->Execute($query2); $posts = $executequery2->getrows(); $beginning=$pagingstart+1; $ending=$pagingstart+$executequery2->recordcount(); $pagelinks=""; $k=1; $theprevpage=$currentpage-1; $thenextpage=$currentpage+1; if($s != "") { $adds = "&s=$s"; } if ($currentpage > 0) { if($currentpage > 1) { $pagelinks.="<a href='$thebaseurl/?page=1$adds'>$lang[64]</a> "; $pagelinks.="... "; $pagelinks.="<a href='$thebaseurl/?page=$theprevpage$adds'>« $lang[65]</a> "; STemplate::assign('tpp',$theprevpage); } $counter=0; $lowercount = $currentpage-5; if ($lowercount <= 0) $lowercount = 1; while ($lowercount < $currentpage) { $pagelinks.="<a href='$thebaseurl/?page=$lowercount$adds'>$lowercount</a> "; $lowercount++; $counter++; } $pagelinks.="<strong>$currentpage</strong> "; $uppercounter = $currentpage+1; while (($uppercounter < $currentpage+10-$counter) && ($uppercounter<=$toppage)) { $pagelinks.="<a href='$thebaseurl/?page=$uppercounter$adds'>$uppercounter</a> "; $uppercounter++; } if($currentpage < $toppage) { $pagelinks.="<a href='$thebaseurl/?page=$thenextpage$adds'>$lang[66] »</a> "; STemplate::assign('tnp',$thenextpage); $pagelinks.="... "; $pagelinks.="<a href='$thebaseurl/?page=$toppage$adds'>$lang[67]</a> "; } } } $templateselect = "index.tpl"; //TEMPLATES BEGIN STemplate::assign('beginning',$beginning); STemplate::assign('ending',$ending); STemplate::assign('pagelinks',$pagelinks); STemplate::assign('total',$total); STemplate::assign('posts',$posts); STemplate::display('header.tpl'); STemplate::display($templateselect); STemplate::display('footer.tpl'); //TEMPLATES END ?> Code (markup):
Make a count before your first post. Then, after each display iterate it. When it`s 3, display the banner.