Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

SmartyPaginate::setUrlVar

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
kajtek
Smarty n00b


Joined: 10 Nov 2012
Posts: 4
Location: Poland

PostPosted: Tue Feb 05, 2013 6:05 pm    Post subject: SmartyPaginate::setUrlVar Reply with quote

I have problem with, SmartyPaginate::setUrlVar and SmartyPaginate::setUrlVar;


I want to get only number in $_GET

SmartyPaginate::setUrlVar('');
SmartyPaginate::setUrl("short_url,");

and I get
example.pl/short_url,?=1
I want to get
example.pl/short_url,1

How can I do this?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Feb 06, 2013 2:40 pm    Post subject: Re: SmartyPaginate::setUrlVar Reply with quote

kajtek wrote:
I have problem with, SmartyPaginate::setUrlVar and SmartyPaginate::setUrlVar;


I want to get only number in $_GET

SmartyPaginate::setUrlVar('');
SmartyPaginate::setUrl("short_url,");

and I get
example.pl/short_url,?=1
I want to get
example.pl/short_url,1

How can I do this?


If you that, the number will no longer be in $_GET. You have to have ?x=y format to obtain your values from $_GET.
Back to top
View user's profile Send private message Visit poster's website
kajtek
Smarty n00b


Joined: 10 Nov 2012
Posts: 4
Location: Poland

PostPosted: Fri Feb 08, 2013 12:05 am    Post subject: Reply with quote

I know but, I have in this in htaccess I must place variables in the correct order. My problem is that I cant modify url i SmartyPaginate.

I have in htaccess

index.php?x=$1&y=$2&smartpager=$3 When I add in
SmartyPaginate::setUrl("x1,x2,smartypager"); and run script I have

example.pl/x1,x2.?=NrPage
I want
example.pl/x1,x2,NrPage without out ?=
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Feb 08, 2013 2:29 am    Post subject: Reply with quote

You will have to adjust SmartyPaginate to assemble the URL that way, and then you will have to have your backend pick the values from the PATH_INFO.
Back to top
View user's profile Send private message Visit poster's website
kajtek
Smarty n00b


Joined: 10 Nov 2012
Posts: 4
Location: Poland

PostPosted: Fri Feb 08, 2013 3:31 pm    Post subject: Reply with quote

Ok, I'm done

I change in file
function.paginate_middle.php

Before
Code:
 if($_item != $_curr_item) {
            $_this_url = $_url;
            $_this_url .= (strpos($_url, '?') === false) ? '?' : '&';
            $_this_url .= SmartyPaginate::getUrlVar($_id) . '=' . $_item;
            $_ret .= $_link_prefix . '<a href="' . str_replace('&', '&amp;', $_this_url) . '"' . $_attrs . '>' . $_text . '</a>' . $_link_suffix;
        } else {
            $_ret .= $_link_prefix . $_text . $_link_suffix;
        }



After
Code:
        if($_item != $_curr_item) {
            $_this_url = $_url;
           
             if(SmartyPaginate::getUrlVar($_id) == 'page_next') $_this_url .= ','.$_item;
              else{
               $_this_url .= (strpos($_url, '?') === false) ? '?' : '&';
               $_this_url .= SmartyPaginate::getUrlVar($_id) . '=' . $_item;
               }
            $_ret .= $_link_prefix . '<a href="' . str_replace('&', '&amp;', $_this_url) . '"' . $_attrs . '>' . $_text . '</a>' . $_link_suffix;
        } else {
            $_ret .= $_link_prefix . $_text . $_link_suffix;
        }



Now SmartyPaginate::setUrlVar('page_next') must be SmartyPaginate::setUrlVar('&page_next=');

for short url (htaccess) SmartyPaginate::setUrlVar(''); and return only number

and
Code:
RewriteRule ^pod,([a-zA-Z-_0-9]+),([a-zA-Z-_0-9]+),([a-zA-Z-_0-9]+)$ index.php?a=strona&tytul_pod=$1&id=$2&page_next=$3 [NC,L]                                                               
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP