You need to login to send post. No account yet? Create one:
Create account
Insert argument into block or embed Drupal View
Mon, 03/01/2010 - 16:18
In many cases website designer needs to embed View by PHP or as block. Only Page display of Drupal's Views however can use arguments from URL directly. Block View or embed View needs a short php snippet:
In Arguments dialogue under "Action to take if argument is not present:" section choose "Provide default argument". Click on PHP code and insert this snippet:
$path = drupal_get_path_alias($_GET['q']);
$path = explode('/', $path);
if ($path[1] != '') { return $path[1]; }
Number in $path[x] means order of argument in url (0th-argument/1st-argument/2nd-argument etc.)
Cheers!


















