How To Change Codeigniter Pager Parameter position - pagination

my url is mycontroller/function/apple/pagingpram
how can I change the parameter position of codeigniter uri pram
I want url like this:
mycontroller/function/pagingpram/apple/oranything

Using this in the pagination configuration
$config['uri_segment'] = 4; // where 4 is the pager parameter postion

Related

Hybris language not being encoded in URL

I have created my custom storefront b2c electronics and I found out that the LANG is not being persisted in the URL while I navigate through the page.
This is my local.properties site url config:
hac.webroot=/hac
customstorefront.webroot=
customstorefront.webroot=/custom
storefrontContextRoot=
website.custom.http=http\://custom.local\:9001/
website.custom.https=https\://custom.local\:9002/
This are my url patterns:
(?i)^https?://[^/]+(/[^?]*)?\?(.*\&)?(site=custom)(|\&.*)$
(?i)^https?://custom\.[^/]+(|/.*|\?.*)$
(?i)^https?://api\.hybrisdev\.com(:[\d]+)?/rest/.*$
(?i)^https?://localhost(:[\d]+)?/rest/.*$
Am I missing something?
To have the language as part of the Url, you also need to specify that this parameter is part of the UrlEncodingAttributes on your site. You can do this through an impex, or change it through backoffice
For example, something like this
INSERT_UPDATE CMSSite; uid[unique = true]; urlPatterns ; urlEncodingAttributes
; $siteUid ; (?i)^https?://custom\.[^/]+(|/.*|\?.*)$ ; language
If you also want the storefront to be part of the url, you also need to append it in this property like storefront,language.
Do note that the order in which you place the attributes also determines the order in which they appear in the url

Read the incoming url after adding a redirection rule on server

I have added a redirection rule on the domino server like this:
Incoming URL pattern: /xxx/*
Replacement pattern: /myDb.nsf/myXpage.xsp
How is it possible from the xpage to read the incoming url in the browser?
If I open this url:
"http://myDomain/xxx/test"
Then I get redirected to my xpage and if I do context.getUrl() i got
"http://myDomain/myDb.nsf/myXpage.xsp"
but is there an option to read the incoming url?
"http://myDomain/xxx/test"
Ýou can change your replacement pattern to
/myDb.nsf/myXpage.xsp/xxx/*
This allows you to access the part between the .xsp and the query parameters with
facesContext.getExternalContext().getRequestPathInfo()
F.e.
"http://myDomain/xxx/test"
would give you
"/xxx/test"
The browser can still get the original url so could you put the following the in the Client JS event, onClientLoad to redirect the user to the XPage with the right url parameters to properly provide the url parameter?
mystring = window.location.href;
var rightback = mystring.substring(mystring.lastIndexOf("/")+1,mystring.length);
window.location.href = "/test.nsf/testurl1.xsp?openxpage&id=" + rightback;
Change your redirection rule to include *:
Incoming URL pattern: /xxx/*
Replacement pattern: /myDb.nsf/myXpage.xsp?id=*
This way you can read the * part of your URL in your XPage using param.get("id") and then use that variable to find and open the relevant document.

Can I set default page to last page when paginating in Laravel 4?

In laravel 4, it's really convenient to do pagination. When the page parameter is missing, the default page is the first page. In my project, it's better to be the last page as default value.
Currently I'm using following UGLY way to hack the pagination. Is there any better way to do this?
if(!Input::get('page') && $comments->getLastPage() > 1)
//Redirect with page=lastPage
And the question can be also asked as that can I set the current page of paginate() function manually? If no, what can I do if I don't want the page parameter to be named page.
If you can live with setting the pagination manually:
// check if a page is set
if(!Input::get('page'))
{
// work out the last page
$lastPage = ceil($totalItems/$perPage);
// set the page - maybe merge would be better than replace???
Input::replace(array('page' => $lastPage));
}
// manually create the paginator
$paginator = Paginator::make($items, $totalItems, $perPage);
I don't know what you're displaying, but would reversing the sorting not work?
Paginator docs

joomla layout handling in custom component

where do I set the desired layout in the following function if is getting called like
$input = JFactory::getApplication()->input;
$input->set('view', $input->getCmd('view', 'Myview'));
and I would like to be redirected for example to /views/tmpl/edit.php
found it
it needs to be declared by url structure
You can either use &layout=edit in the URL, or set it in the view using $this->setLayout('edit');

Construct the url to fetch a page by url

With this code I create a page in a Google site:
pageEntry = new WebPageEntry();
pageEntry.setTitle(new PlainTextConstruct(PageTitle));
..
..
client.insert(new URL(getContentFeedUrl()), pageEntry);
If the PageTitle contains something like "création" the page will created with the name https://sites.google.com/.../.../cration. So "création" is changed to "cration".
Is the process to change the page name available in the API? I would like to fetch the page by its path, but the only key I have is "création".
Maybe a better solution would be to strip the diacritics from the characters in the string before setting it as a page title? For instance, see the javascript function here. Then you page would be created with the URL /creation, which could be more desireable.

Resources