I've used the tutorial on making square components, and tried to put an if function in the section that draws the entry header (using code I'd cobbled together from some other tutorials) like so:
# Make default entry component headers and default comment component headers have square corners
function print_entry_header(string content) {
"""
[table cellspacing="0" cellpadding="0" border="0"]
[tr]
[td class="dkLine" colspan="7"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="dkLine" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="ltLine" colspan="5"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="dkLine" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="dkLine" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="ltLine" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="medLine" colspan="4"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="dkLine" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="dkLine" rowspan="3" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="ltLine" rowspan="3" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="medLine" rowspan="3" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="tabBg" rowspan="1" colspan="2"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="medLine" rowspan="3" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="dkLine" rowspan="3" colspan="1"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="tabBg" colspan="2"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="tabBg" colspan="2"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="dkLine" width="1" rowspan="3"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="ltLine" width="1" rowspan="2"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="medLine" width="3" ][img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /][/td]
[td class="tabBg" width="100%"]""";
if ($p.view == "friends") {
""" [div class="entryDate" style="position:relative; top:-3px; left:2px; background-color: """; print $bgcolor.as_string; """ ; foreground-color: """; print $fgcolor.as_string; """ ;"]$content[/div] """;
}else{
""" [div class="entryDate" style="position:relative; top:-3px; left:2px;"]$content[/div] """;
}
"""
[/td]
[td class="tabBg" width="3" ][img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /][/td]
[td class="medLine" width="1" rowspan="2"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[td class="dkLine" width="1" rowspan="3"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="medLine" colspan="4"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[tr]
[td class="dkLine" colspan="5"][img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /][/td]
[/tr]
[/table]""";
}
But that didn't work, because the compiler didn't recognise the variable $p.view=="friends" in that context. I don't know that much about coding - I can sort of handle things if I have a reference book - but can't really do things from scratch, which is probably why this went wrong.
Thanks in advance for any help you can give me! :)