Recent Topics

1 Aug 10, 2007 19:51    

My b2evolution Version: 1.10.x

I'm working on a skin design in which the comments are in an entirely separate DIV structure than the post itself... basically, they're outside of the post loop. The comments DIV is completely hidden when the blog is displaying multiple posts.

I've included the entire section of code that houses the post loop DIV, and the comments DIV which is entirely separate, that sits beneath it.

I guess what I'm trying to figure out is a way to re-initialize the post loop (?) once it has been left, or to set up some kind of disp != single configuration which does not break the DIV structure when the blog is in single-post mode...

	<div id="primary" class="single-post">

	<div class="datetime">DATE/TIME JAVASCRIPT SITS HERE</div><!-- end datetime -->
	<?php
		// ------------------------- MESSAGES GENERATED FROM ACTIONS -------------------------
		// if( empty( $preview ) ) $Messages->disp( );
		// --------------------------------- END OF MESSAGES ---------------------------------
	?>
	<?php
		// ------------------------------------ START OF POSTS ----------------------------------------
		if( isset($MainList) ) $MainList->display_if_empty(); // Display message if no post

		if( isset($MainList) ) while( $Item = & $MainList->get_item() )
		{
	?>

		<div class="inside">
			<div class="primary">

<div class="text">
	<?php
		//previous_post();	// link to previous post in single page mode
		//next_post(); 			// link to next post in single page mode
	?>
	<?php 
		//echo T_('<h1>');
		//$MainList->date_if_changed( '' , '' , 'd F Y' );
		//echo T_('</h1>');
	?>
	<h2><a href="<?php $Item->permanent_url() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php $Item->title( '', '', false ); ?></a></h2>
	<?php
		locale_temp_switch( $Item->locale ); // Temporarily switch to post locale
		$Item->anchor(); // Anchor for permalinks to refer to
	?>
	<?php $Item->content(); ?>
	<?php link_pages() ?>
	
		<div class="bSmallPrint">PHP CODE FOR / permanent_link / feedback_link / edit_link / trackback_rdf / GOES HERE</div> <!-- END bSmallPrint DIV -->

	<?php
		// ------------- START OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. -------------
		$disp_comments = 1;					// Display the comments if requested
		$disp_comment_form = 1;			// Display the comments form if comments requested
		$disp_trackbacks = 1;				// Display the trackbacks if requested

		$disp_trackback_url = 1;		// Display the trackbal URL if trackbacks requested
		$disp_pingbacks = 1;				// Display the pingbacks if requested
		require( dirname(__FILE__).'/_feedback.php' );
		// -------------- END OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. --------------

		locale_restore_previous();	// Restore previous locale (Blog locale)
	?>

</div><!-- end TEXT div -->

			</div><!-- end class=primary -->

			<hr class="hide" />







			<div class="secondary">

				<h2>About this entry</h2>
				<div class="featured">THIS IS WHERE THE POST AUTHOR / DATE / CATEGORIES / VIEWS / GO</div><!-- end featured -->

			<div class="calendar"></div>
			</div><!-- end class=secondary -->
			<div class="clear"></div>
		</div><!-- end inside -->

<?php } ?>

	<div class="navlink"></div>

	</div><!-- end #primary -->

	<hr class="hide" />

		<div id="secondary">
		<div class="inside">


****************************************************************************
******** THIS IS WHERE I WANT THE COMMENTS AND FEEDBACK FORM TO SIT ********
******** BUT IT'S OUTSIDE OF THE POST LOOP *********************************
****************************************************************************


			<?php
				// -------------- START OF INCLUDES FOR LAST COMMENTS, MY PROFILE, ETC. --------------
				$current_skin_includes_path = dirname(__FILE__).'/';
				// Call the dispatcher:
				require $skins_path.'_dispatch.inc.php';
			?>

		</div><!-- end inside -->
		</div><!-- end id=secondary -->

I've annotated the code above to show, inside the *******'s, where I would like the comments and comment form to actually display. As you can see it's outside of the post loop and in a completely separate DIV structure... If I move the actual feedback PHP (the part that begins with: // ------------- START OF INCLUDE FOR COMMENTS, TRACKBACK, PINGBACK, ETC. ------------- ) down to where I want the comments to actually appear, I get the following error:

Fatal error: Call to a member function on a non-object in /path/to/the/skins/skinfolder/_feedback.php on line 52

Line #52 in _feedback.php is:

	if( $Item->can_see_comments() )

So I'm wondering if there is a way to get around that error on line 52, or if there is a way to "step out of" the post loop above and render the comments in an entirely separate DIV structure... Anyone have an idea?

I realize the code chunk I pasted above is pretty lengthy, but I wanted the entire relevant code to be available...

jj.

2 Aug 13, 2007 02:28

I've updated the code to the point where I have it now... I'm still having trouble finding a way to render the comments and comment form outside of the post loop...

jj.

3 Aug 13, 2007 18:09

how about :

<?php
$last_post = $Item;
 } ?>

    <div class="navlink"></div>

    </div><!-- end #primary -->

    <hr class="hide" />

        <div id="secondary">
        <div class="inside">

<?php
$Item = $last_post;
       require( dirname(__FILE__).'/_feedback.php' );
?>****************************************************************************
******** THIS IS WHERE I WANT THE COMMENTS AND FEEDBACK FORM TO SIT ********
******** BUT IT'S OUTSIDE OF THE POST LOOP *********************************
****************************************************************************

¥

4 Aug 14, 2007 03:13

Thanks. With a little bit of modification that worked.

jj.

5 Aug 14, 2007 03:50

Oops, spoke too soon.... when I hit the links for:

User Profile
Archives More
Most Recent Comments

I get the following:

Notice: Undefined variable: last_post in /path/to/the/skin/_main.php on line 372

That's referring to the

<?php
$Item = $last_post;
       require( dirname(__FILE__).'/_feedback.php' );
?>

Those pages still render their contents properly, but that error is sitting at the top of each of those pages.

jj.

6 Aug 14, 2007 08:15

<?php
if( !empty( $last_post ) )
{
  $Item = $last_post;
  require( dirname(__FILE__).'/_feedback.php' );
}
?>

;)

¥

7 Aug 14, 2007 17:15

I had gotten it to work by doing this:


<?php if ($disp == 'single') { echo ?>

<?php
$Item = $last_post;
       require( dirname(__FILE__).'/_feedback.php' );
?>

<?php } ?>

but I'll go with your method... ;)

jj.


Form is loading...