Hi!
That is put together in include/functions_entries.inc.php (search for footer_info). It simply consinsts of a language constant and uses the values that are also available in Smarty as $footer_totalEntries, $footer_totalPages etc. Simply a shortcut.
Regards,
Garvin
Authors List
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Page Count in Footer
Thanks, Garvin.
Here's the problem I have with respect to my new page, info.tpl, which lists the entries as a single line only, no body. Since the total pages in the footer is calculated not on the length of the actual page, but on the number of entries divided by the fetch limit, it inaccurately counts the number of pages. Additionally, the Next Page link takes the user to an archive view for an apparently random date, which I totally don't understand.
To me, it looks like I need to calculate page breaks differently than is being done now. Can I get some help with that?
Thanks,
Myron
Code: Select all
$totalPages = ceil($totalEntries / $serendipity['fetchLimit']);
$serendipity['smarty']->assign('footer_info', sprintf(PAGE_BROWSE_ENTRIES, (int)$serendipity['GET']['page'], $totalPages, $totalEntries));To me, it looks like I need to calculate page breaks differently than is being done now. Can I get some help with that?
Thanks,
Myron
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Page Count in Footer
Hi!
I don't understand why you say it counts the pages wrong? You get X entries per page with a total of Y entries (thus ceil(Y/X) is Z = amount of pages) all for an author. Usually X is smaller than Y, if you have more than one page.
Which of X, Y or Z is not properly counted for you?
The next page should always lead to an archive page. For http://blog.s9y.org/authors/3-Garvin the next page is thus http://blog.s9y.org/authors/3-Garvin-Hicking/P2.html.
Regards,
Garvin
I don't understand why you say it counts the pages wrong? You get X entries per page with a total of Y entries (thus ceil(Y/X) is Z = amount of pages) all for an author. Usually X is smaller than Y, if you have more than one page.
Which of X, Y or Z is not properly counted for you?
The next page should always lead to an archive page. For http://blog.s9y.org/authors/3-Garvin the next page is thus http://blog.s9y.org/authors/3-Garvin-Hicking/P2.html.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Re: Page Count in Footer
In the standard setup, using the entries.tpl page, each entry is printed with the body. So, if you have a number of entries per page limited to 1, then the Y/X = Y. You end up with the number of pages equal to the number of entries.garvinhicking wrote: I don't understand why you say it counts the pages wrong? You get X entries per page with a total of Y entries (thus ceil(Y/X) is Z = amount of pages) all for an author. Usually X is smaller than Y, if you have more than one page.
Which of X, Y or Z is not properly counted for you?
In my custom info.tpl, which replaces entries.tpl under certain circumstances, the entry body is omitted and a list is generated with a single line per entry. It also ignores the limit for the number of entries per page set up for the entries.tpl. Thus, you can have many entries per page, and yet the footer will think that each entry is a different page because that's what's been set up in Admin for the number of entries per page.
Since I use the custom info.tpl sometimes and entries.tpl at other times, I don't want to change the setting for the number of entries per page (info.tpl doesn't recognize that anyway), rather I want the footer for the info.tpl to calculate the pages differently. I want it to be dependent on the number of lines on the page, instead of the number of entries.
I also don't want the Next Page link to go to an archived entry. Rather, I want it to go to the next page of the list of entries. The same applies to Previous Page.
Right now, it really doesn't make a lot of difference because I only have 7 entries. Someday I hope to have more than enough to fill a single page and would like to have the pagination functionality appropriate to a list, instead of the current pagination methodology, which works well with the default entries.tpl.
Thanks,
Myron
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Page Count in Footer
Hi!
Ah, okay. now I understand. Then simply do not use $footer_info, but use the $footer_* variables I pointed out earlies immediately.
HTH,
Garvin
Ah, okay. now I understand. Then simply do not use $footer_info, but use the $footer_* variables I pointed out earlies immediately.
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
codetwists
- Regular
- Posts: 44
- Joined: Sat Dec 20, 2008 5:46 pm
Re: Page Count in Footer
Thanks, but I don't understand.garvinhicking wrote:use the $footer_* variables I pointed out earlies immediately.
Myron
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Page Count in Footer
Hi!
In your info_authors.tpl (or whatever that was) you could simply remove that {$footer_info} output. If you want to show the number of entries you could use this in your info_authors.tpl file:
You can use PHP modifiers, I believe the PHP "count" array function is enabled also in Smarty security mode. if you get an security error, you can edit your template's config.inc.php and there somewhere on the first lines after <?php add
to disable the security and be able to use any PHP function you like.
Regards,
Garvin
In your info_authors.tpl (or whatever that was) you could simply remove that {$footer_info} output. If you want to show the number of entries you could use this in your info_authors.tpl file:
Code: Select all
There are {$entries|@count} entries.
Code: Select all
$serendipity['smarty']->security = false;
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/