Recent Topics

1 Jul 04, 2010 01:55    

My b2evolution Version:

I have been attempting to get comments to work in a lightbox pop-up. I've got everything working, including getting the comments to appear in a lightbox on the posts.main page. However, if you click the link to the comments, the popup shows comments from one specific post; click a link to comments on a different post, it shows the same comments.

It's kind of easier to explain if you head here:
http://www.schoolofpuppetry.com.au/books.php
Click on the '6 comments' link for the first post. It will show the list of comments in a lightbox (it may not appear correctly in all browsers yet, I've mainly been doing hacks and testing so far).
Close the lightbox, then click on the 'leave a comment' link on the next post down; notice that the comments shown are from the first post.

I'm not quite sure why exactly it's only showing the comments from the first post, I'm assuming something is wrong with the way the feedback is being called...

(I used the comments hack from here:
http://forums.b2evolution.net/viewtopic.php?t=16517&postdays=0&postorder=asc&highlight=canseecomments&&start=0 )

Thanks!

2 Jul 04, 2010 05:06

How does the script find a tag with comments to show/hide? If you select by class then it will always show/hide the first tag.
Either add numbers in selector class (e.g. post ID) or use "siblings" in selector.

3 Jul 04, 2010 05:38

sam2kb wrote:

How does the script find a tag with comments to show/hide? If you select by class then it will always show/hide the first tag.
Either add numbers in selector class (e.g. post ID) or use "siblings" in selector.

Aah, now that you've said that it seems so damn obvious. Yes, it does show it by using a class.

The problem now is that in order to get the popup to work, I had to add rel="lightbox" to the code that creates the link to the comments in /inc/items/model/_item.class.php. So how do I go about having two different links? Is it possible to add the rel to the feedback_link array in posts.main? (I've tried removing the rel from item.class, but it kills the lightbox)

4 Jul 04, 2010 11:20

do not hack the core.. hack the skin files if you have to.. so that you will not have problems after an upgrade..

there must be numerous ways, guesses are; calling the feedback link twice in skin file and playing with parameters of $feedback_link... or creating a new var $feedback_link_lbox... or again, calling it twice and manipulating the links rel attribute via jquery

5 Jul 05, 2010 10:23

Ok, I tried manually creating a link in the skin file to the comments popup using a different rel. However, this doesn't solve the issue, since there is a comments popup for every post on the main page (eg. four popup links for four posts on one blog page), which means I'd need to create some way of making a new rel for each different popup...

This is above my head, I don't know anything about jquery, and evidently hacking the core is not a good idea.

... Perhaps I need to rethink how I show the link to the comments on the main page in its entirety.

6 Jul 05, 2010 13:33

1.uniquify the feedback link

				<?php
					// Link to comments, trackbacks, etc.:
					$Item->feedback_link( array(
							'type' => 'feedbacks',
							'link_before' => ' | ',
							'link_after' => '',
							'link_text_zero' => '#',
							'link_text_one' => '#',
							'link_text_more' => '#',
							'link_title' => 'Comments_Lightbox', //this is what makes our alternate feedback link unique
						) );
				?>

2.Load Jquery, -manual or require_js-
3.Load jquery_lightbox (or fancybox whatever..)

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script><!-- load jquery manually -->

<!-- Or you can use <?php require_js('#jquery#'); ?> in head -->


	<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.1.js"></script>
	<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.1.css" media="screen" />

	<script type="text/javascript">
		jQuery(document).ready(function() {

		jQuery("a[title=Comments_Lightbox]").fancybox({
				'titleShow'		: false
			});
		});
	</script>

[URL=http://img685.imageshack.us/i/4433j.jpg/]http://img685.imageshack.us/img685/7761/4433j.th.jpg[/URL]

7 Jul 05, 2010 15:22

Just add the item id to your rel && hook id

¥

8 Jul 05, 2010 15:35

¥åßßå wrote:

Just add the item id to your rel && hook id

¥

yup, i missed that part.. after re-reading the most recent post,noticed that his main problem seems to be having lightbox comments per post basis rather than having a lightbox comments (:

and yes id will do, but he will have to type in id for each post he wants like ...item#27").lightbox, ...item#29").lightbox and so on.. isnt it ?

9 Jul 06, 2010 06:06

I haven't tried the above hack yet, but will attempt it in the coming days.

Anyway, just wanted to reply to the last post from tilqicom:

tilqicom wrote:

yup, i missed that part.. after re-reading the most recent post,noticed that his main problem seems to be having lightbox comments per post basis rather than having a lightbox comments (:

and yes id will do, but he will have to type in id for each post he wants like ...item#27").lightbox, ...item#29").lightbox and so on.. isnt it ?

The issue is that the only way to get the comments to show up on the main page was to include it in the posts loop. (As I mentioned above, I used the linked hack) Because of this, there is a lightbox per post. (It may help to know that I've gotten lightbox comments working fine on the single post page)

So yes, it seems that an id for each post looks like the only option.

PS. Feel free to change 'he' to 'she' ;)

10 Jul 06, 2010 09:19

na3 wrote:

PS. Feel free to change 'he' to 'she' ;)

Sorry about that.. i dont like using he/she phrase, and if we are to assume one of them, he is more likely most of the time..

Anyways, i didnt get what you wanted at the first time, and i doubt i do yet.

I thought you wanted an extra feedback link so that the visitors would be able to view comments either regular way or in a lightbox..But i guess you already managed to get the comments to show in a lightbox, but you just dont want them all to be in lightbox..so using post id's seems to be the best option for now

11 Jul 06, 2010 12:32

tilqicom wrote:

na3 wrote:

PS. Feel free to change 'he' to 'she' ;)

Sorry about that.. i dont like using he/she phrase, and if we are to assume one of them, he is more likely most of the time..

:) That's ok.

tilqicom wrote:

I thought you wanted an extra feedback link so that the visitors would be able to view comments either regular way or in a lightbox..But i guess you already managed to get the comments to show in a lightbox, but you just dont want them all to be in lightbox..so using post id's seems to be the best option for now

Er, no, not quite. I want all comments to appear in a lightbox; no 'regular' way. I edited the single post page so that the comments appear in the lightbox using javascript, some css, and by moving the feedback loop to the bottom of the page. The comments/comment form appear in a lightbox when you click the feedback link at the top of the page. (See http://www.schoolofpuppetry.com.au/books.php/book-review-the-foam-book and click the '6 comments' link for an example) No problems there.

The issue is when I get to the main page. The main page archives 4 posts per page. There is a feedback link for each of the 4 posts. The javascript/css code allows the comments/comments form to appear as a lightbox. (As mentioned, the only way I could get comments to appear at all on the main page was to add the hack and ended up with comments in the posts loop, causing comments to appear per post, instead of one comments list for 4 posts. If I knew how to get just one comments list for the whole page, I'd change it, but moving around the hack causes comments to disappear altogether) Getting the comments to appear in the lightbox is fine, but...

The issue is that when you click the feedback link for any of the posts, the same comments list appears (See http://www.schoolofpuppetry.com.au/books.php click '6 comments' on the first post; click any 'leave a comment' on the other posts. Notice they bring up the same comments list). What I want is the correct comments for that specific post to popup in the lightbox when you click on its respective feedback link.

Sorry if that's confusing, but I have no idea how to explain it better.

Perhaps it would help if I posted the contents of the posts.main and single.main?

12 Jul 06, 2010 12:50

/* spam removed*/

14 Jul 06, 2010 15:25

Assuming that this is your link trigger

<a href="http://www.schoolofpuppetry.com.au/books.php/book-review-the-foam-book#comments" title="Display comments / Leave a comment"rel="comments" class="lbOn">6 comments</a>

And that it hooks into

<div id="comments" class="leightbox1">

Then just change both of those to add the items id, you should then have matching unique hook/trigger

eg/

echo '<a href="'.$Item->get_permanent_url().'#comments" title="Display comments / Leave a comment"rel="comments'.$Item->ID.'" class="lbOn">6 comments</a>';

//.......

echo '<div id="comments'.$Item->ID.'" class="leightbox1">';

¥

15 Jul 08, 2010 03:04

Thanks Yabba, that worked!

My only problem now is trying to get the correct $link_text to show up (ie. 1 comment/6 comments/Leave a comment). Is there any way to add that code to the link?

¥åßßå wrote:

Assuming that this is your link trigger

<a href="http://www.schoolofpuppetry.com.au/books.php/book-review-the-foam-book#comments" title="Display comments / Leave a comment"rel="comments" class="lbOn">6 comments</a>

And that it hooks into

<div id="comments" class="leightbox1">

Then just change both of those to add the items id, you should then have matching unique hook/trigger

eg/

echo '<a href="'.$Item->get_permanent_url().'#comments" title="Display comments / Leave a comment"rel="comments'.$Item->ID.'" class="lbOn">6 comments</a>';

//.......

echo '<div id="comments'.$Item->ID.'" class="leightbox1">';

¥


Form is loading...