I'm having a really weird behaviour in my site using "title" argument directly passed to a view using php.
This is my situation:
- Working view with two arguments "title" and "node id".
- As I said, the view works with any kind of "title" it doesn't have problems with characters such as ' , - etc...
- I print the view using this php snippet:
- For testing purposes I print appart the $node->title variable to see if it's working right.
$view = views_get_view('ref_compania_versiones');
print views_build_view('embed', $view, array($node->title, $node->nid), true, 15);
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:
- It seems a title argument lenght related problem.
- The view works with longer titles... so it's not a lenght problem :D
- 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
Comment #1
dawehnerdo you really need the nodetitle as argument?
why do you not use the $node->nid its all information you need there.
Comment #2
NoRandom commentedHi, 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.
Comment #3
merlinofchaos commentedYour 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?
Comment #4
NoRandom commented...and voilà. Using term ids as argument everything seems to work.
Anyway I'm going to post this bug in the core.
Thanks again.
Comment #5
dawehnerso this can be fixed