1

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?

2 Answers 2

0

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.

1
  • 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 Dec 10, 2012 at 7:44
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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