Recent Topics

1 Nov 21, 2007 16:23    

I searched for this but couldn't find it. Could someone let me know how to include the last 6 comments?

I tried calling _lastcomments.php from my custom.php page but it is not working. I used to be able to create a custom _Comments.php and then include that in my skin.

My old Way

			<h3>Recent Comments</h3>	
	<? include("_lastcomments.php") ?>
	</div>

2 Nov 22, 2007 17:33

Here's what I use in the menus for my blog ( /skins/ < skin > /_body_footer.inc.php ) :

<?php
function showComments( $whichBlog, $numComments = 5, $showExcerpts = false )
{
	//return;
	global $blog, $Blog, $BlogCache;
	$tempblog = $blog;
	$tempBlog = $Blog;
	$blog = $whichBlog;
	$Blog = $BlogCache->get_by_ID( $blog );

	$CommentList = & new CommentList( $Blog, "'comment','trackback','pingback'", array('published'), '',	'',	'DESC',	'',	$numComments );

	echo '<li class="mComments"><span class="title">Comments</span><ul>
	<li><span class="title">Comments</span></li>';

	while( $Comment = & $CommentList->get_next() )
	{ // Loop through comments:
		// Load comment's Item object:
		$Comment->get_Item();
		?>
		<!-- ========== START of a COMMENT ========== -->
		<li>
<?php
	$Comment->author( '', '', '', '', 'htmlbody', true );
	echo ' on ';
	$Comment->permanent_link( $Comment->Item->title, 'Read the full comment', '' );
	if( $showExcerpts )
	{
		echo '			<div class="bCommentText">';
		$Comment->content = preg_replace( '#^(\b[^\b]+?\b){0, '.$showExcerpts.'}(.*?)$#', '$1', $Comment->content );
		$Comment->content();
		echo '			</div>';
		echo '	<div class="bCommentSmallPrint">';
		$Comment->permanent_link( 'continued', '#', 'permalink_right' );
		echo '	</div>';
	}
	?>
		</li>
		<!-- ========== END of a COMMENT ========== -->
		<?php
	}	// End of comment loop.}
	echo '</ul></li>';
	$blog = $tempblog;
	$Blog = $tempBlog;
}
?>

Then where I want the comments to appear I just use :

<li class="menubimble"><a href="<?php echo $iv_domain; ?>/bimble/" title="Put on your shorts and join me in the field" class="mainbutton"><span>Bimble</span></a>
	<ul class="foldout">
	<?php
		showComments( 149 );
		showCategories( 149 );
		showArchives( 149 ); // in the field
		showFeeds( 149 );
	?>
	</ul>
</li>

¥

3 Nov 22, 2007 17:40

Do you have this 149 (blog number?) hard coded, or can you do:

$Item->get_blog_ID;


or something similar OO.

Just a thought.

4 Nov 22, 2007 17:42

I have it hard coded because my menus contain drop downs for each blog showing it's comments/cats/archives/feeds but you could easily just change it to $Blog->ID for the current blog

¥

5 Nov 23, 2007 17:15

Afwas,

Great job with this code. I'm using it and it works great. Thanks.

6 Nov 23, 2007 17:28

quick comment:

$CommentList = & new CommentList( $Blog, "'comment','trackback','pingback'", array('published'), '',    '',    'DESC',    '',    $numComments );

   [b] echo '<li class="mComments">[/b]<span class="title">Comments</span><ul>
    <li><span class="title">Comments</span></li>'; 

before these first lines of code, there seems to be a <ul> tag but I can't find it.

Do you know which file we're getting this from? I'd like to add a class to it. It's throwing my skin a bit off.

Thanks.

7 Nov 23, 2007 17:47

Add a class to the <ul> in the very code that you posted above, then look at the sourcecode it generates. As far as I can see there is no <ul> before the first <li>, but if you marked all the <ul> generated by this code, you will be sure about that (if an <ul> appears, it's from somewhere else ;) )

8 Nov 23, 2007 17:59

¥åßßå wrote:

<li class="menubimble"><a href="<?php echo $iv_domain; ?>/bimble/" title="Put on your shorts and join me in the field" class="mainbutton"><span>Bimble</span></a>
	<ul class="foldout">
	<?php
		showComments( 149 );
		showCategories( 149 );
		showArchives( 149 ); // in the field
		showFeeds( 149 );
	?>
	</ul>
</li>

The <ul> come from this bit ;)

¥

9 Nov 23, 2007 18:04

Where is the <ul> before <li class="menubimble">?

10 Nov 23, 2007 18:09

Thanks. I forgot about that <UL> inside my custom php file.

11 Nov 23, 2007 18:12

Sorry, that's was just a snippet out of my full menu. The full one goes a smidge like this :

<div id="header">
<ul class="menu">
<li class="menubimble"><a href="<?php echo $iv_domain; ?>/bimble/" title="Put on your shorts and join me in the field" class="mainbutton"><span>Bimble</span></a>
	<ul class="foldout">
		<?php
		showComments( 149 );
		showCategories( 149 );
		showArchives( 149 ); // in the field
		showFeeds( 149 );
	?>
	</ul>
</li>
<li class="menubabble"><a href="<?php echo $iv_domain; ?>/babbles/" title="It's just pure babble" class="mainbutton"><span>Babble</span></a>
	<ul class="foldout">
		<?php
		showComments( 31 );
		showCategories( 31 );
		showArchives( 31 ); // babble
		showFeeds( 31 );
	?>
	</ul>
