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
Switch to threaded view of this topic Create a new topic Submit Reply
Codeigniter - pagination [message #174392] Thu, 09 June 2011 22:22 Go to next message
Tomasz opusiewicz is currently offline  Tomasz opusiewicz
Messages: 1
Registered: June 2011
Karma: 0
Junior Member
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]


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
Re: Codeigniter - pagination [message #174393 is a reply to message #174392] Thu, 09 June 2011 23:21 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 6/9/2011 6:22 PM, Tomasz Łopusiewicz 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]
>
>
> 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

And your PHP question is?

mod_rewrite is NOT a PHP module - it's an Apache module. Try a more
appropriate newsgroup, such as alt.apache.configuration.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
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: 0
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
--
  Switch to threaded view of this topic Create a new topic Submit Reply
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 17:42:25 GMT 2024

Total time taken to generate the page: 0.02664 seconds