FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Codeigniter - pagination
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Codeigniter - pagination [message #174467 is a reply to message #174392] Mon, 13 June 2011 07:59 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 10/06/2011 0:22, Tomasz Łopusiewicz escribió/wrote:
> Hello i dont know why the 4 segment of my url is always empty ($3
> number after slash)
>
> ja use mod_rewrite:
>
> RewriteRule ^kategoria-([0-9]+)-(.*)/([0-9]+).html$ index.php?/cat/
> lista/$1/$3 [L]

In regular expressions, the dot (.) symbol has a special meaning:

http://es.php.net/manual/en/regexp.reference.dot.php

If you want to match a literal dot, you need to escape it.


>
>
> config.php
>
> $config['uri_protocol'] = 'QUERY_STRING';
> $config['index_page'] = 'index.php';
> $config['url_suffix'] = '';
>
> Ofcourse without mod_rewrite method: index.php/cat/lista/3/40 works
> fine

Of course, you forgot to provide an example of URL that fails to match
as expected. With my example, it works:


<?php

$url = 'kategoria-3-foo/40.html';
if( preg_match('@^kategoria-([0-9]+)-(.*)/([0-9]+).html$@', $url,
$matches) ){
var_dump($matches);
}

.... prints:

array(4) {
[0]=>
string(23) "kategoria-3-foo/40.html"
[1]=>
string(1) "3"
[2]=>
string(3) "foo"
[3]=>
string(2) "40"
}




--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: variable value gets lost
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 18:07:16 GMT 2024

Total time taken to generate the page: 0.04181 seconds