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.

All other Modules

Discuss all other Modules here.

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

Event_calendar --> showing $Event_Title on hover


Go to End
Reply

10 Posts   1223 Views

Avatar
wilsonStaff

13 January 2012 at 6:32am (Last edited: 27 January 2012 12:02pm), Community Member, 142 Posts

HI, ive tried numerous ways to do so, to no success. I have two things id like to do.

I AM USING LIVECALENDER WIDGET

1) Id like <td> that doesnt have an event to have no <a>.

Here is the code thats on place as we speak. Displays TEST5 (title tage) on ALL td. Normal, code below dictates this.

<tbody>
<% control Weeks %>
      <tr>
         <% control Days %>
            <td id="evenements" class="$Today $OutOfMonth $CurrentDay $HasEvent">
               <a href="calendrier" title="TEST5">$Number</a>
            </td>
      <% end_control %>
      </tr>    
<% end_control %>
</tbody>

Ive tried

<tbody>
<% control Weeks %>
      <tr>
         <% control Days %>
<% if Events %>
            <td id="evenements" class="$Today $OutOfMonth $CurrentDay $HasEvent">
               <a href="calendrier" title="TEST5">$Number</a>
            </td>
<% else %>
<td>$Number</td>
      <% end_control %>
      </tr>    
<% end_control %>
</tbody>

I am getting errors from this code.

2) Id like $_Event_Title (or any customs textfields) to show on hover

Here is the code thats on place as we speak. Displays TEST5 (title tag) onhover. Normal, code below dictates this.

<a href="calendrier" title="TEST5">$Number</a>

When i try any code that starts with $ (be ity $Title, $_Title, $Date etc) , it misbehaves : some tds are disapearing.

<a href="calendrier" title="$Event.Title">$Number</a>

also tried

<a href="calendrier" title="<% control Event %>$Event.Title"<% end_control %>$Number</a>

no results either.

Thanks for helping!

Avatar
wilsonStaff

27 January 2012 at 11:57am Community Member, 142 Posts

Bump to the top....

Avatar
UncleCheese

28 January 2012 at 8:33am 4085 Posts

Somewhere in the forum there's an explanation of how to do this. But here it is again:

Around line 206 in CalendarUI.class.php, there's an array that accepts all the data for a given day in the calendar. You'll see that "HasEvent" is one field. After that entry in the array, add:
'Events'          => $this->calendar->Events(null, $this->date_counter->date(), $this->date_counter->date()),

And on LiveCalendarWidget.ss:

<td class="$Today $OutOfMonth $CurrentDay $HasEvent">
<a href="$ShowDayLink">$Number</a>
<% if Events %><% control Events %><a href="$Event.Link">$Event.Title</a><% end_control %><% end_if %>
</td>

---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

Avatar
wilsonStaff

28 January 2012 at 9:19am Community Member, 142 Posts

Hi Uncle, glad to meet you. Dont go away, we are almost there.... The code you gave me works fine in the sense that it CORRECTLY displays the $Customs (see yellow tip tools in the pic) fields i want. But it messes up the calendar rendering.

Here is the code you gave me, i just added my $Event.CustomFields:

<td class="$Today $OutOfMonth $CurrentDay $HasEvent">
   <a href="$ShowDayLink">$Number</a>
      <% if Events %>
         <% control Events %>
            <a href="$Event.Link" title="{$Event.Title} {$Event.Conferencier}"></a>
         <% end_control %>
      <% end_if %>
</td>

Heres what it looks like. See below. It pushes the <% control Events %> data UNDER the number.

I presume its a matter of reordering things. But how?

Thanks, i made more progress on this today than in the last 3 weeks...

Avatar
UncleCheese

28 January 2012 at 9:40am 4085 Posts

Oh, i never said anything about making it look nice. You're your own for the CSS. :-)

--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

Avatar
wilsonStaff

28 January 2012 at 9:56am (Last edited: 28 January 2012 10:00am), Community Member, 142 Posts

Hi Uncle, its not about getting it nice :-) Its about not having the background images BEHIND the dates, not UNDER them.

Here is the reordered code:

<td class="$Today $OutOfMonth $CurrentDay $HasEvent">
   <% if Events %>
      <% control Events %>
         <a href="$Event.Link" title="{$Event.Title} {$Event.Conferencier}">$Number</a>
      <% end_control %>
   <% else %> <!-- i want dates that has no events not to be <a href> activated -->
      <a href="$ShowDayLink">$Number</a>
   <% end_if %>
</td>

And here what it gives me. The date ($Number) arent showing and the events that has NO EVENTS shouldnt be a <a href> activated.

But i do (my attempt)

$ShowDayLink or $Number

instead of this (your code)

<a href="$ShowDayLink">$Number</a>

it either shows no date at all or scrambled eggs...... :-)

Believe me , we are a bunch who wants to do that!

Merci beaucoup!

Attached Files
Avatar
wilsonStaff

28 January 2012 at 10:55am (Last edited: 28 January 2012 10:56am), Community Member, 142 Posts

OK, we are getting close.

Here is the code:

<td class="$Today $OutOfMonth $CurrentDay $HasEvent">
   <% if Events %>
      <% control Events %>
         <a href="$Event.Link" title="{$Event.Title} - {$Event.Conferencier}">$Number</a>
      <% end_control %>
   <% else %>
      <a href="" title="Pas d'évènements pour cette journée">$Number</a> <!-- MEANS NO EVENTS TODAY -->
   <% end_if %>
</td>

It gives me this.

PROBLEM : No numbering on dates that has events. Would like to.

Thanks!

Avatar
wilsonStaff

28 January 2012 at 11:38am (Last edited: 28 January 2012 12:09pm), Community Member, 142 Posts

Still struggling on this. Ive tried $Dates but it messes up other things.

Need to access that $Number again.

Thanks!

Go to Top