1

I have the following code in my page.tpl.php file.

<?php $path = drupal_get_path_alias($_GET['q']); ?>
<?php if ($path == 'about-us'): ?>
  <div class="container">
    <h1> about us!!!!</h1> 
  </div>
<?php endif; ?> 

This works for /about-us, but not for /about-us/abc.

What code would work for all the paths under /about-us?

I've messed around with arg(), but I ended up with a page error.

1

1 Answer 1

1
// Retrieve an array that contains the path pieces.
$path_args = arg();

// Check if the current page is the page you're looking for.
if ($path_args[0] == 'about-us') {
  // Your code.
}
2

Not the answer you're looking for? Browse other questions tagged or ask your own question.