Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1] 2   Go Down
Print
Author Topic: Description Break Lines  (Read 1051 times)
0 Members and 1 Guest are viewing this topic.
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: January 09, 2002, 05:56:00 PM »

How can one make it so that in the Description box, when someone puts a hard return (hitting the enter key), that when the data is saved, it will reflect those hard returns when you view it through the calendar?

Right now, those hard returns are moved and all the data is put on the same line so things like address and such are in one long sentence rather than on each seperate line by themselves.

I do not want to allow HTML as I've found that some people like to screw things up with it.

GoleyC

Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #1 on: February 27, 2002, 02:42:00 PM »

Bump....does any have an idea on how to do this?

------------------

Logged
Scott
Guest
« Reply #2 on: March 05, 2002, 07:06:00 AM »

This is a "hack" fix, but I think it will work (I haven't tested it).

In your display template, find the following chunk of code:

code:

<!-- EVENT VIEW -->
<% } elsif ($VIEW eq "Event") { %>
   <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
   <%
   foreach (@$fields) {
      next unless ($db->{'properties'}->{$_}->{'display_details'});
   %>
      <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B><%=$db->{'properties'}->{$_}->{'name'}%>: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$_}%></SPAN></TD></TR>
   <% } %>
   </TABLE>

and change it like this (insert the 7th line below)

code:

<!-- EVENT VIEW -->
<% } elsif ($VIEW eq "Event") { %>
   <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
   <%
   foreach (@$fields) {
      next unless ($db->{'properties'}->{$_}->{'display_details'});
      $EVENT->{details}->{$_} =~ s/\r?\n?/<BR>/g;
   %>
      <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B><%=$db->{'properties'}->{$_}->{'name'}%>: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$_}%></SPAN></TD></TR>
   <% } %>
   </TABLE>

Try it out and see if that works  

------------------
Scott
CalendarScript.com


Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: March 05, 2002, 10:57:00 AM »

Thanks Matt,

You gave me a good starting point to work from. Your code didn't exactly work the first time out. Each character in the text had a break line.  This made the text run

d
o
w
n

t
h
e

s
i
d
e like this.

So I played with the code and found that removing the "?" from the following: s/\r\n/<BR>/g; did the trick.

Below is the correct code now.

<!-- EVENT VIEW -->
<% } elsif ($VIEW eq "Event") { %>
   <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
   <%
   foreach (@$fields) {
      next unless ($db->{'properties'}->{$_}->{'display_details'});
      $EVENT->{details}->{$_} =~ s/\r\n/<BR>/g;
   %>
      <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B><%=$db->{'properties'}->{$_}->{'name'}%>: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$_}%></SPAN></TD></TR>
   <% } %>
   </TABLE>


Thanks a bunch!!!

------------------

Logged
Scott
Guest
« Reply #4 on: March 05, 2002, 11:58:00 AM »

Ah yes, duh   Stupid mistake by me!

------------------
Scott
CalendarScript.com


Logged
Jason S
New Member
*

Karma: 0
Offline Offline

Posts: 3


WWW
« Reply #5 on: March 28, 2002, 12:13:00 PM »

In the List & Today view the event details also display without line breaks.  Is there any way to fix this?

Thanks.

Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #6 on: March 28, 2002, 01:31:00 PM »

The above code that I posted will work for that.  Only new events added after the code has been replaced will show up on individual lines when someon hit enter for a new line.

Old events will have to be edited to correct the issue of all the text string being placed on one line and not broken down by paragraphs or sentences.

------------------

Logged
kayleigh
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer Analyst


WWW
« Reply #7 on: March 28, 2002, 02:48:00 PM »

Jason --
For Day->List & Search views, use
code:
$EVENT->{'details'}->{'description'} =~ s/\r\n/<BR>/g;


in the first lines after the start of the FOREACH line command in your template.

PS: This is the correct code for the default.html template.

------------------
Stephanie Meemken
Webmaster, Minnesota Jaycees http://www.mnjaycees.org/

[This message has been edited by kayleigh (edited March 28, 2002).]

Logged

Stephanie Meemken
Webmaster, Minnesota Jaycees

http://www.mnjaycees.org/
AWSguy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #8 on: March 29, 2002, 01:47:00 PM »

Perhaps I should make this a new topic.  I added the code to put the <br> in.  Very nice.  This brought to light a different problem.  It seems that when I go into an event with a line break in the description and I edit any other field, somehow the line break in the description multiplies.  The next time I view the event, there's more line breaks even though I didn't edit that field when I edited the event.  If I go back in and edit the event again (not touching the description field), the same thing happens.  It adds from 1 to 3 line breaks at a time.  After doing a few edits on an event, suddenly the description is starting to expand with lots of blank space:

"1st line of description"
(31 blank lines)
"2nd line of description"

In the .txt files these are showing up as a box with a "/n" after it.

Matt, do you know how this is happening and how I can fix it?

Thanks,
Jon

[This message has been edited by AWSguy (edited March 29, 2002).]

Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #9 on: March 29, 2002, 03:56:00 PM »


I'll do some testing with our calendar to see where your problem lies.  As for our calendar, I've haven't seen this happen, and we've edited our event many times.

Maybe you have something out of place and or the code got screwed up in the process of changing it.

One other things to think about, have you did any other modifications to the default.html calendar code?

------------------

Logged
AWSguy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #10 on: March 29, 2002, 05:56:00 PM »

Thanks GoleyC for testing.  Let me know what you find.  I don't think it's a function of what's happening in default.html, but rather in the perl script.  The erroneous characters (which the calendar displays as line breaks since adding the function discussed in this thread) are actually put into the .txt files.  So that's done by the work of the .pl files.

-Jon

Logged
GoleyC
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #11 on: March 30, 2002, 10:59:00 AM »


Our version tested and works the way it should.  It doesn't put any extra break lines in when editing.

When your editing the event, make sure that there's no HTML break tag showing up.  For example, if you see < br > without the spaces between the greater than and less than signs, you shouldn't get any extra returns when you save your edited event.

------------------

Logged
AWSguy
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #12 on: April 05, 2002, 05:11:00 PM »

You're right and I am watching for that.  That's not an issue.  Perplexing...

------------------

Logged
yullah
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #13 on: April 24, 2002, 06:39:00 PM »

how exactly do i use

$EVENT->{'details'}->{'description'} =~ s/\r\n/<BR>/g;

or some other line of code to edit my list and day view with line breaks where returns were inserted?

if someone could include a chunk of code to replace, and the new chunk to replace it with, it would be very helpful.

thanks!

Logged
mainsdor
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #14 on: May 16, 2002, 07:10:00 PM »

Could someone tell me exactly which is the "display template" that you have been talking about in the previous discussion? Is it the default.html template? Thanks

vonachen@wanadoo.fr

------------------

Logged
Pages: [1] 2   Go Up
Print
Jump to: