Converting from ?id=blah to ?blah [56k warning]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Converting from ?id=blah to ?blah [56k warning]

Post by theda »

Edit: I am going to rephrase myself to alleviate confusion...

1. Source code
--http://dumbass.ionichost.com/img/source_main.php
--http://dumbass.ionichost.com/img/source_index.php

2. The parts to be aware of:
--Anything that has ?id= or $id sitting in it. (Mostly on main source page)
--Anything that says "URL, PAGE, LOAD IDENTITY" (Mostly on index source page)
--http://www.invano.com/'s "Invano Navigation PHP Tutorial"

3. Questions
--How would I integrate Invano's url explode script so that it reduces ?id=blah to ?blah, while still integrating my current news/content include page (That also has a "if file exists, load the content, if not, auto load the news page")
--How do I keep my "Page Last Modified" snippet working, as it requires the definition of "$id" to be present, which if the Invano snippet is substituted, then $id wouldn't be defined, leaving errors like "Cannot find .php page on main.php line XX"

4. Notes
--I have no access to the core PHP files, only my scripts (aka, I can't access the php installation_
--I cannot edit .htaccess on my server
Last edited by theda on Sat Jul 16, 2005 11:20 am, edited 6 times in total.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Your server would need mod_rewrite to do this
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Edit: I have rephrased my original post, please refer to it for latest information.
Last edited by theda on Sat Jul 16, 2005 11:17 am, edited 2 times in total.
x4t
Forum Newbie
Posts: 8
Joined: Wed Jul 06, 2005 9:53 am
Location: Netherlands
Contact:

Post by x4t »

bokehman wrote:Your server would need mod_rewrite to do this
You can also reach the goal with Multiviews :-)
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Edit: I have rephrased my original post, please refer to it for latest information.
Last edited by theda on Sat Jul 16, 2005 11:17 am, edited 1 time in total.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

theda wrote:What exactly is that?
An apache module
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Edit: I have rephrased my original post, please refer to it for latest information.
Last edited by theda on Sat Jul 16, 2005 11:18 am, edited 1 time in total.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

theda wrote:I can only use PHP for this... if you havent guessed already.
The query string is read and interpreted by the server and passed to the php script so if you want the it rewritten you will need that module.
x4t
Forum Newbie
Posts: 8
Joined: Wed Jul 06, 2005 9:53 am
Location: Netherlands
Contact:

Post by x4t »

theda wrote:I can only use PHP for this... if you havent guessed already.
Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4tthis... if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

&lt;?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER&#1111;'PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER&#1111;'PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata&#1111;] = '';
            $num_param++;
        }
        for($i = 1; $i &lt; $num_param; $i += 2)
            $get&#1111; $vardata&#1111;$i] ] = $vardata&#1111;$i+1];
    }
    return $get;
}

?&gt; quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER&#1111;'PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER&#1111;'PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata&#1111;] = '';
            $num_param++;
        }
        for($i = 1; $i &lt; $num_param; $i += 2)
            ltiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER&#1111;'PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER&#1111;'PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata&#1111;] = '';
            $num_param++;
        }
        for($i = 1; $i &lt; $num_param; $i += 2)
            $get&#1111; $vardata&#1111;$i] ] = $vardataisn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
         "theda"]I can only use PHP for this... if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews()[/b:20427d4c"theda"]I can only use PHP for this... if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t= 0)
{
$vardata[] = '';
$num_param++;
}
for($i = 1; $i < $num_param; $i += 2)
$get[ $vardata[$i] ] = $vardata[$i+1];
}
return $get;
}

?>

(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4tet;
}

?>

(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardatod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER&#1111;'PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
         if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t]
RewriteEngine On
Options MultiViews

(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultmp;lt;?php
function parseMultiviews()
{
$get = array();
if(!empty($_SERVER['PATH_INFO']))
{
$vardata = explode('/', $_SERVER['PATH_INFO']);
$num_param = count($vardata);

if($num_param % 2 == 0)
{
$vardata[] = '';
$num_param++;
}
for($i = 1; $i < $num_param; $i += 2)
$get[ $vardata[$i] ] = $vardata[$i+1];
}
return $get;
}

?>

(very fast typed and not the best ex only use PHP for this... if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t20427d4cb8]
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al argumenseMultiviews()
{
$get = array();
if(!empty($_SERVER['PATH_INFO']))
{
$vardata = explode('/', $_SERVER['PATH_INFO']);
$num_param = count($vardata);

if($num_param % 2 == 0)
{
$vardata[] = '';
$num_param++;
}
for($i = 1; $i < $num_param; $i += 2)
$get[ $vardata[$i] ] = $vardata[$i+1];
}
return $get;
}

?>

(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t11; $vardata[$i] ] = $vardata[$i+1];
}
return $get;
}

