I have spent some time but can't figure out what's wrong. I am using CodeIgniter 2.1.0.
So basically its like this:
My pagination settings:
$config['base_url'] = base_url() . '/stores/';
$config['total_rows'] = $this->stores_model->getTotalRows();
$config['per_page'] = 20; //display 20 rows per page
$config['num_links'] = 10; //display 10 pagination links
$config['uri_segment'] = 2;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
I am getting data chunks like this from controller. Which is also working.
$data['stores'] = $this->stores_model->getChunks($config['per_page'], $this->uri->segment(2));
My view page have:
<?php echo $this->pagination->create_links(); ?>
Now everything is working fine. At first the 10 pagination links are shown but when I click on the link 8, 9 or 10 etc. the pagination links bloats. It shows now links 1 to 20. Why is that? It might be something very simple but can't seem to figure that out. I was expecting the pagination links kind of scroll but shows only 10 links as I have set in config.
Thanks and regards
Deepak
Now I understand
$config['num_links'] got me confused for a while.
This means the number of links to show on both sides (previous and next) of current link.
ie. (show prev 10 links from current) <----- [current page] -----> (show next 10 links from current)
setting it to 5 solved the problem. Now I have about 11 links showing in total all the time as expected.
Thanks again
Deepak
Related
Apologies for another question re this, but I've tried so hard to get this working (I'm fairly new to SharePoint, don't have extensive coding knowledge, but know HTML and generally alright at trouble shooting).
We are using SharePoint online and we have SharePoint Tiles. We have recently added a few more tiles and it's obviously not wrapping these tiles, thus having to scroll right to access some.
I have found the code for wrapping the tiles here and when editing the page source, it appears to be working... until I save it. The code I put in is stripped out when I next go to the content editor.
I've read a few pages on it and have tried things such as the content editor web part, but for the life of me cannot get it to work.
If anyone would know if there's a step to step guide to ensure wrapped tiles are saved, I may be able to get it to work.
Any help is greatly appreciated.
If it changes anything, we use SharePoint online that is part of our Office 365 account.
Add the following code into script editor web part in the page.
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// Update this value to the number of links you want to show per row
var numberOfLinksPerRow = 6;
// local variables
var pre = "<tr><td><div class='ms-promlink-body' id='promlink_row_";
var post = "'></div></td></tr>";
var numberOfLinksInCurrentRow = numberOfLinksPerRow;
var currentRow = 1
// find the number of promoted links we're displaying
var numberOfPromotedLinks = $('.ms-promlink-body > .ms-tileview-tile-root').length;
// if we have more links then we want in a row, let's continue
if (numberOfPromotedLinks > numberOfLinksPerRow) {
// we don't need the header anymore, no cycling through links
$('.ms-promlink-root > .ms-promlink-header').empty();
// let's iterate through all the links after the maximum displayed link
for (i = numberOfLinksPerRow + 1; i <= numberOfPromotedLinks; i++) {
// if we're reached the maximum number of links to show per row, add a new row
// this happens the first time, with the values set initially
if (numberOfLinksInCurrentRow == numberOfLinksPerRow) {
// i just want the 2nd row to
currentRow++;
// create a new row of links
$('.ms-promlink-root > table > tbody:last').append(pre + currentRow + post);
// reset the number of links for the current row
numberOfLinksInCurrentRow = 0;
}
// move the Nth (numberOfLinksPerRow + 1) div to the current table row
$('#promlink_row_' + currentRow).append($('.ms-promlink-body > .ms-tileview-tile-root:eq(' + (numberOfLinksPerRow) + ')'));
// increment the number of links in the current row
numberOfLinksInCurrentRow++;
}
}
});
</script>
We can also use CSS style below in script editor web part in the page to achieve it.
<style>
.ms-promlink-body {
width: 960px;
}
</style>
I built up a jump pagination with a link to the last and first page in my tumblr theme with these 2 codes :
First
Last
The problem is it doesn't work with tag pages it only works in the home page so I tried to modify these codes and it worked for the last page link by changing :
Last into Last
However I didn't found the solution for the first page link can someone help me ?
My tumblr blog adress is : amadeusjacobs.com
Tumblr Theme Code Snippet
{block:Pagination}
<a id="first_page">first</a>
{block:PreviousPage}
prev
{/block:PreviousPage}
{block:JumpPagination}
{block:CurrentPage}
<span class="current_page">{PageNumber}</span>
{/block:CurrentPage}
{block:JumpPage}
<a class="jump_page" href="{URL}">{PageNumber}</a>
{/block:JumpPage}
{/block:JumpPagination}
{block:NextPage}
next
{/block:NextPage}
<a id="last_page">last</a>
<script type="text/javascript">
var f = document.getElementById("first_page"),
l = document.getElementById("last_page"),
p = window.location.pathname.replace(/\/*$/, ""),
i = p.indexOf("/page/"),
j = p.length,
u = i > 0 ? p.substr(0, i) : (i == -1 && j > 0) ? p : "/";
f.setAttribute("href", u);
u = u.length == 1 ? "" : u;
l.setAttribute("href", u + "/page/{TotalPages}");
</script>
{/block:Pagination}
Notes
This is obviously only going to work if the user has JS enabled
Works for all paginated pages
For a limited time, you can test this here
ETA
Of course, I had to play with it until I broke it. All cases should be covered, now.
I have a large db table that I want to show to users. I show the info in a table, about 30 rows per page. I want to use jqPagination to allow the users to jump to a different page. So page 1 will show rows 1-30, page 2 will show rows 31-60,... The only example I see are showing how to use it to jump to different section of a page. Is it possible to use jqPagination in a way to request the next 30 rows to a new page?
Thanks in advance!
If you're displaying all table rows to begin with you could use the following code to only show 30 at a time:
$(document).ready(function() {
// select the table rows
$table_rows = $('.table-example tbody tr');
var table_row_limit = 30;
var page_table = function(page) {
// calculate the offset and limit values
var offset = (page - 1) * table_row_limit,
limit = page * table_row_limit;
// hide all table rows
$table_rows.hide();
// show only the n rows
$table_rows.slice(offset, limit).show();
}
$('.pagination').jqPagination({
max_page: $table_rows.length / table_row_limit,
paged: page_table
});
// set the initial table state to page 1
page_table(1);
});
Table pagination example.
If you don't display all rows to begin with, you could adapt this code to fetch the rows from your system using AJAX instead of showing / hiding.
I'm having problems with TYPO3. I have been using it for quite a few years, since version 3.8 but this is my first site using version 4.5 and I am having problems with the menus and the rootline.
I believe it is related to how the rootline is created. using the code below for the breadcrumb/path type of menu only the current page is displayed. The menu only displays page X using example and code below when in page X and it should be
home > section 1 > sb a > page X
home
--- section 1
------- sub A
---------- page X
--- section 2
Also when displaying menus the ACT state isn't being properly activated. As I understand every page in the path/rootline should activate the ACT state and it is not happening with code below.
Has any thing changed in this version?
I have used both piece of codes in many sites up to now in version 4.5
codes
temp.breadcrumbs = HMENU
temp.breadcrumbs.special = rootline
#temp.breadcrumbs.includeNotInMenu = 1
#temp.breadcrumbs.special.range= -2 | -1
temp.breadcrumbs.special.range = 0
temp.breadcrumbs.1= TMENU
temp.breadcrumbs.1.noBlur = 1
temp.breadcrumbs.1.NO.allWrap= | > |*||*| |
## with and without line ... special.range ...
.....
....
temp.topmenu.1 {
wrap = <ul>|</ul>
# NO.allWrap = <li>|</li>
expAll = 1
NO.wrapItemAndSub = <li>|</li>
# Enable active state and set properties:
ACT = 1
ACT.wrapItemAndSub = <li class="current-menu-item">|</li>
}
temp.topmenu.2 = TMENU
temp.topmenu.2.noBlur = 1
temp.topmenu.2 {
wrap = <ul class="sub-menu">|</ul>
NO.linkWrap = <li>|</li>
# Enable active state and set properties:
ACT = 1
ACT.linkWrap = <li class="active">|</li>
#ACT.allWrap = <li class="selected">|</li>
#ACT.ATagBeforeWrap = 1
}
thanks
Ivan.
as cascaval wrote it's quite common to declare begin and end levels, anyway 0 value is aceptable too, as written in doc for entryLevel
Default is "0" which gives us a menu of the very first pages on the site.
Probably you put some TypoScript on the page X which has Rootlevel field checked, so it avoids traversing the tree up-side. I examined your sample code on first implementation I had available and it works as expected.
The range is supposed to be defined as [begin-level] | [end-level] so try:
temp.breadcrumbs.special.range = 0|-1
...or...
temp.breadcrumbs.special.range = 1|-1
-1 means current page.
-2 means the page one level up from the current page.
NOTE: You should probably set temp.breadcrumbs.includeNotInMenu = 1 because usually you would like to have all the pages in the breadcrumbs (as the structure that breadcrumbs represent wouldn't otherwise make sense), that is including those that you don't want to appear in other menus.
Had the same problem in Typo3 6.2.14 and finally found a solution.
After clearing "Template on Next Level" rootline worked perfectly.
Reason:
the root template was referenced in root templates "Template on Next
Level".
Solution:
edit root template
switch to tabfolder "Options"
clear field "Template on Next Level"
Essential is that my app parses the results of search from Yahoo!. There was easy to define that to get first page I need to from the next URL
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>
but what's straight link to any other page from yahoo! search page ? If to see on link there is
a href="/search;_ylt=A0oG7mulOyVP3FMAnPlXNyoA?p=java&fr=404_web&fr2=sb-bot&xargs=0&pstart=1&b=11&xa=U7cN_L3AOtj18W09Ud7SkA--,1327926565" title="Results 11 - 20" id="yui_3_3_0_1_1327840165621204"
but where is this some param, changing that I can to go to the next page or just to 10 page, for example? Does somebody know about this feature of yahoo?
By the way, YouTube hasn't such problem, his links are very simple, but Yahoo...
UPD Seems to be I defined this params - this is "b=11". Second page has "b=21", the third - "b=31" and so on
Link directly to specific pages by setting the offset (b) correctly.
Yahoo currently shows 10 results on each page, therefore use the following offset:
offset = 10 x pagenumber - 9
Quick example based on the URL you provided:
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>
Page 1 (offset = 10 x 1 - 9 = 1)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=1
Page 2 (offset = 10 x 2 - 9 = 11)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=11
Page 3 (offset = 10 x 3 - 9 = 21)
http://search.yahoo.com/search;_ylt=A0oG7l7PeB5P3G0AKASl87UF?p=<My_Keyword>&b=21
Note:
I don't know the future, but currently the links above work fine.
Yahoo might change the URL structure any time.
What is the role of this parameter "_ylt" ?
I think there is no problem to ignore it.
Yahoo in different country have different content of "_ylt".
And the HTTP has been changed to https://, not http:// .
Taiwan:
https://tw.search.yahoo.com/search?p=soqi+bed&fr=yfp&ei=utf-8&v=0
https://tw.search.yahoo.com/search;_ylt=A8tUwZBhGxlU93YAZHJr1gt.?p=soqi+bed&ei=utf-8&fr=yfp&b=11&pstart=2
US(eng):
https://search.yahoo.com/search;_ylt=AiVNJTPKVpm9Jag8U.STVL6bvZx4?p=soqi+bed&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-329&fp=1
https://search.yahoo.com/search;_ylt=AwrSbDzyGRlUoG0AUn1XNyoA?p=soqi+bed&ei=UTF-8&fr=yfp-t-329&fp=1&b=11&pstart=7
Japan:
http://search.yahoo.co.jp/search;_ylt=A7dPKW9aHBlUDm4A5b2JBtF7?p=soqi+bed&search.x=1&fr=top_ga1_sa&tid=top_ga1_sa&ei=UTF-8&aq=&oq=&afs=
http://search.yahoo.co.jp/search?p=soqi+bed&tid=top_ga1_sa&ei=UTF-8&pstart=1&fr=top_ga1_sa&b=11