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   1397 Views

Avatar
wilsonStaff

Community Member, 142 Posts

13 January 2012 at 6:32am

Edited: 27/01/2012 12:02pm

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

Community Member, 142 Posts

27 January 2012 at 11:57am

Bump to the top....

Avatar
UncleCheese

Forum Moderator, 4096 Posts

28 January 2012 at 8:33am

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

Community Member, 142 Posts

28 January 2012 at 9:19am

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

Forum Moderator, 4096 Posts

28 January 2012 at 9:40am

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

Community Member, 142 Posts

28 January 2012 at 9:56am

Edited: 28/01/2012 10:00am

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

Community Member, 142 Posts

28 January 2012 at 10:55am

Edited: 28/01/2012 10:56am

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

Community Member, 142 Posts

28 January 2012 at 11:38am

Edited: 28/01/2012 12:09pm

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

Need to access that $Number again.

Thanks!

Go to Top