?

Log in

No account? Create an account

Previous Entry | Next Entry

Hi :) I have two questions:

1. When you have an entry without a subject, the date of the entry is shown as the subject, so I'm wondering, is there any way to change the subject of a subject-less entry from the date of the entry to something else, like "no subject"?

2. I just found out that when I have a subject of an entry italicised (ie using < i > < /i > in the subject field when I type an entry), it doesn't show in my LJ as italics, but it did show when I used flexible squares. Any way to work around this?

Thanks for any help :)

Comments

( 8 comments — Leave a comment )
av8rmike
Mar. 19th, 2007 01:35 pm (UTC)
I could have sworn I posted this fix for someone once before, but I looked under the entry header and s2 tags and didn't see it. You'll need to create a theme layer and edit the print_entry() function. Change this section:
    if ($e.subject != "") {
        $subject  = striphtml($e.subject);
        $datetime = lang_posted_by_date_and_time($e, $showposter, true, true);
    } else {
        $subject  = lang_posted_by_date_and_time($e, $showposter, true,  false);
        $datetime = lang_posted_by_date_and_time($e, $showposter, false, true);
    }
to this:
    if ($e.subject != "") {
        $subject  = striphtml($e.subject);
    } else {
        $subject  = $*text_nosubject;
    }

    $datetime = lang_posted_by_date_and_time($e, $showposter, true, true);
The effect will be like what is in this community. If you want to customize the text that appears when there is no subject, add the line
set text_nosubject = "REPLACE WITH YOUR OWN TEXT";
Somewhere near the top of the theme layer. The line that has the striphtml() function in it is why italics text doesn't display; the layer strips the HTML out of the text, which is done to prevent any malicious code from executing.
trusea
Mar. 19th, 2007 02:12 pm (UTC)
Will try it out once I have time, thanks a lot for the help! :)
orexisbella
Jun. 2nd, 2010 02:00 am (UTC)
I edited the current print_entry function to set up the default text for subject-less entries, but I noticed that the function no longer includes the striphtml line. Is there a way to restore it? (I'd prefer that all subject lines in my comm look the same.) I tried pasting it into a variety of locations, but it always compiled with an error. The subject section of my print_entry function is below:


if ($e.subject != "") {
var Entry en = $e as Entry;
print $en->formatted_subject({"class"=>"subj-link"});
$datetime = lang_posted_by_date_and_time($e, $showposter, true, true);
} else {
var string subject = "";
$subject = $*text_nosubject;
$datetime = lang_posted_by_date_and_time($e, $showposter, true, true);
"""$subject""";
}
av8rmike
Jun. 7th, 2010 01:49 pm (UTC)
Ooooh, the code in that comment above is really old; it hasn't been that way in a year or two. I think you shouldn't need to put striphtml() anywhere in the code because the formatted_subject() function should strip HTML itself. Are you saying that it isn't, or that it's doing something differently?
orexisbella
Jun. 7th, 2010 01:57 pm (UTC)
Yup, the HTML doesn't seem to be getting stripped (for a live example, see the third post on marmalade_fish entitled "Come buy! Come buy!" in italics). I did figure that the code was old, but modifying the same bits still worked to set a default subject, so I thought that bit might work too. :)
av8rmike
Jun. 7th, 2010 02:11 pm (UTC)
Well, looks like that formatted_subject() function preserves, rather than strips formatting. If you try to strip HTML from formatted subjects, the italics go away, but so does the linking. Is that OK, or did you want HTML stripped and subjects to still be links?
orexisbella
Jun. 7th, 2010 02:33 pm (UTC)
If it's possible for HTML to be stripped and subjects to still be links, I'd love that :)

Bizarrely, the italicised subject doesn't work as a link, either :/
av8rmike
Jun. 16th, 2010 05:53 pm (UTC)
Sorry, I completely forgot about your question! =( Did you try the second code segment that's in the top-level comment here, and did it work? I think that does what you're asking, if I'm understanding.
( 8 comments — Leave a comment )

Latest Month

March 2016
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

S2 Help Communities

Tags

Powered by LiveJournal.com
Designed by chasethestars