Passing arguments to Views Block

Public

Contextual Filter Code to get argument from URL

Get raw version
php
  1. $alias = drupal_get_path_alias();
  2. $parts = explode('/', $alias);
  3. // Return the last part of the alias should be the SKU
  4. drupal_set_message("Parts:" . print_r($parts, TRUE) . '');
  5. return array_pop($parts);
  6. //----------------------------------------------------------------
  7. $alias = trim($_GET['q'], '/');
  8. $parts = explode('/', $alias);
  9. // Return the last part of the alias should be the SKU
  10. drupal_set_message("Parts:" . print_r($parts, TRUE) . '');
  11. return array_pop($parts);