?>

(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t
RewriteEngine On
Options MultiViews

(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER&#1111;'PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata&#1111;] = '';
            $num_param++;
        }
        for($i = 1; $i &lt; $num_param; $i += 2)
            $get&#1111; $vardata&#1111;$i] ] = $vardata&#1111;$i+1];
    }
    return $get;
}

?&gt; 
ultiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example th
if($num_param % 2 == 0)
{
$vardata[] = '';
$num_param++;
}
for($i = 1; $i < $num_param; $i += 2)
$get[ $vardata[$i] ] = $vardata[$i+1];
}
return $get;
}

?>

(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t"theda"]I can only use PHP for this... if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata&#11!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4tr this... if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews()[/b:20427d4cess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4tfor this... if you havent guessed already.[/quote]

Mod rewrite isn't PHP either. Multiviews is.
You'll have to add this to a .htaccess file;

Code: Select all

RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER&#1111;'PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata&#1111;] = '';
            $num_param++;
        }
        for($i = 1; $i &lt; $num_param; $i += 2)
            $get&#1111; $vardata&#1111;$i] ] = $vardata&#1111ions MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata&#1111;] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[4cb8]
RewriteEngine On
Options MultiViews
(sometimes +Multiviews)

Than you'll have to use a code like

Code: Select all

<?php
function parseMultiviews()
{
    $get = array();
    if(!empty($_SERVER['PATH_INFO']))
    {
        $vardata = explode('/', $_SERVER['PATH_INFO']);
        $num_param = count($vardata);
    
        if($num_param % 2 == 0)
        {
            $vardata[] = '';
            $num_param++;
        }
        for($i = 1; $i < $num_param; $i += 2)
            $get[ $vardata[$i] ] = $vardata[$i+1];
    }
    return $get;
}

?>
(very fast typed and not the best example though)

If you then call VER['PATH_INFO']))
{
$vardata = explode('/', $_SERVER['PATH_INFO']);
$num_param = count($vardata);

if($num_param % 2 == 0)
{
$vardataї] = '';
$num_param++;
}
for($i = 1; $i < $num_param; $i += 2)
$get[ $vardata[$i] ] = $vardata[$i+1];
}
ret
<?php
function parseMultiviews()
{
$get = array();
if(!empty($_SERVER['PATH_INFO']))
{
$vardata = explode('/', $_SERVER['PATH_INFO']);
$num_param = count($vardata);

if($num_param % 2 == 0)
{
$vardata[] = '';
$num_param++;
}
for($i = 1; $i < $num_param; $i += 2)
$get[ $vardata[$i] ] = $vardata[$i+1];
}
return $get;
}

?>

(very fast typed and not the best example though)

If you then call parseMultiviews(), the script will parse al arguments behind the =.

x4t
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

I can't see how that is connected to what he wants to do. It would seem that all he wants to do is get rid of the crufty uri.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Edit: I have rephrased my original post, please refer to it for latest information.
Last edited by theda on Sat Jul 16, 2005 11:18 am, edited 1 time in total.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

The links to source code you posted are to *localhost*. We cannot see the code, so we can't give any advice on how to change the code.

As a general statement, I'd say if you are already using the $id variable in one script, and the new script conflicts, do a search replace of that variable.

However, with no information beyond that, like being able to see the code, I can't give an accurate answer.
theda wrote:So please, quit giving me the same WRONG answer.
I sincerely encourage you to adjust your attitude. People are trying to help you, and you are not only insulting them, you are also being rude in exchange. This is a learning forum - many of the members (yourself included, since you have questions to ask) still are not perfect.

The fact that they are attempting to help you is why you are here. Continued rude responses to attempts at helping you can ensure that you will get few or no responses from the people that visit often.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Edit: I have rephrased my original post, please refer to it for latest information.
Last edited by theda on Sat Jul 16, 2005 11:18 am, edited 1 time in total.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Edit: I have rephrased my original post, please refer to it for latest information.
Last edited by theda on Sat Jul 16, 2005 11:19 am, edited 1 time in total.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

theda wrote:LMAO! Oopsies, sorry about that... I used the wrong url
Which script on invano are you trying to integrate that causes a conflict?
theda wrote:You don't know how annoying it is asking a specific answer, having people answer the wrong question, tell them something even more specific and get the same exact answers even after the fact...
I'd guess it's somewhere close to you continuing to be rude (to the people you are asking for help!) when I've asked you to try to be a little appreciative that ANYONE is willing to help you.

You aren't perfect, and neither is anyone on these forums. If you want perfect answers, go pay google answers. These forums are for learning - learning often means you will get wrong answers to get to the right answer.
Post Reply