I want to see a block with random listings from sponsored and premium listings.
Another block ideea: last x searches or top x searches.
Thanks.
I want to see a block with random listings from sponsored and premium listings.
Another block ideea: last x searches or top x searches.
Thanks.
im trying to do random sponsors block... its a lot harder than you would think, the sponsor table has lots of sql joins which confuse mei will probably get it done in the end though... it would be a useful block.
Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )
Thanks in advance!
OK youll have to tidy this up and apply it how you want. Im using this underneath the new and updated :
Php block saved as block.sponsor.php
Now html file saved as block.sponsor.htmlCode:<?php /** * * INDEXU * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved. * * INDEXU(tm) is protected by Indonesia and International copyright laws. * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited, * violators will be prosecuted. To obtain a license for using INDEXU(tm), * please register at Nicecoder home page at http://www.nicecoder.com * * Author: * Dody Rachmat Wicaksono (dody@nicecoder.com) * M. Zuber (zubby@nicecoder.com) * */ function block_sponsor($params) { global $dbConn, $main_new_links; $tpl = new Template; $sp_expire = date('Y-m-d H:i:s'); $query = " select * from idx_link left join idx_paid_listing on (idx_link.link_id = idx_paid_listing.link_id) where sponsored = 1 and expire > '$sp_expire' order by rand() limit 5"; $sp_links = $dbConn->FetchArray($query); $i = 0; while ($i < count($sp_links)) { $query = "select * from idx_category_path where category_id = " . $sp_links[$i]['category_id']; $row = $dbConn->FetchOne($query); $sp_links[$i]['category_path'] = $row['path']; $sp_links[$i]['category_path_with_link'] = $row['path_with_url']; $title_mod = strtolower($sp_links[$i]['title']); $title_mod = SEOReplace($title_mod); if (GetModRewriteStatus()=='1') { $mod_rewrite_pattern = GetModRewritePatternDetail(); $mod_rewrite_pattern = str_replace('{$link_title}',$title_mod,$mod_rewrite_pattern); $mod_rewrite_pattern = str_replace('{$link_id}',$sp_links[$i]['link_id'],$mod_rewrite_pattern); $detail_page_url = strtolower($mod_rewrite_pattern); } else { $detail_page_url = "detail.php?linkid={$sp_links[$i][link_id]}"; } $sp_links[$i]['detail_page_url'] = $detail_page_url; $i++; } $tpl->assign("sp_links",$sp_links); if (!$params['template']) { $params['template'] = 'block.sponsor.html'; } $tpl->display('blocks/'.$params['template'], 0); } ?>
good luck... you can ouput the catagory it appears in oin the html file if you want to , i didnt bother but it gets the path if you need it.Code:<table width="550" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="18" align="center" style="background-image:url(<%$tpl_base%>/images/template_01.gif); background-repeat:repeat-x" bgcolor="#ededed" class="head"><strong> Latest New Additions and Updates </strong></td> </tr> <tr> <td class="head"> <%* sp links *%> <%section name=i loop=$sp_links%> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td> <a href="<%$sp_links[i].detail_page_url%>" id="link_<%$sp_links[i].link_id%>"> <b><%$sp_links[i].title|lower|capitalize%></b></a> <br /><%$sp_links[i].description|truncate:300%><a href="<%$sp_links[i].detail_page_url%>" id="link_<%$sp_links[i].link_id%>"> [more] </a> <br /></td> </tr> </table> <%/section%> </td> </tr> </table>
Last edited by inspireme; 06-19-2006 at 11:33 AM.
Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )
Thanks Inspireme,
this works perfect!
has anyone added to this mod to list premium listings as well?
Great block I used it on my website for sponsored listings.
Quick question I can not seem to get the description to not be bold no matter what I try can you tell me where to look to fix this ?
for example ....
Thanks again for some great mods.
btw I love the design of your indexu portal![]()
Best
Lewis
www.AtoZfitness.com/indexu
if you use version 5.4 you can use the random block now, like this :
<%block_random_listing title="Random Sponsored links" max_item="4" listing_type="sponsored" %>
if you use anything less than 5.3 i dont think thats possible.
not sure about the bold, its probably opened somewhere and not been closed.
Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )
figured it out
Best
Lewis
www.AtoZfitness.com/indexu
Can anyone please tell me what modifications I need to do in order to have a random block of sponsored and premium listings but for version indexu 5.4.1?
thank you
Did you read the thread above? It tells you how. In fact the post right above yours tells you how to do it.
5.40 and 5.41 are nearly identical versions.
Intresting, just looked through the php block, you learn something every day, works fine on deluxe
Sponsored Only
<%block_random_listing title="Random Sponsored links"
max_item="4" listing_type="sponsored"%>
Premium Only
<%block_random_listing title="Random Premium links"
max_item="4" listing_type="premium"%>
Sponsored and Premium Only
<%block_random_listing title="Random Sponsored - Premium links"
max_item="4" listing_type="sponsored_premium"%>
All
<%block_random_listing title="Random links"
max_item="4" listing_type="all"%>
Nice to know, thanks for posting that.