Log in

View Full Version : Using a comment widget that loads info depending on the URL



Spinethetic
05-06-2008, 04:00 AM
I have been using this comment widget LINK (http://js-kit.com/comments/) across many pages on my site. However it seems that when it was developed it was only meant to be used on absolute .htm(l) HTML pages. Now since I am converting pertanant sections of my site to a custom flat-file PHP-based CMS, the same comments are displaying on the 'universal display page', regardless of any variables I may pass through the URL.

I hve it set up so that each new article is displayed on the same page, the article displayed simply depending on a URL variable. However the widget only reads up the the file extension and ignores anything afterward.

ie: Same comment is displayed here (http://www.integralbuddha.net/n/v.htm?id=24) as well as here (http://www.integralbuddha.net/n/v.htm?id=25)

The widget itself is just a simply 4 line code:


<div class="js-kit-rating"></div>
<script src="http://js-kit.com/ratings.js"></script>
<div class="js-kit-comments"></div>
<script src="http://js-kit.com/comments.js"></script>


I am a noob PHPer but I think there must be some kind of workaround after reading number 4 of their FAQ (http://js-kit.com/comments/custom.html); something along the lines of:


if $variable = 25; {
print "<div class="js-kit-comments" path="25"></div>";
}
if $variable = 24; {
print "<div class="js-kit-comments" path="24"></div>";
}


I am working on writing my own php script to solve these types of problems once and for all, for as only recently delving into server-side scripting, I have grown accustomed to using various remotely-hosted widgets on my sites. And now I want to gain complete self-sustainability, and server-side solutions fits the bill.

Best Regards
~Ross :)

kingtury
05-07-2008, 08:00 AM
You need to set path and permalink attributes
div class="js-kit-comments" style="margin: 0px"
permalink="<?php the_ID; ?>" path="<?php the_permalink(); ?>">
</div>

substitute a variable that has a unique value for the_ID and full URL to the page for the_permalink.

matthewbluewars
05-11-2008, 07:38 PM
You will want to put a PHP script into the variable that holds the url.
PS. You could use echo as well as print to write an HTML message.

janodejager
05-30-2008, 08:20 AM
Hi Ross,

I've got the exact same problem but no of your expertize...

Please let us all know if you figure something out!

Jano