Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Event Calendar - Category, Sponsor problems


Go to End


9 Posts   2744 Views

Avatar
OutrunTheWolf

Community Member, 34 Posts

28 July 2009 at 12:36am

Hi all,

With regards to the Event Calendar

My Sponsor, Category, and Registration bit doesn't work.

<dl> 
<dt>Category: </dt> 
<dd>$Event.Category</dd> 
<dt>Sponsor: </dt> 
<dd>$Event.Sponsor</dd> 
</dl> 

http://www.srmpromotions.com/dj-factory/2009-08-08

You can see at the bottom of the page that it creates the Category and Sponsor, but doesn;t bring in the details from the CMS. I have tried lots of variations of writing this code, including inserting <% control Event %>...<% end_control %>. But as i'm dabbling, and i'm not 100% sure on how the 'control things' work.

I'd like to use the registration field in the CMS to generate a link on the page. So where its says Tickets, i'd like to insert the Registration field there:

<div id="TicketHolder">

<a href="$Event.RegistrationLink"><h3>Event Tickets</h3></a>

</div>

to act as a link for that particular event.

I hope you can get what i'm trying to explain, if anyone can help with this I would greatly appreciate it.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

28 July 2009 at 3:50am

Can you post your code for your event class?

Avatar
OutrunTheWolf

Community Member, 34 Posts

28 July 2009 at 5:25am

My SS and php file attached

Avatar
UncleCheese

Forum Moderator, 4102 Posts

28 July 2009 at 10:41am

If you're on the detail page for the event, you don't need the $Event accessor, since you're not in the Events control like on the calendar view. The difference is that the latter returns DateTime objects, not Event objects.

Avatar
OutrunTheWolf

Community Member, 34 Posts

28 July 2009 at 12:26pm

Works perfectly now, Thanks.

Avatar
wildflower1975

Community Member, 63 Posts

22 January 2010 at 3:16pm

Edited: 22/01/2010 3:21pm

After reading this, I realised I was editing the Workshop.ss and not the WorkshopHolder.ss and so I was seeing the reverse where by
$Category and $Sponsor was working.

However I'm having difficulty in getting the $Location variable to show in the Workshop.ss
I assume it needs to go via another 'accessor'?

$Event.Location and $DateTime.Location don't work - but i'm only guessing at what it should be, any hints where to look?

another thing - where is the Location stored in the database, I can't it anywhere in the database via phpMyAdmin

cheers

Avatar
UncleCheese

Forum Moderator, 4102 Posts

22 January 2010 at 3:53pm

What class is the Location field in?

It's pretty simple.. If you're in <% control Events %>, then anything on the Event subclass needs to be accessed by $Event.Field. Anything on the DateTime subclass can be accessed with just $Field.

But if you're in <% control Event %>, then you can access anything on the Event subclass with just $Field.

Avatar
wildflower1975

Community Member, 63 Posts

23 January 2010 at 8:50pm

so in WorkshopHolder.ss this works as expected

<dt>Category: </dt>
<dd>$Event.Category</dd>
<dt>Sponsor: </dt>
<dd>$Event.Sponsor</dd>
<dt>Location:</dt>
<dd>$Location</dd>
</dl>

but in Workshop.ss

<dt>Category: </dt><dd>$Category</dd>
<dt>Sponsor: </dt><dd>$Sponsor</dd>
<dt>Location: </dt><dd>$Location</dd>

only the Category and Sponsor values are showing

As far as I can tell from your previous post the Location is part of the DateTime class and should show.

I've tried $WorkshopDatetTime.Location and $Event.Location and $DateTime.Location and $Location and it doesn't show up, but the value does show on the WorkshopHolder page so it must be set (although I can't find it anywhere in the tables via phpMyAdmin - is it stored as a hash or something in memory due to the addTableFields function?).

Workshop.ss is an exact copy of CalendarEvent.ss except for the above 3 lines in it.

I'm using v88 of the event calendar on ss v 2.3.4

thanks for your patience

Go to Top