Recent Topics

1 Jan 07, 2005 00:12    

I've completed my rudimentary "skin".

can be viewed at: http://pct-hike.randsco.com/blogs/pct.php

Two problems remain:

1) If I change the link options to use the extra-path info (for nicer link url's) ... and I click "permalink" on the page, the page is redirected to some other skin/template (?) than the one I've created and looks horrid. (I tried the xtra-path option on my vanilla install and it worked fine) ... any ideas? EDIT: This seems to have 'solved' itself, miraculously. Wish I knew how & why, but am simply satisfied to say that the recommended nice urls work peachy

2) If I click comments - I get the ability to post a comment BUT not to go back to the post. Further, the nav_link() "previous/next" controls disappear?!! The only thing that shows is "archives", which we want to eliminate (but without "archives", there's NO WAY to navigate from blog to blog, once a user has clicked on 'comments'???)

Can one make a "back to blog" option from inside _feedback.php?

Help! Please. :?:

2 Jan 10, 2005 12:19

#2 add this wherever you'd like it on the page :-
<button onclick="history.back()">Go back</button>

?

3 Jan 12, 2005 18:56

Thanks ?????, that idea will work.

4 Jan 12, 2005 19:07

The nav_link function disappearing act when viewing comments remains a problem. I've tried using next_posts_link & previous_post_link instead, but with the same result. I used an unordered list ... which results only in empty "li" bullets. The page source is just blank between the "li" tags.

I've searched high & low on this board for a solution - been unable to find one.

Does anyone have any ideas or other things I can try? Is there some setting that might affect this?

My BO "Settings" are "posts paged"; "posts/days per page = 1" & "archive = post-by-post".

This is the last sticky point on this skin modification.

EDIT - The behavior is such that when you click on "comments", it as if it somehow changes the display mode from "posts paged" to something else (that doesn't display the nav_links). Might this be a bug in "Paris"? (I've gotten a similar response for all skins that don't use pop-up comments - in both installations.) :-/ - grrr

5 Jan 12, 2005 19:43

You do - disp becomes single. I used to have a hack that offered links to the previous and next posts in the category of the currently displayed post, but it's gone now. It was a pretty ugly hack so I guess it's just as well... Anyway I know a bit more about how to do this stuff so I'm working on a hack to give prev and next posts when viewing a single post (like the permalink page) that will allow you to select p/n in all blogs, the current blog, the current cat or the current author. I'll post it in the hacks section when I'm done, but no promises as to when.

One method you might want to do is to hard-code a link back to the page you want people back on. Something like

<?php if( $disp == 'single' ) { ?>
	<p><styrong><a href="blahblahblah.foo/blogs/whatever.bar" title="asdfghjkl">back to the whatever</a></strong></p>
	<?php } ?>

right after the "posts nav link" function in _main.php would put a link where the prev/next goes when you're on a permalink page. I guess you could put your bloglist there then fill in the bits in skins/skinname/_bloglist.php appropriately for how you want it displayed under the single post. Same thing sort of, only different.

hmm...

Try this maybe?

	<?php if( $disp == 'single' ) {
		echo '<a href="';
		blog_list_iteminfo('blogurl', 'raw');
		echo '" title="whatever you want for the title">Displayed Text</a>';
	} ?>


In theory that'll give you a link back to the main page of the blog the person is currently in if they are on a single post page. None of this has been tested by the way - just top of the head stuff.

6 Jan 12, 2005 22:42

Ed, thanks for the reply. Ultimately, what I want to be able to allow visitors is a toggle - (view/add comments)/(hide comments), with both having a previous/next option, allowing visitors to move forward or backwards, with comments or without comments.

In searching for a way to make this happen, I ran across this post: http://forums.b2evolution.net/viewtopic.php?t=2328

The guy who made the original query has a photo site that does what I what I'm looking for (tho fancier than I was shooting for, because he achieves the effect using css rollover images). Nothing was mentioned about display modes in the post.)

His site: www.gousty.com

I can do the "hide comments" using a javascript "back" function (as suggested by another user). The only thing I'd like to do now is retain the next/previous functionality. I look forward to your hack, whenever it arrives!!

In the meantime, I suppose I could hardwire in a next/previous link right into the blog entry itself, top & bottom.

7 Jan 12, 2005 22:56

I hadn't considered the idea of a page with a post without the other permalink page stuff (trackback url, comments and trackbacks and pingbacks, comment form) but I think it's doable.

I remember the thread about gousty's page. That was where I made up a hack that worked, only he ended up getting the original equipment to work. I think what he did was to put the posts_nav_link and associated bits inside the post loop. I think (twice in a row) that in the typical skin it is just outside the post loop, which is why it doesn't work when you uncomment the appropriate other bits.

Right now what I have is a wee bit to add to _main and a function for conf-hacks.php that allows prev/next on single post pages, but my single post pages are always with all the doodads. I have a little buggywuggy that is giving me the current post as previous if the current post is the most recent by blog or cat or author. Not sure why. Duh - if I was sure why it wouldn't be an issue any more!

8 Jan 12, 2005 23:35

Yeah, I ran across that thread: http://forums.b2evolution.net/viewtopic.php?t=2435&highlight=single+mode

ack ... crap ... the kid's crying ... gotta run!

4 hours later ... I also saw this link, regarding the same topic: http://forums.b2evolution.net/viewtopic.php?t=2229&highlight=single+mode

I checked Jimmy's referenced pages & it looks like he never made a hack (because the one he wanted to add it to, still doesn't have one).

I noticed several references to the fact that the nav_link() statements needed to be outside of the 'big blog loop', but (and again, maybe it's because I started with the 'basic' skin) the _main.php I modified had it INSIDE the loop. Just for grins, I put one outside as well and the behavior of the two seemed, to me, to be identical.

I emailed Gousty, on the off-chance that he remembers what he did and if he wouldn't mind sharing with this b2evo neophyte. (If I get a reply, I'll post it. In the meantime, I'll play around with some of the ideas in your original post, Ed, though I'm not much of a hacker ... heck, the only real hacking "talent" I have is generally used up on the front hedges & if you talk to my wife, she'd say that the only real talent I have is spent on making a mess!
:oops:

9 Jan 13, 2005 19:38

Gousty emailed me your 'old' hack, Ed, and I've added it into my _functions_bposts.php file, by adding the following code at the end of the file, but before the last "?>"

/**
 * single_previous_post(-)
 * EdB: this is a hack-function to create links to the previous post
when viewing a single post
 */
function single_previous_post($prev='#', $title='yes', $alt_title='#', $show_full_post='yes', $in_same_cat='no', $excluded_categories='', $format='%', $limitprev=1 )
{
   if( $prev == '#' ) $prev = T_('Previous post');
      
   if( ($prev != '') && ($title == 'yes') ) $prev = $prev.': ';

   global $DB, $tableposts, $postdata;
   global $p, $posts, $s;

   if((!$p) || (!$posts==1)) 
   {
      $current_post_date = $postdata['Date'];
      $current_category = $postdata['Category'];

      $sqlcat = '';
      if ($in_same_cat != 'no') {
         $sqlcat = " AND post_category='$current_category' ";
      }

      $sql_exclude_cats = '';
      if (!empty($excluded_categories)) {
         $blah = explode('and', $excluded_categories);
         foreach($blah as $category) {
            $category = intval($category);
            $sql_exclude_cats .= " AND post_category != $category";
         }
      }

      $limitprev--;
      $sql = "SELECT ID,post_title
                  FROM $tableposts
                  WHERE post_issue_date < '$current_post_date'
                     $sqlcat
                     $sql_exclude_cats
                  ORDER BY post_issue_date DESC
                  LIMIT $limitprev, 1";

      if( $p_info = $DB->get_row( $sql ) ) 
      {
         $p_title = $p_info->post_title;
         $p_id = $p_info->ID;         
         if( $show_full_post == 'yes' ) { // we want more and comments linked
            $string = '<a href="'.url_add_param( get_bloginfo('blogurl'), 'p='.$p_id.'&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1').'"';
            }
         else { // we don't want more and comments linked
            $string = '<a href="'.url_add_param( get_bloginfo('blogurl'), 'p='.$p_id).'"';
            }
         if( $alt_title == '#' ) { // add the alt text
            $alt_title = 'link to previous article';
            }
         $string .= ' title="'.$alt_title.'">'.$prev;
         if ($title=='yes') { // add the post title
            $string .= $p_title;
            }
         $string .= '</a>'; // close the link
         $format = str_replace('%',$string,$format);
         echo $format; // done
      }
   }
}    
         

/**
 * single_next_post(-)
 * EdB: this is a hack-function to create links to the next post when viewing a single post
 */
function single_next_post($next='#', $title='yes', $alt_title='#', $show_full_post='yes', $in_same_cat='no', $excluded_categories='', $format='%', $limitnext=1 )
{
   if( $next == '#' ) $next = T_('Next post');
      
   if( ($next != '') && ($title == 'yes') ) $next = $next.': ';
      

   global $tableposts, $p, $posts, $postdata, $localtimenow, $DB;
   if((!$p) || (!$posts==1)) 
   {
      $current_post_date = $postdata['Date'];
      $current_category = $postdata['Category'];
      $sqlcat = '';
      if ($in_same_cat != 'no') 
      {
         $sqlcat = " AND post_category='$current_category' ";
      }

      $sql_exclude_cats = '';
      if (!empty($excluded_categories)) {
         $blah = explode('and', $excluded_categories);
         foreach($blah as $category) {
            $category = intval($category);
            $sql_exclude_cats .= " AND post_category != $category";
         }
      }

      $now = date('Y-m-d H:i:s', $localtimenow );

      $limitnext--;
      $sql = "SELECT ID, post_title
                  FROM $tableposts
                  WHERE post_issue_date > '$current_post_date'
                     AND post_issue_date < '$now'
                     $sqlcat
                     $sql_exclude_cats
                  ORDER BY post_issue_date ASC
                  LIMIT $limitnext, 1";

      if( $p_info = $DB->get_row( $sql ) ) 
      {
         $p_title = $p_info->post_title;
         $p_id = $p_info->ID;

         if( $show_full_post == 'yes' ) { // we want more and comments linked
            $string = '<a href="'.url_add_param( get_bloginfo('blogurl'), 'p='.$p_id.'&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1').'"';
            }
         else { // we don't want more and comments linked
            $string = '<a href="'.url_add_param( get_bloginfo('blogurl'), 'p='.$p_id).'"';
            }
         if( $alt_title == '#' ) { // add the alt text
            $alt_title = 'link to previous article';
            }
         $string .= ' title="'.$alt_title.'">'.$next;
         if ($title=='yes') { // add the post title
            $string .= $p_title;
            }
         $string .= '</a>'; // close the link
         $format = str_replace('%',$string,$format);
         echo $format; // done
     }
  }  
}

Then, I modified the _main.php to look like (still need to work a bit to get each previous/next to look identical) - if you want you can see it in action at http://pct.randsco.com/blogs/pct.php

<?php if( $disp == 'single')
{  
single_previous_post(); 
}   
else
{  
previous_posts_link(); 
}
?>

<?php echo T_(' | ') ?>
<a href="<?php $Blog->disp( 'arcdirurl', 'raw' ) ?>"><?php echo T_('Archives') ?></a>
<?php echo T_(' | ') ?>

<?php if( $disp == 'single')
{  
single_next_post(); 
}
else
{  
next_posts_link();  
}
?>

This works! but with a HUGE, deal-breaking problem.

IN single display mode, other blog titles (from the blog on the main domain - called from a seperate install of b2evo, but sharing the same mySQL db) are included - and lead nowhere, because that blog is accessed from that other install ---- whoa. Can't have that!

Any ideas what I can change to limit this hack to include only the selected blog? (Maybe limit these new function definitions with SQL statement in the _functions_bposts.php file --- a hokey example, but maybe you get the idea ---)

$sql = "SELECT ID, post_title
                  FROM $tableposts
                  WHERE post_issue_date > '$current_post_date'
                     AND post_issue_date < '$now' 

 chgd->          AND blog_name = '$current_blog'

                     $sqlcat
                     $sql_exclude_cats
                  ORDER BY post_issue_date ASC
                  LIMIT $limitnext, 1";

I don't know if "blog_name" or "$currentl_blog" are the correct names, but (I hope) you get the idea. ;)

10 Jan 13, 2005 20:01

You might consider http://wonderwinds.com/hackblog.php/2005/01/12/sniggling_the_cruftulator instead. It doesn't modify core files and can be told to do prev/next in 'thisblog' instead of 'allblogs', which is I think what you need.

EDIT: what you have above won't work. They aren't real names of fields in the table. I'll try to figure out how to make it be blog-specific for you, since you've got it close to what you want.

12 Jan 13, 2005 22:17

Maybe this'll do for the old hack?

$sql = "SELECT ID, post_title 
FROM $tableposts JOIN $tablecategories ON ( post_category = cat_ID) 
WHERE post_issue_date > '$current_post_date'
AND post_issue_date < '$now' 
AND cat_blog_ID = $blog 
ORDER BY post_issue_date ASC
LIMIT $limitnext, 1";

Untested, but joining $tableposts and $tablecategories is (AFAIK) the only way to get the blog number associated with a post. First you get them to talk to each other about the post_category and the cat_ID, then you can ask them to hook up the cat_blog_ID with $blog (which happens to be the blog number of the blog you're in at any given time).

13 Jan 14, 2005 01:02

Hmmm. Tested, but bombed due to a MySQL error:

MySQL error!

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON (post_category = cat_ID) WHERE post_issue_(Errno=1064)

Here's what I'm using:

      $sql = "SELECT ID,post_title
                  FROM $tableposts JOIN $tablecategories ON (post_category = cat_ID)
                  WHERE post_issue_date > '$current_post_date'
                  AND post_issue_date < '$now'
                  AND cat_blog_ID = '$blog'
                     $sqlcat
                     $sql_exclude_cats
                  ORDER BY post_issue_date ASC
                  LIMIT $limitnext, 1";

I tried some sytaximological changes (no parens, single quoted the JOIN ON variables, etc. ... all to no avail. Any ideas?

Edit: Maybe it's not picking up the second table - evo_categories? The "Your Query" part, below the error! says:

Your query:
SELECT ID,post_title FROM evo_posts JOIN ON (post_category = cat_ID) WHERE post_issue_date < '2004-11-30 23:05:49' AND post_issue_date < '' AND cat_blog_ID = '' ORDER BY post_issue_date DESC LIMIT 0, 1

(nothing between the JOIN and ON) ??

14 Jan 14, 2005 01:34

add $tablecategories to the global list at the top of the function

15 Jan 14, 2005 03:49

Ah, that fixes the sql error! Thx.

Drat ... the next/previous are disappearing again on the comments page (single display mode). :'(

16 Jan 14, 2005 18:03

Any ideas what might be causing the re-disappearance of the next/prev guys?

Should I give up this line, mow down some code & impliment the next/prev single display mode solution you mentioned on your site?

Will it support rollover images in place of text?

17 Feb 04, 2005 17:35

I finally got this hack work with a single blog, by monkeying with the SQL query, but when specifying "$posts=1" in the stub file (must do that, because we have two blogs and want them to have different display options), the nav links show up in the comments, but then disappear when clicked. Funny, but it works fine when specifying "posts/days per page = 1" in the Back Office.

(Takes you to the next/previous post, with comments displayd, but then the nav links are gone & you're left, once again, with only "archives" as a navigational option)

:'(

Any idea what might be causing the problem?

Here's the final version of the hack & how it's called:

<?php if($disp == 'single') {
      single_previous_post('Prev Entry','no');
   } else {
      previous_posts_link('Prev Entry');
   } ?>

<?php echo T_(' | ') ?>
<a href="<?php $Blog->disp( 'arcdirurl', 'raw' ) ?>"><?php echo T_('Archives') ?></a>
<?php echo T_(' | ') ?>

<?php if($disp == 'single') {
      single_next_post('Next Entry','no');
   } else {
      next_posts_link('Next Entry');
   } ?>

//---------------------begin next/prev single pane mode hack stk 01-2005
/**
 * single_previous_post(-)
 * EdB: this is a hack-function to create links to the previous post when viewing a single post
 */
function single_previous_post($prev='#', $title='yes', $alt_title='#', $show_full_post='yes', $in_same_cat='no', $excluded_categories='', $format='%', $limitprev=1 )
{
   if( $prev == '#' ) $prev = T_('Previous post');
      
   if( ($prev != '') && ($title == 'yes') ) $prev = $prev.': ';

   global $tableposts, $tablecategories, $p, $posts, $postdata, $localtimenow, $DB, $blog, $tablepostcats, $now;

   if((!$p) || (!$posts==1)) 
   {
      $current_post_date = $postdata['Date'];
      $current_category = $postdata['Category'];
      $sqlcat = '';
      if ($in_same_cat != 'no') 
      {
         $sqlcat = " AND post_category='$current_category' ";
      }

      $sql_exclude_cats = '';
      if (!empty($excluded_categories)) {
         $blah = explode('and', $excluded_categories);
         foreach($blah as $category) {
            $category = intval($category);
            $sql_exclude_cats .= " AND post_category != $category";
         }
      }

      $limitprev--;
            $sql = "SELECT ID, post_title
                       FROM $tableposts JOIN $tablecategories ON ( post_category = cat_ID)
                       WHERE post_issue_date < '$current_post_date'
                       AND cat_blog_ID = '$blog'
                       ORDER BY post_issue_date DESC
                       LIMIT $limitprev, 1";
     
      if( $p_info = $DB->get_row( $sql ) ) 
      {
         $p_title = $p_info->post_title;
         $p_id = $p_info->ID;         
         if( $show_full_post == 'yes' ) { // we want more and comments linked
            $string = '<a href="'.url_add_param( get_bloginfo('blogurl'), 'p='.$p_id.'&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1').'"';
            }
         else { // we don't want more and comments linked
            $string = '<a href="'.url_add_param( get_bloginfo('blogurl'), 'p='.$p_id).'"';
            }
         if( $alt_title == '#' ) { // add the alt text
            $alt_title = 'link to previous article';
            }
         $string .= ' title="'.$alt_title.'">'.$prev;
         if ($title=='yes') { // add the post title
            $string .= $p_title;
            }
         $string .= '</a>'; // close the link
         $format = str_replace('%',$string,$format);
         echo $format; // done
      }
   }
}    


Form is loading...