GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Need quick php script (https://gfy.com/showthread.php?t=503242)

mkx 08-13-2005 04:40 PM

Need quick php script
 
If url = www.mysite.com/page.php
$Page = page.php

In that case I can put something like:
www.mysite.com/archive/<?php echo$page;?>archive3.php

Can someone do this for me quickly? In a nutshell, it is basically making a variable of the page name. (page.php)

Thanks!

woj 08-13-2005 04:43 PM

try this perhaps? ->
$page = $_SERVER['REQUEST_URI'];

mkx 08-13-2005 04:45 PM

thanks woj, let me give that a whirl

mkx 08-13-2005 04:47 PM

Displays "/test.php" I only want it to display "test" Sorry my fault for typing it wrong above

woj 08-13-2005 04:52 PM

$page = basename($_SERVER['REQUEST_URI']); (?)

mkx 08-13-2005 04:56 PM

That displays test.php without the / so it needs to just remove the .php

LazyD 08-13-2005 05:02 PM

$parts = explode(".", basename($_SERVER['REQUEST_URI']));

=> $parts[0] = test
=> $parts[1] = php

mkx 08-13-2005 05:04 PM

Quote:

Originally Posted by LazyD
$parts = explode(".", basename($_SERVER['REQUEST_URI']));

=> $parts[0] = test
=> $parts[1] = php

Parse error: parse error, unexpected T_DOUBLE_ARROW in /home/pornpar/public_html/test.php on line 4

budz 08-13-2005 05:06 PM

Quote:

Originally Posted by woj
$page = basename($_SERVER['REQUEST_URI']); (?)

Quote:

Originally Posted by mkx
That displays test.php without the / so it needs to just remove the .php


PHP Code:

$page str_replace(".php"""$page); 


woj 08-13-2005 05:06 PM

$page = basename($_SERVER['REQUEST_URI'],'.php'); (?)

mkx 08-13-2005 05:08 PM

Quote:

Originally Posted by woj
$page = basename($_SERVER['REQUEST_URI'],'.php'); (?)

Works perfect, thanks! One last thing, any chance that it can display "Test" instead of "test" first letter caps

LazyD 08-13-2005 05:09 PM

Quote:

Originally Posted by mkx
Parse error: parse error, unexpected T_DOUBLE_ARROW in /home/pornpar/public_html/test.php on line 4

nonono :winkwink:

What I wanted to say is that after "exploding" the string into an array, the variable $parts[0] will contain "test" and variable $parts[1] will contain "php".

woj 08-13-2005 05:12 PM

Quote:

Originally Posted by mkx
Works perfect, thanks! One last thing, any chance that it can display "Test" instead of "test" first letter caps

$page = ucfirst(basename($_SERVER['REQUEST_URI'],'.php'));

mkx 08-13-2005 05:15 PM

Quote:

Originally Posted by LazyD
nonono :winkwink:

What I wanted to say is that after "exploding" the string into an array, the variable $parts[0] will contain "test" and variable $parts[1] will contain "php".

sorry i am a php n00b

mkx 08-13-2005 05:16 PM

Quote:

Originally Posted by woj
$page = ucfirst(basename($_SERVER['REQUEST_URI'],'.php'));

Did I ever tell you how much I love you?

Thank you all!


All times are GMT -7. The time now is 06:08 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123