Hello there!
I am using the latest S9Y in combination with a slightly modified carl template. Below each blog entry, the section with trackbacks and comments take a lot of space, even when there are none. Also, I'd like the "write comment" area to be hidden by default, and only show when the user clicks the heading
What's the easiest way to make that happen? Embedded JavaScript inside the template?
Hide empty trackbacks and comments
You could hide the block with Javascript. You could also use CSS, but you'd have to modify the template a little bit. You could include the Javascript in a HTML Nugget in Head event plugin.
I'm afraid I don't have the Javascript for hiding a <div> on hand. I'd recommend a Google search. When you find it, just install the Head Nugget, copy your Javascript into it, and make sure that it's set to not allow markup.
I'm surprised the trackback and comment section is taking up so much space. I'd edit the carl_contest/style.css and change the margins and padding for .serendipity_section_trackbacks and .serendipity_section_comments.
Whenever I edit CSS, I find that Firefox and the Firebug plugin are extremely helpful. They take a multiple-hours task down to a dozen minutes.
If you need anything more specific, let us know!
I'm afraid I don't have the Javascript for hiding a <div> on hand. I'd recommend a Google search. When you find it, just install the Head Nugget, copy your Javascript into it, and make sure that it's set to not allow markup.
I'm surprised the trackback and comment section is taking up so much space. I'd edit the carl_contest/style.css and change the margins and padding for .serendipity_section_trackbacks and .serendipity_section_comments.
Whenever I edit CSS, I find that Firefox and the Firebug plugin are extremely helpful. They take a multiple-hours task down to a dozen minutes.
If you need anything more specific, let us know!
Thank you for your quick answer. I have a lot of short postings, that's why it doesn't look too good.
The problem is not the embedded JavaScript. I want to hide both trackback and comments only if there are none, and I'm unsure how to find out about that - I can only see a call to printTrackback inside the template.
The problem is not the embedded JavaScript. I want to hide both trackback and comments only if there are none, and I'm unsure how to find out about that - I can only see a call to printTrackback inside the template.
Ah. In that case, you'll want to use a little Smarty in the entries.tpl.
Find the <div> with the comments (it'll probably have the class serendipity_section_comments). Surround it with an {if} statement:
You can do the same with the trackbacks; there, you'll want to use $entry.trackbacks. Just be careful: the link allowing other bloggers to create trackbacks is usually in that <div>, and you don't want to eliminate it unless you also want to eliminate any trackbacks you might get. Just move the link outside the block, so it always shows up.
If you find that the whole thing is in one bigger <div>, and you want to display the whole thing ONLY when there are trackbacks, comments, or both, use this {if} instead:
Of course, you'll still want to be careful with the trackback link.
That should do what you want! We'll be here if you have any other questions.
Find the <div> with the comments (it'll probably have the class serendipity_section_comments). Surround it with an {if} statement:
Code: Select all
{if $entry.comments > 0}
... regular comment stuff ...
{/if}
If you find that the whole thing is in one bigger <div>, and you want to display the whole thing ONLY when there are trackbacks, comments, or both, use this {if} instead:
Code: Select all
{if $entry.comments > 0 || $entry.trackbacks > 0}
... giant trackbacks and comments div ...
{/if}
That should do what you want! We'll be here if you have any other questions.