Jump to content

Want to Get browser page title from path/directory


astarmathsandphysics

Recommended Posts

I have a free coursework website with 20000 courseworks sorted into folders

IThe ame page title appears on each page except when a doc/pdf file displays in the browser.

I would like to set the page title as the path.

I am using a single index.php file to load every page so I only need a single piece of code I think.

How do I do this in php?

There are a few options.

You could do some research on apaches mod_rewrite

 

Also, you could consider $_SERVER['PATH_INFO'];

 

From PHP Docs:
 

'PATH_INFO' Contains any client-provided pathname information trailing the actual script filename but preceding the query string, if available. For instance, if the current script was accessed via the URL http://www.example.com/php/path_info.php/some/stuff?foo=bar, then $_SERVER['PATH_INFO']would contain /some/stuff.

See: http://php.net/manual/en/reserved.variables.server.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.