At my wits end on this one.

My output for my comments is currently

<div id="comments">
<a id="comment-79"></a>
          	<h3 class="accordion comment-79"><a href="http://usershomepage.com" rel="nofollow">Username</a> &nbsp; On December 17th, 2009</h3>
	<div class="commtext">
		<p>Loreum Ipsum.</p>
	</div>
<a id="comment-78"></a>
          	<h3 class="accordion comment-79"><a href="http://usershomepage.com" rel="nofollow">Username</a> &nbsp; On December 17th, 2009</h3>
	<div class="commtext">
		<p>Loreum Ipsum.</p>
	</div>
</div>

My comment.tpl.php

      <?php if ($comment): ?>
    	<h3 class="accordion comment-<?php print ($comment->cid); ?>"><?php print theme('username', $comment); ?> <?php print t('on ') . format_date($comment->timestamp, 'custom', 'F jS, Y'); ?></h3>
	<div class="commtext">
		<?php print $content ?>
	</div>
      <?php endif; ?>

My comment wrapper is set through the template.php, not the comment_wrapper.tpl.php, which does not exist for my theme. I've searched both my theme and my subtheme for $comment->cid. I even printed out the template.php and went through it with a highlighter. There's no logical reason for there to be a <a id="comment-79"></a> immediately above the text.

Does anyone have any idea where the <a id="comment-79"></a> is coming from?

P.S. Please tell me I'm not going to have to edit the core.

Comments

kcyarn’s picture

I found it! (I just wish it was somewhere else.)

It's under modules/comment/comment.module .

$output .= "<a id=\"comment-$comment->cid\"></a>\n";

Now the only question is will I edit the module itself or override it. Given my time constraints, I'm leaning towards editing.

Jeff Burnz’s picture

Why is there such pressing need to remove this? Its an anchor link that allows visitors to jump directly to the relevant comment when clicking links such as those in the Recent Comments block. Its hidden and doesn't affect anything.

If you really must remove it you will note that that line is in a theme function, so you can copy it to your template.php file, rename it to match your theme name and modify it there.

Remember that every time you hack core god kills a kitten.

kcyarn’s picture

I know and I was extremely reluctant to go that route. I'm started off writing my own JQuery accordion style script to work around the extra anchor reference, but the more I worked on it, the more I felt like I was hacking and being a bit of an idiot. Afterall, JQuery UI was already being used on my site for other features and it had the functionality I wanted.

The issue is more of I'm hiding all but the title and author information on my comments except the first one. You have to click on the others to see them. I'm not suggesting this is something everyone should go out and do, and if it was a client site, I would have strenuously objected to modifying anything outside the theme. But it's mine and now that I know where to look, it's something I can keep track of pretty easily.

The recent comments block is not presently in use on my site, nor do I plan on using it in the future.

For the record, even though comments is a core module, it's still a module, which means it's purpose (at least in my mind) is to extend Drupal's functionality. In this case, the html inside the module got in my way and wasn't being used elsewhere on my site (I verified that before I did anything and tested it on my localhost first. There are some things you just don't do to live sites...) so I removed it and made myself a note in my mods text file that I did so. (Yes, I'm anal enough that I keep a checklist of what I've installed, what's in use, and what I've edited, and I refer to it before I update things.) I do go back from time to time and move my changes out of my core. For now, it works.

And before anyone asks, yes I took pleasure in deleting those pesky html insertions, but only because they caused me a few headaches. If god really does kill kittens, I have a request. Please take my cat Beelzebub. His name suits him.

Edit: Theming comments is a topic that's still fairly new to me and my experience with it was far from pleasant. After reading the documentation, multiple comment example files from other themes, and every blog post I could find (my books were silent on this issue), I ended up spending some time reading the comment module files instead. That worked for me. Hopefully, I'll get some time over the weekend to go through my notes and see if there's anything to contribute to the docs.

Jeff Burnz’s picture

Comment module has many theme-able functions, if you understand how to use those you understand how to do what you want without hacking core, so theres really no need for us to have screeds of info about doing this or that simple adjustment, just copy/paste the theme function and you're away.