How can I check for a specific directory in my URL? I need to display an image if I'm in http://www.mywebsite.com/displayimg/mypage but not if I'm in http://www.mywebsite.com/mypage... would it be something involving drupal_get_path?
2 Answers
You can use arg to check for URL arguments. In your case, the second argument has to be empty, so you can try something like this:
if (arg(0) == 'displayimg' && arg(1) == 'mypage') {
// Do something meaningful.
}
Better to use block to display image. Use block visibility setting for displaying on specific URL.
arg
from the URL. see arg