Jump to content

Help with current folder & subfolders of domain


anthelo

Recommended Posts

Hi,

Im having this peace of code

<?php
$requested = empty($_SERVER['REQUEST_URI']) ? false : $_SERVER['REQUEST_URI'];
switch (  $requested ) {
case '/videos/':
$content_title = 'Videos Home Directory';
break;
default:
$content_title = 'Welcome to my Website!';
}
?>

What im trying to do is when im on the domain www.mydomain.com will show $content_title . My problem is when im trying for example www.mydomain.com/videos/ everything is ok but when im on www.mydomain.com/videos/something_else/ I want the the same title again

Any help please?

 

Link to comment
Share on other sites

not working :(

 

This is what my code now is look like.

 

<?php
$requested_parts = explode('/', $requested);
$requested = empty($_SERVER['REQUEST_URI']) ? false : $_SERVER['REQUEST_URI'];
switch (  $requested_parts ) {
case '/videos/':
$content_title = 'Videos Home Directory';
break;
default:
$content_title = 'Welcome to my Website!';
}
?>

 

Link to comment
Share on other sites

You need to set $requested before you use explode() on it.  Switch the order of the first two lines.

 

Also $requested_parts[1] is what you need to look at, not $requested_parts.  And the value to compare against is "videos", not "/videos/", because explode() will remove all the slashes.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.