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]   Go Down
Print
Author Topic: ssi list template  (Read 1430 times)
0 Members and 1 Guest are viewing this topic.
newtech
New Member
*

Karma: 0
Offline Offline

Posts: 28


« on: August 03, 2007, 04:37:41 AM »

Can someone show the code that would be used to create a template that would generate a list of events. I would like two different styles.
1. An event list that would show a list of events for a specific number of days that shows the date and linked event title.

2. An event list would show a list of events for a specific number of days, but the list needs to show not only show the date and linked event title, but any included images and a short description.
Logged
newtech
New Member
*

Karma: 0
Offline Offline

Posts: 28


« Reply #1 on: August 03, 2007, 03:23:45 PM »

I found most of what I wanted at:
http://www.calendarscript.com/support/forum/index.php/topic,1255.0.html
and it is working fine with some edits I did.

However, is there a way to make it so only so many characters of the description appear?
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #2 on: August 03, 2007, 08:58:53 PM »

It should be possible to use Perl's substring function on any variable.

LINK > Perl Basics: Chop, Length, and Substring

JFYI

Dan O.

Logged
newtech
New Member
*

Karma: 0
Offline Offline

Posts: 28


« Reply #3 on: August 25, 2007, 05:44:08 PM »

It should be possible to use Perl's substring function on any variable.

LINK > Perl Basics: Chop, Length, and Substring
I read through this but the scripting they are using (Substring) does not make sense how it would work with the calendar script.
Any other suggestions?
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #4 on: August 26, 2007, 01:22:27 PM »

Quote
does not make sense how it would work with the calendar script.

It would be used on the CalendarScript variable you wanted truncated, before printing it. Eg.

$CalendarScript_Variable_Here = substr($CalendarScript_Variable_Here, start number, length);

Dan O.
Logged
newtech
New Member
*

Karma: 0
Offline Offline

Posts: 28


« Reply #5 on: August 28, 2007, 12:05:56 AM »

Here is the calendarscript:
<%= EVENT FIELD(description) %>

It does not start with a $.

No matter what I try, the only thing that happens is the command substr($<%= EVENT FIELD(description) %>, start number, length);
 shows up on the live page.
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #6 on: August 28, 2007, 12:27:11 PM »

Try using:

<% $EVENT->{'details'}->{'description'} = substr($EVENT->{'description'}->{'details'}, 0, 20); %>

BEFORE  where the following line is used to print the value.

<%= EVENT FIELD(description) %>

Dan O.
Logged
newtech
New Member
*

Karma: 0
Offline Offline

Posts: 28


« Reply #7 on: August 28, 2007, 03:12:19 PM »

When I put
<% $EVENT->{'details'}->{'description'} = substr($EVENT->{'description'}->{'details'}, 0, 20); %>
<%= EVENT FIELD(description) %>

The description is removed completely.

Wouldn't this make more sense:
<% $EVENT->{'description'} = substr($EVENT->{'description'}, 0, 50); %>
<%= EVENT FIELD(description) %>

But I guess not because the description length is not changed at all.
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #8 on: August 28, 2007, 03:32:50 PM »

** Wouldn't this make more sense: **

No because there is no such variable as $EVENT->{'description'}

EVENT FIELD(description)

is only a short form of

$EVENT->{'details'}->{'description'}

but the former is not a variable itself so it can not be manipulated (or actually it can be, but since it isn't used anywhere the changes wouldn't be seen).


Maybe try this as the second half of the statement:

= substr({ $EVENT->{'description'}->{'details'} }, 0, 20); %>

Other than that, I do not know what the problem would be. I don't know why it wouldn't work.

Dan O.
« Last Edit: August 28, 2007, 03:35:53 PM by DanO » Logged
Pages: [1]   Go Up
Print
Jump to: