1 jibberjab Aug 18, 2007 00:29
3 jibberjab Aug 19, 2007 21:48
That's a little beyond me... not sure how to begin building that in. I've made a few different attempts at getting the right link to display in the right situation but haven't gotten it running yet...
jj.
4 balupton Aug 19, 2007 22:17
Ok, so somewhere in your skin's _main.php file you will have
if( isset($MainList) ) $MainList->display_if_empty( '' ); // Display message if no post
if( isset($MainList) ) while( $Item = & $MainList->get_item() )
{
just change to
if( isset($MainList) ) $n = sizeof($MainList->postIDarray);
if( isset($MainList) ) $MainList->display_if_empty( '' ); // Display message if no post
if( isset($MainList) ) while( $Item = & $MainList->get_item() )
{
Then with your code
<?php
echo '<dl class="last"><dt>Previous Post:</dt><br /><dd>';
previous_post('%','1'); // link to previous post in single page mode
echo '</dd></dl><dl class="last"><dt>Next Post:</dt><br /><dd>';
next_post('%','1'); // link to next post in single page mode
echo '</dd></dl>';
?>
change to
<?php
$last_Post_ID = $MainList->postIDarray[$n-1];
if ( $Item->ID === $last_Post_ID )
{
echo '<dl class="last"><dt>Previous Post:</dt><br /><dd>';
previous_post('%','1'); // link to previous post in single page mode
echo '</dd></dl><dl class="last"><dt>Next Post:</dt><br /><dd>';
next_post('%','1'); // link to next post in single page mode
echo '</dd></dl>';
}
?>
5 jibberjab Aug 19, 2007 23:16
That's giving me a similar result to some of the other methods I tried... Basically what's happening now is that on the most recent post the "Next Post:" text still appears even though there is no link to go along with it...
What I'm trying to achieve is this:
If the post is the very first post on that blog, I would like to see only:
Next Post:
the title of the next post linked to that post
If the post is the very latest post on that blog, I would like to see only:
Previous Post:
the title of the previous post linked to that post
For every post between the first and latest on that blog, I would like to see both:
Next Post:
the title of the next post linked to that post
Previous Post:
the title of the previous post linked to that post
Getting the link to not appear hasn't been a problem.. I've achieved it several different ways now... The problem is getting the heading of "Previous Post:" or "Next Post:" to also not appear when there's no link for it, but at the same time to make the "Previous Post:" and "Next Post:" titles not be part of the links themselves.
You can see what I mean about how it currently looks here: http://blog.thedarksighed.com/main/2007/08/17/sites_banning_firefox_out_of_spite
That is the most recent post on that blog... The titles/links in question are on the left side of the post.
jj.
6 balupton Aug 19, 2007 23:53
Ok
if( isset($MainList) ) { $last_post_i = sizeof($MainList->postIDarray)-1; $i = -1; $MainList->display_if_empty( '' ); }
if( isset($MainList) ) while( $Item = & $MainList->get_item() )
{
++$i;
// blah blah blah
if ( $i !== 0 ) { // not first post
echo '<dl class="last"><dt>Previous Post:</dt><br /><dd>';
previous_post('%','1'); // link to previous post in single page mode
echo '</dd></dl>';
} if ( $i !== $last_post_i ) { // not last post
echo '<dl class="last"><dt>Next Post:</dt><br /><dd>';
next_post('%','1'); // link to next post in single page mode
echo '</dd></dl>';
}
// blah blah blah
}
You may need to rename $i to something better...
7 balupton Aug 20, 2007 00:08
And what was the point of your hack? in your first post?
8 jibberjab Aug 20, 2007 00:14
I'll give that code a try after I have something to eat.
The point of the hack in the first post... the $previous == '1' part? That was so this particular skin can render in a slightly different way than the other skins on my system...
The default code:
if( $previous == '#' ) $previous = T_('Previous post') . ': ';
places the 'Previous post' text inside the 'a href'. Here I'm trying to separate it from the 'a href' and also to have it only render when applicable...
jj.
9 balupton Aug 20, 2007 00:17
You could cheat if you want to get rid of that a href part by doing
echo '<!-- '; previous_post('%', ' -->'.T_('Previous post') . ': <--'); echo '-->';
So if i'm understanding correctly, this should work...