Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Random paid listings block?

  1. #1
    Join Date
    Jan 2006
    Posts
    23

    Default Random paid listings block?

    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.

  2. #2
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    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 me i 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 )

  3. #3
    Join Date
    Jan 2006
    Posts
    23

    Default

    Thanks in advance!

  4. #4
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    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

    Code:
    <?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);
    }
    
    
    ?>
    Now html file saved as block.sponsor.html

    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>&nbsp;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>
    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.
    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 )

  5. #5
    Join Date
    Jan 2006
    Posts
    23

    Default

    Thanks Inspireme,

    this works perfect!

  6. #6
    Join Date
    Jan 2005
    Posts
    164

    Default premium listings

    has anyone added to this mod to list premium listings as well?

  7. #7
    Join Date
    Aug 2003
    Posts
    233

    Default your random sponsor block

    Quote Originally Posted by inspireme View Post
    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 me i will probably get it done in the end though... it would be a useful block.
    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

  8. #8
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    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 )

  9. #9
    Join Date
    Aug 2003
    Posts
    233

    Default

    Quote Originally Posted by inspireme View Post
    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.
    Works nice but is too wide can't figure out how to get it to be max 200 characters
    Best
    Lewis
    www.AtoZfitness.com/indexu

  10. #10
    Join Date
    Aug 2003
    Posts
    233

    Default never mind I got it :)

    figured it out
    Best
    Lewis
    www.AtoZfitness.com/indexu

  11. #11
    Join Date
    Jun 2007
    Posts
    35

    Default

    Quote Originally Posted by inspireme View Post
    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.
    Works a treat that, nice!

  12. #12
    Join Date
    Sep 2001
    Posts
    180

    Default Random Block of sponsored and Premium links

    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

  13. #13
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    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.

  14. #14
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    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
    "%>
    ____________________________
    http://www.articleconveyer.com
    Give Your Articles Exposure



  15. #15
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Nice to know, thanks for posting that.

Similar Threads

  1. How do the paid listings work?
    By mgeyman in forum Pre-Sales Questions
    Replies: 4
    Last Post: 04-06-2006, 04:51 AM
  2. Replies: 1
    Last Post: 12-11-2005, 11:53 AM
  3. Random link MOD
    By esm in forum v3.2
    Replies: 0
    Last Post: 08-04-2004, 04:29 AM
  4. Random 10 links on Detail page.
    By at00m in forum v3.2
    Replies: 11
    Last Post: 12-04-2003, 11:38 AM
  5. random link ?
    By dbmg in forum v5.x
    Replies: 6
    Last Post: 03-28-2003, 02:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •