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

Thread: Ways To Organize Links

  1. #1
    Join Date
    Aug 2001
    Location
    Toronto, Ontario
    Posts
    678

    Default Ways To Organize Links

    This is just a reference for those interested in knowing the four ways to organize links.


    order by bid desc

    order by title

    order by hits desc

    order by rating desc

  2. #2
    Join Date
    Sep 2001
    Posts
    170

    Default

    Four ways including

    order by rating desc

  3. #3
    Join Date
    Aug 2001
    Location
    Toronto, Ontario
    Posts
    678

    Default

    ty shop. I forgot about that one.

  4. #4
    Join Date
    Jul 2002
    Location
    New York, NY
    Posts
    20

    Default

    I'm glad you posted this because I just noticed that my links seem to be listed "randomly" at this point and I'd love to have them listed "order by hits desc" -- which would have the highest hit links at the top, etc. right?

    How do I go about that?

    Thanks.

    Josh
    http://actorpoint.com - Real Actors Building A Real Community.

  5. #5
    Join Date
    Sep 2001
    Posts
    170

    Default

    Hi

    You need to go to the browse.php file

    just under
    // show links

    you will find:
    $links_obj->query = "select......

    change this to:
    $links_obj->query = "select * from idx_link where category_id = '$cat' order by hits desc";

    Regards

  6. #6
    Join Date
    Oct 2003
    Location
    R.T.U
    Posts
    580

    Default

    what about in the search results? i would like to list my searches by rating maybe...

    thanks in advance.
    Polo

    --------------------------------------
    Christian Website

  7. #7
    Join Date
    Sep 2004
    Posts
    162

    Default

    I do not have anything below //show links/ SHould i add something or is this referencing an older version of indexu? I really want to be able to sort my listings differently. Also, is it possible to have sorted by say rating first, then by bid second?


    Quote Originally Posted by Shophere
    Hi

    You need to go to the browse.php file

    just under
    // show links

    you will find:
    $links_obj->query = "select......

    change this to:
    $links_obj->query = "select * from idx_link where category_id = '$cat' order by hits desc";

    Regards
    Last edited by brickholius; 11-25-2004 at 01:48 AM.

  8. #8
    Join Date
    Sep 2001
    Posts
    170

    Default

    Hi

    Yes it is from an older version

    I have not moved to the current version but look under the "// show links" area and "by order" - looks like there are a number of options - so unless some use can help I would test and find which one works

    Regards

  9. #9
    Join Date
    Sep 2004
    Posts
    162

    Default

    Here is the code from 3.2

    Code:
    // show links
    	
      // exclude featured link
    	$query = "
    	  select link_id from idx_link 
    		where category_id = '$cat' and suspended = 0 and sp_cat = 1 and now() < sp_cat_date_limit
    		order by sp_cat_order asc";
    I tried one of the variables above but it did not work. The code we need to switch is: sp_cat_order asc to either rank by hits, bid, or rating. any ideas. Seems like there should be a simple solution.
    Last edited by brickholius; 11-25-2004 at 03:42 AM.

  10. #10
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by brickholius
    I do not have anything below //show links/
    hopefully, you have SOMETHING after that or you are missing about 150 lines of code and your browse page will not work.

    Assuming you are not missing any code, search for the word select. There are three instances.

    look at the lines that follow each instance and find one that reads:

    //$links_obj->query .= " order by bid desc";

    this is the line to change. Remove the //

    there is also a SORT mod done last summer - 2003
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  11. #11
    Join Date
    Sep 2004
    Posts
    162

    Default

    Quote Originally Posted by esm
    hopefully, you have SOMETHING after that or you are missing about 150 lines of code and your browse page will not work.
    Yes, i was confused but in the next message (above) i put what code I had and found what needs to be changed i just dont know the code.


    Quote Originally Posted by esm
    look at the lines that follow each instance and find one that reads:

    //$links_obj->query .= " order by bid desc";

    this is the line to change. Remove the //
    And removing the "//" does what?


    Here is all my code:

    Code:
    // show links
    	
      // exclude featured link
    	$query = "
    	  select link_id from idx_link 
    		where category_id = '$cat' and suspended = 0 and sp_cat = 1 and now() < sp_cat_date_limit
    		order by sp_cat_order asc";
    
      $result = $conn->Execute($query);
      $total = $result->RecordCount();		
    	
    	$i=0;
    	while($i<$total) {
    	  $result->Move($i);
    	  $lid[] = $result->Fields(link_id);
    	  $i++;
    	}
    			
      
      $links_obj = new clsLink;
      $links_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName);
      
      $links_obj->query = "
    	  select * from idx_link 
    		where (category_id = '$cat' or cat1 = '$cat' or cat2 = '$cat') 
    		  and suspended = 0";
    			
    	$i=0;
    	while($i<count($lid)) {
    	  $lid2 = $lid[$i];
      	$links_obj->query .= "	and link_id <> $lid2";
    	  $i++;
    	}	
    	
    	//$links_obj->query .= "	order by bid desc";
    
      $links_obj->query;
    	
    	$links_obj->table_name = "idx_link";
      $links_obj->category_table_name = "idx_category";
      $links_obj->user_table_name = "idx_users";
      $links_obj->editor_table_name = "idx_editor";
      $links_obj->template_file = $theme_path."rows.html";
      $links_obj->date_format = $msg["10014"];
        
      $links_obj->rating_image_path = "themes/".$theme_name."/images/rating/";
      $links_obj->rev_rating_image_path = "themes/".$theme_name."/images/review/";
    
      $links_obj->header = $msg["10013"];
      $links_obj->paging = true;
      $links_obj->pg_size = $max_rows;
      $links_obj->cp_size = $max_pages;
      $links_obj->cp_more = $max_chapters;
      $links_obj->href = "browse.php";
      //$links_obj->more_param = "&cat=$cat";
      $links_obj->more_param = "$cat";
      $links_obj->category_file = "browse.php";
      $links_obj->category_separator = $category_separator;
    
      $links_obj->page_file = "browse";  // for mod rewrite
      $links_obj->page_title = strtolower($category_obj->GetCategoryName($cat));  // for mod rewrite
    
      //$links_obj->cache_time = $cache_time;
      //$links_obj->enable_cache = $use_cache_status;
      
      $link = $links_obj->Display();
      $pagination = $links_obj->pagination;


    I want to know what i change to be able to change the order to either bid, rating, or hits. I am also interested if there is a way to say sort A, then B. So sort rating, then hits etc.


    brick
    Last edited by brickholius; 11-25-2004 at 12:41 PM.

  12. #12
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by brickholius
    And removing the "//" does what?
    hmmmm....Might I suggest a book on PHP... and many have a section on mySQL which will help with the sort clause (ORDER BY)...

    The // turns the line from executable PHP code to a remark, which the PHP processor will ignore.



    Here is all my code:
    I still hope there is a bunch more after that...



    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  13. #13
    Join Date
    Jul 2002
    Location
    California
    Posts
    57

    Default

    I would like to sort by a custom field... any luck at creating this?

    it's a price column

    maybe give the visitor the option of ascending or descending

    Allen

  14. #14
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  15. #15
    Join Date
    Jul 2002
    Location
    California
    Posts
    57

    Default Looks like its almost what I am looking for

    Thanks Saint,

    As usuall you are the great knowledge guru....

    The real question will it work with custom database fields like for instance I have a price field?

    Then the visitor could sort by price or any other field I may have that's not a "standard" part of the link database.

    Thanks again,

    Allen

Similar Threads

  1. Moving from G-T Links 2
    By esm in forum Pre-Sales Questions
    Replies: 14
    Last Post: 05-30-2005, 04:26 PM
  2. Delete 800 links one at a time ?
    By killipso in forum v5.x
    Replies: 2
    Last Post: 01-26-2004, 10:55 AM
  3. Special Import of GT links
    By esm in forum v5.x
    Replies: 4
    Last Post: 05-21-2003, 05:12 PM
  4. Organize the links in Alphabetical order?
    By crow in forum Pre-Sales Questions
    Replies: 3
    Last Post: 05-04-2002, 11:24 PM
  5. How to organize links alphabetically?
    By Hart_House in forum Tutorials, Hints & Tips
    Replies: 9
    Last Post: 04-10-2002, 10:58 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
  •