Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Basically I have created a page and it shows up fine.

example of panel page with path set

When I do a arg or current_path on that page it shows as a 404 path, not the one defined in the page.

current_path() => error-404
$_GET[q] => error-404
arg() => array(0 => error-404)

Is there a function that returns the path/URL that is set in the Page?

share|improve this question
add comment

2 Answers

Node that current_path() returns the URL path of the current page, not the URL. So on the http://www.example.com/latest-deals page it will return just latest-deals.

If you need to convert that to an actual URL, use url(current_path()), which will return /latest-deals. Or url(current_path(), array('absolute' => TRUE)) if you need the absolute URL.

share|improve this answer
    
Thank you for the answer @Artem M. Having current path return just a path and then turn that in to a URL is not a problem. It's getting the correct path back that is the problem –  Paul Sheldrake Dec 10 '12 at 7:44
add comment

current_path() will return the path of the panel page.

The problem I was having was that we are using panels layouts for 404 pages as well. I had a missing file in the theme layer that was generating a 404 error and that was getting picked up and overriding current path for the page.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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