Looking for a way to hyper link to all blog pages

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
shovals
Regular
Posts: 26
Joined: Sun Jul 20, 2008 10:54 am
Contact:

Looking for a way to hyper link to all blog pages

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

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

Post 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
# 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/
shovals
Regular
Posts: 26
Joined: Sun Jul 20, 2008 10:54 am
Contact:

Not exactly what I wanted...

Post 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 -->
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Not exactly what I wanted...

Post 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
# 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/
shovals
Regular
Posts: 26
Joined: Sun Jul 20, 2008 10:54 am
Contact:

The URL

Post 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:
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Post 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. :)
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Not exactly what I wanted...

Post 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
shovals
Regular
Posts: 26
Joined: Sun Jul 20, 2008 10:54 am
Contact:

CSS code?!

Post 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?
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: CSS code?!

Post 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
shovals
Regular
Posts: 26
Joined: Sun Jul 20, 2008 10:54 am
Contact:

Style

Post 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.
Post Reply