tags:

views:

127

answers:

3

Intense Debate uses the following javascript code to display a comments number on my blog, which I have included in a handy little php function. By passing this php function the ID of a blog post, it creates a link to the comments section of that specific post.

function show_comments_number($id) {
$url="index.php?p=post&id=$id";
?>
<script>
var idcomments_acct = 'xxx';
var idcomments_post_id = '<? echo $id;?>';
var idcomments_post_url = '<? echo $url;?>';
</script>
<script type="text/javascript" src="http://www.intensedebate.com/js/genericLinkWrapperV2.js"&gt;&lt;/script&gt;
<?}

The problem is that Intense Debate parses the URL I'm trying to pass it, leaving off the & and everything after it. So the link Intense Debate produces is just "index.php?p=post" -- obviously this is a problem.

Any ideas as to why it's chopping the URL in this way?

A: 

Chances are, the &id in your URL is being interpreted as an invalid HTML entity. Wrapping your <script> tag in a comment (<!--<script></script>//-->) should help with that.

Frank Farmer
A: 

Change the &id to &amp;id, and you should solve it.

James Socol
A: 

Or follow the W3C's advice and change & to a ; (make sure to modify your argument_separator.input and argument_separator.output accordingly).

TML