[support] using generated url as argument in a view

Michel Morelli michel at ziobuddalabs.it
Fri May 21 11:51:39 UTC 2010


Carlos Costa ha scritto:
>  If I could parse the url, I could extract the
> "name-of-the-artist" and convert it to a nid, for example.
>   
I think that you can. Try this (i'm have not a Drupal site in my hand now)

Edit your view and "add arguments", chouse Node: nid,  chouse "Provide 
default argument", chouse "PHP Code" (in "Provide default argument 
options" fieldset). Now if your url is "

/artists/name-of-the-artist/biography" than:

arg(0): artists
arg(1): name-of-the-artist
arg(2): biografy
(and so on...)

Now with your PHP code retrive nid from "name-of-the-artist" arg(1) and put "return $nid" (where $nid is your node nid variable). Example

[CODE]
$nid = function_that_retrieve_nid(arg(1));
return $nid;
[/CODE]

Try this.

M.


-- 
Michel 'ZioBudda' Morelli                       michel at ziobuddalabs.it
Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net       			MSN: michel at ziobuddalabs.it                   
						JABBER: michel at ziobuddalabs.it



More information about the support mailing list