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?

Link to comment
Share on other sites

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

Edited by kierany5
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.