[development] Taxonomy_select_nodes quetion

bob brazeau bobbrazeau at gmail.com
Wed Jan 26 18:23:18 UTC 2011


Are you referring to the following chunk of code?

    if ($pager) {
      $result = pager_query($sql, variable_get('default_nodes_main',
10), 0, $sql_count, $args);
    }
    else {
      $result = db_query_range($sql, $args, 0,
variable_get('feed_default_items', 10));
    }

I saw that, but it seems to behave counter intuitively to me.  When I
set the pager parameter to FALSE it limited my results to 10.  When I
set pager to TRUE then it respects the pager limit (now 30).  I guess
when I set the parameter to false I assumed there wouldn't be a
built-in limit, or at least there would be a straight forward way to
override it.

Unless I am mistaking how the function works.

Bob


On Wed, Jan 26, 2011 at 11:11 AM, Carl Wiedemann
<carl.wiedemann at gmail.com> wrote:
> On the API page, notice the effect of $pager -- it calls pager_query() with
> 10 as the limit.
> You might consider using Views http://drupal.org/project/views for doing
> this sort of thing.
>
> On Wed, Jan 26, 2011 at 10:13 AM, bob brazeau <bobbrazeau at gmail.com> wrote:
>>
>> This is for verision 6 of Drupal.
>> I have a taxonomy category with 11 results, but only the top 10 are
>> showing up.  I am getting my results by
>>  $result = taxonomy_select_nodes(array($tid), 'or', 0, FALSE, 'n.title
>> asc');
>>
>>  Looked into the code for the select
>>
>>  http://api.drupal.org/api/drupal/modules--taxonomy--taxonomy.module/function/taxonomy_select_nodes/6
>>
>>  and based on my parameters came up with the following query
>>  $result = db_query("select distinct(n.nid), n.sticky, n.title,
>> n.created from node n inner join term_node tn on n.vid=tn.vid where
>> tn.tid = %d and n.status = 1 order by n.title asc",$tid);
>>
>>  which returns all 11 results.
>>
>>  I went into /admin/content/node-settings and upped the value from 10
>> to 30, but there was no change.
>>
>> Then I changed the FALSE to TRUE in the original code and all 11
>> results showed up.  Not sure why the result set was limited when
>> paging was turned OFF.  Can anyone shed light on what was happening
>> there?
>>
>> Thanks,
>>
>> Bob
>
>


More information about the development mailing list