Create Boxes From Url ( mod_rewrite )

Discussion in 'PHP' started by brianj, Jun 18, 2010.

  1. #1
    Hi,

    i have some rewrite code like:
    RewriteRule ^([a-zA-Z0-9\_]+)/?$ /index.php?box1=$1 [L] 
    PHP:
    Now i'm trying to echo <div> boxes from a url like:

    domain.com/item1-item2-item3

    but the problem i have is that the url might have up to 10 items for comparison, so the rule needs to be infinite..

    anyone has an idea for that?
     
    brianj, Jun 18, 2010 IP
  2. flexdex

    flexdex Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Route all the ^item... urls to the same script and parse them with php/preg_match_all

    
    preg_match_all('/([\w\d]+)/m', $subject, $result, PREG_PATTERN_ORDER);
    $result = $result[0];
    
    PHP:
     
    Last edited: Jun 19, 2010
    flexdex, Jun 19, 2010 IP
  3. brianj

    brianj Member

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    Hm, i don't get it... is this comparable to:

    RewriteRule ^([a-z]+)$ /index.php?box1=$1 [L]
    RewriteRule ^([a-z]+)-([a-z]+)$ /index.php?box1=$1&box2=$2[L]
    RewriteRule ^([a-z]+)-([a-z]+)-([a-z]+)$ /index.php?box1=$1&box2=$2&box3=$3[L]
    PHP:
    ?

    This is actually what i try to do:

    [​IMG]


    Thanks for help;)
     
    brianj, Jun 19, 2010 IP
  4. brianj

    brianj Member

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    anyone give me a quote for that?
     
    brianj, Jun 19, 2010 IP
  5. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Message me with an elaborate idea i can give you the quotes! :)
    I know that you're going to display the products in boxes to compare right???
     
    roopajyothi, Jun 19, 2010 IP
  6. brianj

    brianj Member

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #6
    ok thanks.. anyone else looking into it?
     
    brianj, Jun 21, 2010 IP