Recent Topics

1 Sep 24, 2004 17:36    

i remember reading that posts_nav_link doesn't work in single page more. i've tried using some of the obsolete functions to overcome that, but the ones i've tried just keep linking to the very first post ever.

i'm probably at the level of a script kiddie when it comes to php, so it would take me a year to do this my self. i've tired.

navigation in single page mode would be useful

anyone?

--------edit---

yeah "previous_post( '<p class="center">%</p>' ); next_post( '<p class="center">%</p>' );" is the one i tried to use, but it just links to the very first post ever

2 Sep 24, 2004 23:57

This is what I use:


<?php if( $disp == 'single')
{
   previous_post( '%' );
   echo " | ";
   next_post( '%' );
}
?>

3 Sep 25, 2004 04:00

i guess this post should be moved to bugs or how to?

cause next_post only links to my very first post no matter where i am, and previous_post doesn't return anything anywhere...

4 Sep 25, 2004 08:39

How deep are you willing to hack? It can be done but you need to modify b2evocore/_functions_bposts.php to get it working. Step one is in _main.php

<?php if( $disp == 'single' ) {
previous_post_HACK();
echo ' XXX ';
next_post_HACK();
echo '<hr>';
} ?>

XXX is my separator. It looks like crap but it works for testing.

Note that if you have "1 day" or "1 post" set up in your back office then you probably need to remove the "if disp is single" condition, but I didn't test that detail. The post_nav_links function (or whatever it's called) works with more than one day or more than one post or any number of posts-paged selected. Therefore the "disp is single" is used to hide these functions from those configurations. Actually you can do away with it under any configureation if you want lots of navigation links. Whatever you like as long as you don't like anchovies.

Now in b2evocore/_functions_bposts copy the "previous_post" and "next_post" functions and paste them at the end of the file. This might not be an actual requirement but if you don't change an existing function you won't accidentally alter something else that was not part of your scope. Rename these as "previous_post_HACK" and "next_post_HACK". (Groovy name eh?) Now the mod is amazingly easy. Find this bit at the very beginning of each function

global $tableposts, $p, $posts, $postdata, $localtimenow, $DB;
if(($p) || ($posts==1))
{

and change it to this

global $tableposts, $p, $posts, $postdata, $localtimenow, $DB;
if((!$p) || (!$posts==1)) // this line was changed
{


Note that the list of globals changes for each function, but you are not modifying that so it doesn't matter. Just change it from "if true or true" to "if not true or not true" and the functions will work as one would hope. Again, in my testing it only worked when I was on a permalink page. When I selected 1 day or 1 post I had no prev/next options on the screen and that seemed silly. I had to go to the permalink to get a prev/next option. Also you can dial in the look by following the parameter string, but if you're willing to hack the core then that should be a non-event for you.

The only other task, and this one is optional but recommended, is to build a totally cool skin that happens to be xhtml and css valid and works in multiple browsers at 800 by 600 resolution and upload the zip to the skins pile.

5 Sep 26, 2004 01:08

that worked and thankyou for the effort, except the previous_post_HACK(); and all the other single page navigation functions only link to the very first post in my blog... anyone else ever come across this?

http://gousty.com/index.php?skin=exp3 <-my hacked invalid test skin to show off the problem i just installed 9.0.11 hoping it would fix

http://gousty.com/index.php?skin=exp <- normal

6 Sep 26, 2004 02:16

Let me see if I understand. Your back office setup is 1 post, or is it 1 day? I didn't check date stamps on the posts, but for sure it's set up to show only one item. The prev/next is working, so maybe that means you have 1 posts-paged selected?

The problem is that when you go to the permalink page for any given single item you only get to go prev to the beginning.

Did you put the suggested hack in a "if disp==single" condition?

7 Sep 26, 2004 08:23

The problem is that when you go to the permalink page for any given single item you only get to go prev to the beginning.

yeah, i think u got it now.

yeah the *HACK stuf is inside if single:


if single previous_post_HACK  <?php if( $disp == 'single' ) 
{
previous_post_HACK();
} 
?>

if single next_post_HACK  <?php if( $disp == 'single' ) 
{
next_post_HACK();
} 
?>


backoffice: yes, set to posts page
index.php stub has the "$posts = '1';" in it

any ideas?


Form is loading...