I'm having a really weird behaviour in my site using "title" argument directly passed to a view using php.

This is my situation:

  1. Working view with two arguments "title" and "node id".
  2. As I said, the view works with any kind of "title" it doesn't have problems with characters such as ' , - etc...
  3. I print the view using this php snippet:
  4.     $view = views_get_view('ref_compania_versiones');
        print views_build_view('embed', $view, array($node->title, $node->nid), true, 15);
    
  5. For testing purposes I print appart the $node->title variable to see if it's working right.

This view is working with title arguments like "Indiana Jones and the Last Crusade - The graphic adventure" (without quotes) as you can see here: http://pixelgordo.com/node/75 To the right of "Versions" there is a list view wich shows the released versions of that videogame.

And here we go with the weird behaviour: http://www.pixelgordo.com/node/770

The arguments are right as you can see below the white "window": title = Chronicles of Riddick The - Escape from Butcher bay nid = 770

But i get those nasty php errors. If i change the node title to "foo" everything works... also "Chronicles of Riddick The - Escape from" works. So, here is my reasoning:

  1. It seems a title argument lenght related problem.
  2. The view works with longer titles... so it's not a lenght problem :D
  3. The view works with "strange" characters like ' , - etc... so it's not a charater problem.

Any idea about where the problem is? This kind of errors give me headache, it's really strange.

Kind regards and thanks a lot.

Comments

dawehner’s picture

do you really need the nodetitle as argument?

why do you not use the $node->nid its all information you need there.

NoRandom’s picture

Hi, dereine, thanks for your answer.

I'm using nodetitle as argument because I'm using NAT (Node autoterm). This way, the node titled "ABC" will create a term called "ABC" in certain vocabulary. So, when I use $node->title as argument, actually I'm using a term name (the related NAT term).

But it seems this lead to a lot of problems...

I'm working now in the longer and safer way, I hope:

$node->title => term_name => term_id => numeric argument

Anyway I would like to know what is the current mistake, just for curiosity.

Regards.

merlinofchaos’s picture

Your actual problem has more to do with a bug in Drupal core than it has to do with the argument. Drupal's db_rewrite_sql() is mistakenly adding DISTINCT() to the wrong place. Maybe remove the DISTINCT filter if you're using it?

NoRandom’s picture

...and voilà. Using term ids as argument everything seems to work.

Anyway I'm going to post this bug in the core.

Thanks again.

dawehner’s picture

Status: Active » Fixed

so this can be fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.