Hi, I posted this on the drupal forums but no one replied.... I have a 'companys' page with the URLs eg http://localhost/c/company-name1 and http://localhost/c/company-name2 etc. On these pages I have a block which displays the latest 'news' items of that company. To do this I've added the argument: taxonomy: term -> default argument -> php code (using node: title doesn't work for some reason). <code> //Read URL $getpath=$_GET['q']; $path= url($getpath, array('absolute' => TRUE)); //Parse URL to get company name $links=explode("/",$path); $num = count($links); //replace - with space $nid = preg_replace('/-/', ' ', $links[$num-1]); return $nid; </code> Ok so that works fine. It gets the company name from the URL, replaces dashes with spaces so that it searches properly and displays some news items for that company. Now, the block's basic settings are: Items to display: 2; More link: Yes. So that takes me to the 'all news' page with the path c/%/news The thing is, when I click the more link, the URL is http://localhost/c/company name1/news (space instead of dash in company name1). What I want is for 'company name1' to be 'company-name1' in the URL. I think it doesn't work because of the argument in the block which replaces dashes with spaces but the whole thing doesn't work if I don't do this. I've ticked the "Transform spaces to dashes in URL" box but that does nothing. I can't help but think there's a much better way of doing this whole thing I just don't know how. Any ideas?
It may be doing that because your code changes the value of $nid to the name with the spaces. $nid is a drupal variable for the active node id. Since you want to use your return value as a search argument, you should try using something like $search_arg for that variable. It leaves $nid in tact but still should have your view functioning as intended.