Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Making the subject end ...

Quote Reply
Making the subject end ...
Hi,

If someone enters a really long subject line in their email and sends it to a user on GM, I'd like it to truncate the subject before it displays it in the mail list (but not when you veiw the individual message) and add on '...' to let you know there's more too it.

So instead of the subject displaying reading...

This is a really long subject in my email to you!

It will instead read:

This is a really long...

Any help appreciated!

Thanks,
Regan.


Quote Reply
Re: Making the subject end ... In reply to
Any help REALLY REALLY appreciated?

:)

R.

Quote Reply
Re: Making the subject end ... In reply to
<%set short_subject='sub { my $vars = shift; (my $subject = $vars->{msgs_subject}) =~ s/^(.{25}).+$/$1 .../; $subject };'%>

Try that in msgs_list_include.htm (and there's a few others which use subject, like umm... search, etc)
That sets's <%short_subject%> to one which is maximum 25 characters long followed by ...
Remember to change <%msgs_subject%> to <%short_subject%>. If you want, you can probably just change that to <%set msgs_subject ...%> and not change the body (okay i just made things sound more complicated than needed).


Adrian
Quote Reply
Re: Making the subject end ... In reply to
Excellent! Thanks too much!

The first example worked a treat! I tried it a few different ways with the existing <%msgs_subject%> being <%set msgs_subject ...%> and no matter what I did it gave an error like:

CODE(0x84829d8)

where the subject should have been. I guess it was getting mixed up with the tag suddenly being changed above and then trying to parse it again?

The shortened subject feature would be an EXCELLENT addition if built in standard into the next release. It could possibly be a setting in the admin area? It makes formatting your layout a lot easier when you've got constrained variables.

Cheeeeeers!

Regan.

Quote Reply
Re: Making the subject end ... In reply to
oops, doing a <%set msgs_subject ...%> won't work because it's already changed msgs_subject to be that string of 'sub ...', so when it uses msgs_subject in the sub, it's using a reference to the subroutine (or something to that effect ;)
You'll have to go with <%set short_subject ...%> and <%short_subject%>

Adrian
Quote Reply
Re: Making the subject end ... In reply to
Cheers Adrian,

Hey I tried it as a global sub as well and it did the same thing as the example you gave me the other day - it just printed the sub routine to the screen instead of parsing it and displaying the results.

Are you able to check if this is a bug with 2.0.2 that it doesn't work with subs in the admin globals? Or a bug with me :)

Cheers,
R.

Quote Reply
Re: Making the subject end ... In reply to
Hi,

No this is a bug in 2.0.2, sub {} don't work as globals. We should have 2.0.3 out very shortly.

Cheers,

Alex

--
Gossamer Threads Inc.