Title Name Help

Started on the old forum in September 2012 · view the original in the archive · old links redirect here

13 replies · 871 views · started 14 years ago · 1 min read

4 participants
brentg Developer · 95 posts #1

Hi All

i got a small problem that hopefully someone can help.

For the 'title' i have this code but it outputs with all the 'symbols', what can i change to remove all the symbols and '&sort=1'

echo '<title>'.str_replace(".php","",basename($_SERVER['REQUEST_URI'])).' |'.$_SERVER['HTTP_HOST'].'</title>';

but the title name shows as:

Kid%20Cudi%20-%20Creepers.mp3&sort=1 |SiteName

what can i do to make it show like this:

Kid Cudi - Creepers.mp3 | SiteName

Free Mobile Downloads: http://playwap.mobi

mFreak Developer · 66 posts #2

use urldecode() .it will remove those %xx codes

$("#mfreak").find(".head brain").clone();

Progress:

[|||___________________________] : 5%

Output:

Memory limit reached, unable to complete operation.

Support answer:

Try using a super uber strong mega computer to reach at least 10%.

👋

brentg Developer · 95 posts #3

Thanks mfreak

where do i exactly put the urldecode

'.str_replace(".php","",basename($_SERVER['REQUEST_URI'])).'

Free Mobile Downloads: http://playwap.mobi

softwarefreak Senior · 349 posts #4
$title = rawurldecode(str_replace(".php", "", basename($_SERVER['REQUEST_URI'])));
$title = preg_replace("#&sort=[0-9]+#i", '', $title);
echo "<title>$title | " . $_SERVER['HTTP_HOST'] . "</title>";

If this doesn't works copy & paste the URL of the page here

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

softwarefreak Senior · 349 posts #6

brentg wrote: thanks software,

i tried the code, never worked edited and the symbols were gone but my content never showed?

Here we go: 2%20Chainz%20ft%2050%20Cent%20-%20Riot%20%28Remix%29.mp3&sort=0|PlayWAP.Mobi

Thanks

I guess in your script, mysql_connect is used after sending the head of the html, you cud have used the filename in the title directly from db records, anyways, you may use the below code

$title = basename($_GET['file']);
echo "<title>$title | " . $_SERVER['HTTP_HOST'] . "</title>";

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

brentg Developer · 95 posts #8

Hi guys sorry to bring this up again but i need add the folder name to my header to further help with SEO.

at the moment i got this code as my header in index.php (Autoindex script)

Im using:

echo '<title>'.str_replace(".php","",basename($_SERVER['REQUEST_URI'])).'|PlayWAP.Mobi</title>';

and it shows:

index?p=0&sort=1&dir=Wallpaper | PlayWAP.Mobi:

I would like it to show like: Wallpaper | PlayWAP.Mobi

I googled all functions, tried them all. They returning as error or doesn't do anything.

Thanks so much

Free Mobile Downloads: http://playwap.mobi

brentg Developer · 95 posts #10

Gumslone THANK YOU SO MUCH!!!

😇

Added after 28 minutes:

Hi Gumslone I just had a look on other pages and titles with spaces return as eg. Music%20Videos | PlayWap.Mobi anything I can add into the code to remove those symbols. Thanks

Free Mobile Downloads: http://playwap.mobi

GumSlone Administrator Principal · 1,690 posts #11

yes

str_replace('%20', ' ', end(array_filter(explode("=", $_SERVER['REQUEST_URI']))))

or you could also do:

str_replace('%20', ' ', end(array_filter(explode("/", $_GET['dir']))))

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

brentg Developer · 95 posts #12

AWESOME! It works, Thanks a million Gumslone.

Im gonna sound like nuisance now but my auto index script has sort by name and date.

When i sort by date then your above code works and shows: Music Video | PlayWap

But when its sorted by name (default) like this: /dl/index.php?dir=/Music Videos&p=0&sort=0

The code above makes the title - 0&sort | PlayWAP

I know its not a biggy but if you dont mind and if there is a another piece of code I can use, I would really appreciate it.

Thanks again

EDIT: I just saw the other code you posted, that seems to make it all work! A million thanks man!!!! 😇

Free Mobile Downloads: http://playwap.mobi

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close