[solved] growl

here you will find only solved 1.1 Help topics

Moderator: 1.1 Moderators

[solved] growl

Postby soddengecko on Fri Oct 03, 2008 4:20 am

Hi All

I am having some trouble modifying a growl script. I have searched the net and this forum as we ll as many others and have come up with nothing so far.

so far the growl works as standard, click a link with the correct properties and a growl window pops up. This is all set up and working nicely. What I have so far is this:

I have set up an event calendar, beneath it is a list of all events for today and tomorrow with a clickable link that opens a growl containing the info for that particular event. This works fine. I am using the mootools 1.11 for compatibility with my other code that is not on v1.2 yet.

what I would like to do:
I would like to have the growl set to execute when the page loads if there are events for the day then repeat every 30 minutes until the event time/day has passed. if no events, no execution (this will be dealt with on the php side) my problem is, how do i get this function to execute on page load instead of listening for a click?

The growl is from here - http://icebeat.bitacoras.com/mootools/growl/
the function i have is thus
  1.     <?php
  2.     echo "<ul>\n";
  3.     $today = date("Y-m-d");
  4.     $sql = "SELECT num, heading, body, DATE_FORMAT(date, '%Y-%m-%d') AS eventdate, DATE_FORMAT(date, '%H:%i') AS eventtime FROM ex_events WHERE DATE_FORMAT(date, '%Y-%m-%d') = '$today' ORDER BY num";
  5.     $result = mysql_query($sql) or die('nope, not working');
  6.     while ($row = mysql_fetch_assoc($result)){
  7.     $eventdate = $row["eventdate"];
  8.     $eventtime = $row["eventtime"];
  9.     $event_title = $row["heading"];
  10.     $event_body = $row["body"];
  11.     $event_number = $row["num"];
  12.     echo "<li><a id=\"smoke$event_number\" title=\"Appointment Notification\" href=\"#\">$event_title</a></li>\n";
  13.     ?>
  14.     <script type=text/javascript charset=utf-8>
  15.     $('smoke<?php echo "$event_number" ?>').onclick = function() {
  16.     Growl.Smoke({
  17.     title: '<?php echo "$event_title @ $eventtime"; ?>',
  18.     text:  '<?php echo "<p>$event_body</p>"; ?>',
  19.     image: 'images/growl.jpg',
  20.     duration: 10
  21.     });
  22.     return false;
  23.     };
  24.     </script>
  25.     <?php
  26.     }
  27.     echo "\n</ul>\n\n";
  28.     ?>


as you can see it is listening for an onclick event and i need to change this. I am new to JS and mootools so please bear with me. any and all help appreciated

TIA
Mark
Last edited by soddengecko on Sun Oct 05, 2008 5:42 am, edited 2 times in total.
soddengecko
 
Posts: 6
Joined: Fri Oct 03, 2008 4:08 am

Re: growl

Postby soddengecko on Sun Oct 05, 2008 2:01 am

Hi all

I have managed to get the page load script working with this:

  1. <script type=text/javascript charset=utf-8>
  2.     window.addEvent('load', function () {
  3.     $('smoke<?php echo "$event_number" ?>'){
  4.     Growl.Smoke({
  5.     title: '<?php echo "$event_title @ $eventtime"; ?>',
  6.     text:  '<a href="javascript&#058;navigate('','','<?php echo $eventdate ?>')">Read More</a>',
  7.     image: 'images/growl.jpg',
  8.     duration: 10
  9.     });
  10.     return false;
  11.     };
  12.     });
  13.     </script>


works just as I want it to. I still need to work on the periodical update of the div in question. I will post that once I have worked it out.

any pointers would be great
soddengecko
 
Posts: 6
Joined: Fri Oct 03, 2008 4:08 am

[solved] growl auto notifications

Postby soddengecko on Sun Oct 05, 2008 5:39 am

this has now been solved

below is the code i used to get the growl to show up every 15 minutes for 20 seconds


  1. <script type=text/javascript charset=utf-8>
  2.     var NotiFy<?php echo "$event_number" ?> = function(){
  3.     $('smoke<?php echo "$event_number" ?>');{
  4.     Growl.Smoke({
  5.     title: '<?php echo "$event_title @ $eventtime"; ?>',
  6.     text:  '<a href="javascript&#058;navigate('','','<?php echo $eventdate ?>')">Read More</a>',
  7.     image: 'images/growl.jpg',
  8.     duration: 20
  9.     });
  10.     return false;
  11.     };
  12.     };
  13.     </script>
  14.    
  15.     <script type="text/javascript">
  16.     window.addEvent('domready', function() {
  17.     var periodicalFunctionVar = NotiFy<?php echo "$event_number" ?>.periodical(900000);
  18.     });
  19.     </script>
soddengecko
 
Posts: 6
Joined: Fri Oct 03, 2008 4:08 am


Return to Solutions

Who is online

Users browsing this forum: No registered users and 1 guest