Jump to:

10930 Posts in 2613 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar - Category, Sponsor problems

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 1896 Views
  • OutrunTheWolf
    Avatar
    Community Member
    34 Posts

    Event Calendar - Category, Sponsor problems Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar - Category, Sponsor problems Link to this post

    Can you post your code for your event class?

  • OutrunTheWolf
    Avatar
    Community Member
    34 Posts

    Re: Event Calendar - Category, Sponsor problems Link to this post

    My SS and php file attached

    Attached Files
  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar - Category, Sponsor problems Link to this post

    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.

  • OutrunTheWolf
    Avatar
    Community Member
    34 Posts

    Re: Event Calendar - Category, Sponsor problems Link to this post

    Works perfectly now, Thanks.

  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Re: Event Calendar - Category, Sponsor problems Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar - Category, Sponsor problems Link to this post

    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.

  • wildflower1975
    Avatar
    Community Member
    59 Posts

    Re: Event Calendar - Category, Sponsor problems Link to this post

    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

             

    1896 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.