Use query strings with Pagination Class in Codeigniter - string

Is it possible to append query strings to the links created by the pagination class?
Currently if you are on this page:
http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes?price_low=19&price_high=300
the links are incorrectly generated as
http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes&per_page=20
http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes&per_page=40
etc.
where it should be:
http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes?price_low=19&price_high=300&per_page=20
http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes?price_low=19&price_high=300&per_page=40
etc.
I have tried to pass
$config['base_url'] = current_url();
to the Pagination class, but that doesn't work.
Update: I gave up on this and following a post on CI forums, I have build an intermediate controller that takes the $_POST array and builds a query string
$query = 'type:apartment,house&price_low:15000&price_high:60000';
Then redirects to the Browse controller
http://127.0.0.1/~panayi/xryses/Nicosia/browse/type:apartment,house&price_low:15000&price_high:60000
and paginated views:
http://127.0.0.1/~panayi/xryses/Nicosia/browse/type:apartment,house&price_low:15000&price_high:60000/20
http://127.0.0.1/~panayi/xryses/Nicosia/browse/type:apartment,house&price_low:15000&price_high:60000/40
etc.

You will need to customize the Pagination library of Codeigniter to do this.

Related

Returning 2 callbacks to scrapy URLs with no HREF tags

I'm currently using a CrawlSpider to look for any links and therefore follow them.
In order to crawl urls without HREF tags (plain text) i'm extracting them and then using the following snippet to add them back into the parse method.
return scrapy.Request(f'http://{url}')
The problem with this method is that the base URL doesn't get called into my other parser method. e.g. example.com doesn't but example.com/example does. I've tried adding a callback into the code (callback=self.url_parser) but then the default parse method isn't called and therefore doesn't crawl and follow links.
Is there a way to pass these href-less links into the default parse method (in order to follow links) but also have them parsed by my parser method?
Thanks!
I ended up changing my callback on the rules to parse_start_url and everything worked perfectly

Why paginate widget is not including my query string parameters?

I have news listing including pagination with news tags. When i am paginate through news(or any custom extension) it bypass parameter.
On page /tag the pagination links should look like this: /tag/seite/2 but i just get /seite/2 without any parameters.
Any ideas what i am doing wrong/how to solve my issue?
I tried it by adding addQueryStringMethod="GET" as parameter in <f:widget.link> and it works!

Friendly URLs in XPages

in order to open a document with an XPages, we have to call an url with following format :
http://server/database/name_of_xpage.xsp&documentID=xxxx
In one of my databases, the documents to open contain a "title" field.
I'd like to open the document by using an url like this : http://server/database/title_value
How to force the domino server to answer to such an url and to open the related XPage (like it's working on stackoverflow web site)
There are few options:
administrative solution - you can configure Domino to translate URLs at server level
XAgent, Form opening script, LotusScript agent - to redirect to correct URL
Form property to redirect to XPage, described below.
All you need is to make a view with short name or alias, "key" for example. First sorted column should contain your key value. Form property of every document should define XPage to open on web. Then url like this http://server/database/key/title_value will work. With one small caveat.
Create a web site substitution rule to redirect http://server/database/* to
http://server/database/yourxpage.xsp?openPage=*
You could create an XAgent (I called mine "open"), and take in smaller parameters to open the document. For example, let's say your main XPage "form" is called "xpDoc". Here is your XAgent (code in afterRenderResponse):
var val = context.getUrlParameter('title');
var nd:NotesDocument = database.getView('viewname').getDocumentByKey(val);
context.redirectToPage('xpDoc.xsp?documentId=' + nd.getUniversalID() + '?OpenDocument');
So, using this simple XAgent, you can use URLs to open documents, like so:
http://server/database/open.xsp?title=title_value
I just tried it out in a development db I have, and it seems to work pretty well. You can always make the XAgent name and "title" parameter smaller, to make the link smaller.
Take note that with this option, you won't need to update the NAB with any website rules. Since you want to link to documents, I'm assuming that you have more than a handful of documents in your application. Adding website rules in the NAB, I don't think, would be a good option as this would add a lot of extra maintenance. With the above method, everything can be done within your application.

Pagination with Blog/index.html in Jekyll-3.2.1

I am having a problem that seems to be somewhat common with using pagination on pages other than index.html in a Jekyll project.
I found this post that seemed to be exactly what I am looking for:
Jekyll Pagination on every page
However, the solution does not work for me. According to the documentation on Jekyll's website, the following code in _config.yml should change the paginator to use /Blog/index.html rather than /index.html:
gems: [jekyll-paginate]
paginate: 2
paginate_path: "/blog/page:num/"
I have rebuilt and restarted my local server, but the paginator still only works on the /index.html and not /Blog/index.html.
Does anyone have an idea what I could be missing here?
The paginator internal logic is to :
(from code comment) "Determine if a page is a possible candidate to be a template page. Page's name must be index.html and exist in any of the directories between the site source and paginate_path."
choose the one closest to paginate_path in length.
In your case Blog/index.html is not recognized as existing in /blog/ path, because Blog != blog.
Or you rename your containing folder to blog, or you set paginate_path: "/Blog/page:num/"

Laravel pagination redirect

I'm using Laravel 4 pagination, and want to remove the page=1 and serve the default string instead; for example:
http://domain.com/search-results/
instead of
http://domain.com/search-results/?page=1
Of course, for page >=2, it's just fine to leave:
http://domain.com/search-results/?page=2
Currently Laravel will always default to showing ?page=1.
Accomplishing what you want (always defaulting to not showing ?page=1) involves a mix of extending/using your own Presenter and/or also by using a custom Pagination view.
Stock pagination views are here, but you can create your own and define it within the view.php config.
In my blog, I do similar. My pagination view is here. You can see it loads in a custom Presenter class.
Note that my blog may not be up to date with latest Laravel code, but that should get you on your way to making the edits you need to do to accomplish that.
You may be able to skip code altogether and use a server configuration to redirect - That link assumes Apache.

Resources