</li>
<li class="menuart"><a href="<?php echo $iv_domain; ?>/gallery/" title="Take a wander round inside my mind"
class="mainbutton"><span>Art gallery</span></a>
	<ul class="foldout">
		<?php
		showComments( 148 );
		showCategories( 148 );
		showArchives( 148 ); // gallery
		showFeeds( 148 );
	?>
	</ul>
</li>
	<li class="menucode"><a href="<?php echo $wo_domain; ?>/" title="All sorts of geeky shit" class="mainbutton"><span>Code</span></a>
	<ul class="foldout">
		<?php
		showComments( 8 );
		showCategories( 8 );
		showArchives( 8 ); // dev blog
		showFeeds( 8 );
	?>
	</ul>
</li>
<li class="menuhome"><a href="<?php echo $iv_domain; ?>/" title="Home is where the heart is ....... must hurt when you go out" class="mainbutton"><span>Home</span></a>
	<ul class="foldout">
		<?php
		showComments( 1 );
		showArchives( 1 );
		showFeeds( 1 );
	?>
	</ul>
</li>
<li class="menuinfo"><a href="<?php echo $baseurl; ?>#" class="mainbutton"><span>Info</span></a>
	<ul class="foldout">
		<li class="title"><?php $Blog->disp( 'name' ); ?></li>
		<li style="padding:0 1em;"><?php $Blog->disp( 'longdesc' ); ?></li>
		<li class="title">Actions</li>
<?php
user_register_link( '<li>', '</li>', 'Sucumb' );
user_login_link( '<li>', '</li>', 'Enter' );
user_logout_link( '<li>', '</li>', 'Run away' );
user_admin_link( '<li>', '</li>', 'Nerve centre');
?>
<li class="title">Online</li>
<?php
$plugins_path = dirname(__FILE__).'/../../plugins/';
require_once $plugins_path.'_whosonline.plugin.php';
$fred = & new OnlineSessions();
$fred->display_onliners( array( 'list_start' => '', 'list_end' => '', 'item_start' => '<li style="padding:0 1em;">', 'item_end' => '</li>', 'contacticons' => '' ) );
?>
		<li class="title">Powered by</li>
		<li><a href="http://b2evolution.net/" title=" Powered by B2Evolution ">b<sub>2</sub>evolution</a></li>
		<li class="title">Miscellaneous</li>
		<li><a href="http://www.waffleson.co.uk/2007/10/credits" title=" what runs InnerVisions ? ">Credits</a></li>
		<li><a href="http://validator.w3.org/check/referer" title=" Valid XHTML 1.0 Strict ">XHTML</a></li>
		<li><a href="http://jigsaw.w3.org/css-validator/" title=" Valid Cascading Style Sheets ">CSS</a></li>
		<li><a href="<?php echo $iv_domain; ?>/babbles/spam-trap/" title=" Fight spam ">Spam Trap</a></li>
	</ul>
</li>

<li class="menuweb"><a href="#" class="mainbutton"><span>my links</span></a>
	<ul class="foldout">
		<li class="title">My Links</li>
		<li><a href="http://astonishme.co.uk/" title="are you ready to be astonished?" class="ext">Astonish Me</a></li>
		<li><a href="http://forums.b2evolution.net/" title="get all the help you need for your blog" class="ext">b<sub>2</sub>evolution forums</a></li>
		<li><a href="http://garysblog.co.uk/" title=" life in a fish bowl " class="ext">Goldfish</a></li>
		<li><a href="http://wonderwinds.com/" title=" lemmings really do exist " class="ext">Lemming</a></li>
		<li><a href="http://www.brendoman.com/dbc" title=" he puts the 'D' into dbc " class="ext">PersonPerson</a></li>
		<li><a href="http://www.randsco.com/" title=" can you help a displaced yank? " class="ext">Randsco</a></li>
		<li><a href="http://www.village-idiot.org/" title=" find out who Whoo is " class="ext">Village Idiot</a></li>
		<li class="title">Head starts</li>
		<li><a href="http://cga.com/" title=" everything CGA " class="ext">CGA</a></li>
	</ul>
</li>
<li class="menucontact"><a href="<?php echo $iv_domain; ?>/contact/" title="contact me" class="mainbutton"><span>Contact me</span></a></li>

<li class="menusearch">
<?php form_formstart( $Blog->dget( 'blogurl', 'raw' ), 'search', 'SearchForm' ); ?>
<div><input type="text" size="20" name="s" class="search_input" value="<?php global $s; echo htmlentities( $s, ENT_QUOTES ); ?>" /><input type="submit" value="Go" /></div>
</form>
</li>
</ul>
</div>

¥

12 Jan 05, 2008 07:50

Hey,

I updated to 2.3.0 and now the comment thingie is not working too well.

The comment author is OK...it is just the link to the comment that doesn't link properly. I tried coding around it but I don't know the b2evo object too well.

I can't remove the permalink icon and the link to the author's comment is not quite right.
I've been playing with this line:
$Comment->permanent_link( $Comment->Item->title, 'Read the full comment', '' );

and changed it to this:
$Comment->permanent_link( $Comment->Item->title())

Could you help out? Check this page for example to see the side bar comments.

http://www.thechristianalert.org/index.php/2005/05/07/about_the_christian_alert?blog=5

13 Jan 05, 2008 08:25

Update:

I found the line that fixed my problem.

$Comment->permanent_link(array('text' => T_($Comment->Item->title)) );

I guess those parenthesis after the title () were messing me up. Took me a while but I found it.


Form is loading...