Page 1 of 1

Looking for a way to hyper link to all blog pages

Posted: Sat Aug 30, 2008 10:28 am
by shovals
In my blog (http://www.fazaza.com) at the bottom of the page I can see only information about how many pages I have. The only navigation option is to go to next/previous page.
I'm looking for a way to navigate directly to each page. Is there a way to solve this issue?

Re: Looking for a way to hyper link to all blog pages

Posted: Sat Aug 30, 2008 1:39 pm
by garvinhicking
Hi!

Yes, this is possible by editing your entries.tpl template file. The variables for the number of pages is there in smarty, as well as the current page. With this information you can build any smarty loop you want.

Some examples are here:

http://board.s9y.org/viewtopic.php?t=17 ... pagination
http://board.s9y.org/viewtopic.php?t=13 ... pagination

HTH,
Garvin

Not exactly what I wanted...

Posted: Mon Sep 01, 2008 3:40 pm
by shovals
One of your links was in German so I used the english one.
I've tried to follow the instructions but it was more of a dialog where I lost track at some point.
However, I've tried to improvise with the information and got page numbers at my blog.
The only problem now is that the numbers are at the bottom of the page and not related to the Next/Prev.

I've added this code at the bottom of the entries.tpl:

<div class="pagelinks">
{eval var=$footer_currentPage-3 assign="paginationStartPage"}
{if $footer_currentPage+3 > $footer_totalPages}
{eval var=$footer_totalPages-6 assign="paginationStartPage"}
{/if}
{if $paginationStartPage <= 0}{assign var="paginationStartPage" value="1"}{/if}

{section name=i start=$paginationStartPage loop=$footer_totalPages+1 max=7}
{if $smarty.section.i.index != $footer_currentPage}
<a href="{$smarty.section.i.index|string_format:$footer_pageLink}">{$smarty.section.i.index}</a>
{else}
{$smarty.section.i.index}
{/if}
{/section}
{if $smarty.section.i.index < $footer_totalPages}
... <a href="{$footer_totalPages|string_format:$footer_pageLink}">{$footer_totalPages}</a>
{/if}
</div>

<!-- ENTRIES END -->

Re: Not exactly what I wanted...

Posted: Mon Sep 01, 2008 5:05 pm
by garvinhicking
Hi!

Hm, that code actually does not look so bad. On which URL can I see the output?

Maybe you can still use the Smarty code of the german entry, that should be usable as well :)

Regards,
Garvin

The URL

Posted: Mon Sep 01, 2008 7:54 pm
by shovals
It's on my blog http://www.fazaza.com (named after my cat, that is quite a funny animal...)
Look at the bottom of the page.
I'll try to practice my german in the meantime. :wink:

Posted: Mon Sep 01, 2008 8:00 pm
by Mangek
I did a bit of browsing on this subject the other day and altered my code to look like this:

Code: Select all

<div class='serendipity_pageFooter' style="text-align: center">
	
    {if $footer_info}
		{if $footer_prev_page}
		<a href="{$footer_prev_page}">« Previous</a>  
		{else}
		<span class="grey">« Previous</span>  
		{/if}
	{else}
	{/if}
	
	{eval var=$footer_currentPage-3 assign="paginationStartPage"}
    {if $footer_currentPage+3 > $footer_totalPages}
        {eval var=$footer_totalPages-6 assign="paginationStartPage"}
    {/if}
    {if $paginationStartPage <= 0}{assign var="paginationStartPage" value="1"}{/if}

    {section name=i start=$paginationStartPage loop=$footer_totalPages+1 max=7}
        {if $smarty.section.i.index != $footer_currentPage}
            <a href="{$smarty.section.i.index|string_format:$footer_pageLink}">{$smarty.section.i.index}</a>
        {else}
            <span id="thispage">{$smarty.section.i.index}</span> 
        {/if}
    {/section}
    {if $smarty.section.i.index < $footer_totalPages}
        ... <a href="{$footer_totalPages|string_format:$footer_pageLink}">{$footer_totalPages}</a>
    {/if}
	
	{if $footer_info}
		{if $footer_next_page}
		  <a href="{$footer_next_page}">Next »</a>
		{else}
		  <span class="grey">Next »</span>
		{/if}
	{else}
	{/if}
	
	</div> 
The result is pretty neat (and like suggested, <span id="thispage">{$smarty.section.i.index}</span> makes the current page marker easy to costumize. :) ). Hope that helps a bit. :)

Re: Not exactly what I wanted...

Posted: Mon Sep 01, 2008 8:03 pm
by yellowled
shovals wrote:The only problem now is that the numbers are at the bottom of the page and not related to the Next/Prev.
So what's the problem with that? As far as I can see, you're using exactly the same code I am using, and it also seems to work fine.

It's just that it's not looking very well, which is probably what you mean by "not related to the Next/Prev", right? So you're going to have to add some CSS to your style.css to make it look the way you want it to look.

The code you got from the other thread only generates the pagination, it does not apply any styling.

YL

CSS code?!

Posted: Thu Sep 04, 2008 10:47 am
by shovals
It's just that it's not looking very well, which is probably what you mean by "not related to the Next/Prev", right?
Yes, you are right.
I'd be happy to make it look better, but i don't even have a clue what CSS is. :oops:
Can you give me some leads on how to write CSS that will help me with the design?

Re: CSS code?!

Posted: Thu Sep 04, 2008 11:46 am
by yellowled
shovals wrote:Can you give me some leads on how to write CSS that will help me with the design?
Well, can you tell me how you want it to look like? :)

YL

Style

Posted: Sun Sep 07, 2008 11:24 am
by shovals
Well, I've been looking in http://www.smashingmagazine.com/2007/11 ... practices/
and the first example of the Simple Enumeration is fine for me.