+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
Coding Thread, Xibo birthday display - php or similar maybe? in Coding and Web Development; Hey - we're hoping someone out there who has much greater coding power than myself and my apprentice coder monkey ...
  1. #1

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,821
    Thank Post
    146
    Thanked 572 Times in 516 Posts
    Rep Power
    154

    Xibo birthday display - php or similar maybe?

    Hey - we're hoping someone out there who has much greater coding power than myself and my apprentice coder monkey can help!

    We use Xibo to display school notices, photos etc on our digital signage. All good there, just use Powerpoint for the bulk of the content. What we'd like to do though, is have a simple page which displays whose birthday it is today.

    This can be as simple as possible - I was thinking to just dump the birthdays from SIMS as a text or csv file which can be easily changed every year - then to have a bit of script in a webpage or similar which referenced this, looked at today's date, and outputted the names on the screen. Probably pretty straightforward, but my programming is limited to C64 basic and html - nothing further yet!

    Can anyone help, or do you have a similar system in place we could borrow (with application of appropriate virtual snack treat).

    Thanks!

  2. #2

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,821
    Thank Post
    146
    Thanked 572 Times in 516 Posts
    Rep Power
    154
    We've done this now as simply as we could. Dumped Forename, Surname and DOB from SIMS into a csv, whacked PHPMyAdmin on the Xibo Server (it's not on the internet) and imported the csv into the MySQL in a new database. Then some simple php calls the DB and searches for dd/mm from the DOB and matches it against today's date (NTP for the server will help, but just manually set it for now). The result is pretty good!

  3. #3

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,817
    Thank Post
    272
    Thanked 1,138 Times in 1,034 Posts
    Rep Power
    350
    If you design an HTML page that you want it to look like I'll knock up the php side for you

  4. #4

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,821
    Thank Post
    146
    Thanked 572 Times in 516 Posts
    Rep Power
    154
    Cheers, we've done it now though. The html was a massive cheat - the main Xibo display is a Powerpoint slideshow with a background made of different elements, we just print-screened it to a png, then set it to the background property for the webpage for consistency. Cheating, but works fine.

  5. #5

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,817
    Thank Post
    272
    Thanked 1,138 Times in 1,034 Posts
    Rep Power
    350
    Quote Originally Posted by 3s-gtech View Post
    Cheers, we've done it now though. The html was a massive cheat - the main Xibo display is a Powerpoint slideshow with a background made of different elements, we just print-screened it to a png, then set it to the background property for the webpage for consistency. Cheating, but works fine.
    Ah right I read i ignored the second post lol!

  6. #6
    BKGarry's Avatar
    Join Date
    Mar 2006
    Location
    Kent
    Posts
    930
    Thank Post
    94
    Thanked 120 Times in 97 Posts
    Rep Power
    47
    sorry to resurect this old post, but could you send me a copy of your PHP script? not too good with php and would like to do this too

  7. #7

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,821
    Thank Post
    146
    Thanked 572 Times in 516 Posts
    Rep Power
    154
    Send me a PM and I'll remember in the morning. Just remember to dump the csv of students and DoBs into MySQL via PHPMyAdmin or similar. I'll copy in the format used by the php if I can find it now!

  8. #8
    titch's Avatar
    Join Date
    Feb 2007
    Posts
    170
    Thank Post
    102
    Thanked 8 Times in 7 Posts
    Rep Power
    17
    Any chance of a step by step for this? Would love to get this going on our xibo but am unsure about the PHP and msql etc. Cheers in advance. Rich

  9. #9

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,821
    Thank Post
    146
    Thanked 572 Times in 516 Posts
    Rep Power
    154
    The MySQL is a simple DB (called birthdays) imported into PHPMyAdmin from a csv file dumped from SIMS using Forename, Surname and DoB (dd/mm/yyyy). The server needs to be running Apache, MySQL and PHP. The PHP itself is fairly simple:

    Code:
    <?php
    
    include('config.php');
    
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
    	margin-left: 0px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-bottom: 0px;
    	background-image: url(Background.png);
    	background-repeat: no-repeat;
    }
    body,td,th {
    	font-family: "Segoe UI Light";
    	color: #000;
    	font-size: large;
    }
    </style>
    </head>
    
    <body>
    <p><br />
    </p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p><br />
      <br />
    </p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="5%" height="303">&nbsp;</td>
        <td width="62%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="265" valign="top"><h1>
            <br />
            <?php
    		
    		$myDate = date('d/m');
    
    	$badgesql = mysql_query("SELECT * FROM birthdays.students WHERE `Date` LIKE '%$myDate%'"); // birthdays is the DB, the table is called students - you can change these
        $badgecheck = mysql_num_rows($badgesql);
        $check = $badgecheck;
        if($check==0)
    	echo('No birthday\'s today!');
        else
        if($badgecheck!=0)
        {
        while($badge = mysql_fetch_array($badgesql))
        {
    	
    echo(''.$badge[Firstname].' '.$badge[Surname].'<br>');
    
           }
        }
    This reads from a config.php in the same folder.

    Code:
    <?
    $host = "localhost"; // if the database is locally installed
    $dbuser = "username";
    $dbpwd = "password";
    $db = "birthdays"; // this is the database name
    $connect = mysql_pconnect($host, $dbuser, $dbpwd);
    if(!$connect)
    echo("Could not connect to database...");
    else
    $select = mysql_select_db($db);
    ?>

  10. #10
    titch's Avatar
    Join Date
    Feb 2007
    Posts
    170
    Thank Post
    102
    Thanked 8 Times in 7 Posts
    Rep Power
    17
    Thank you thats great. Let you know if I get it up and running.

  11. #11
    titch's Avatar
    Join Date
    Feb 2007
    Posts
    170
    Thank Post
    102
    Thanked 8 Times in 7 Posts
    Rep Power
    17
    Thanks for the help. I have gone a slightly different route though and modified a script I found on the net. You can just add it into an embedded region on xibo. I have an excel spreadsheet that will convert usernames birthdays into the correct format so they can just be copied into the script. One thing to note is that names cant have symbols in them as it throws an error. I am sure this script could be tidied up but I am no script master, and it works so have left it at that.

    <html>
    <head>
    <FONT SIZE=9>
    <body>
    <h1 style="font-family:verdana;"><title></title>
    </head>
    <body>

    <center>
    <script language="JavaScript">

    var arrBday = [
    ['Joe Blogs Class4','09/28/2001'],
    ['Michael Ball Class4','09/28/2001'],
    ['Donald Duck Class6','01/22/2004']
    ];

    function displayBdayList(today){
    var bday,strList='';
    for (var i=0;i<arrBday.length;i++){
    bday = new Date(arrBday[i][1]);
    if (!isNaN(bday) && bday.getMonth()==today.getMonth() && bday.getDate()==today.getDate())
    strList+='- '+arrBday[i][0]+" ("+(today.getFullYear()-bday.getFullYear())+")<br>";
    }
    if (strList=='') strList='- NONE'
    document.write("<h4>Today's Birtdays:</h4>"+strList)
    }

    displayBdayList(new Date());
    </script> <p>
    ??</p></h1>



    </body>
    </html>

  12. #12
    titch's Avatar
    Join Date
    Feb 2007
    Posts
    170
    Thank Post
    102
    Thanked 8 Times in 7 Posts
    Rep Power
    17
    Actually can anyone help with my script. Whatever I do the text size doesn't seem to increase. What am I doing wrong? Cheers

  13. #13

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,821
    Thank Post
    146
    Thanked 572 Times in 516 Posts
    Rep Power
    154
    You'll need:

    Code:
    <html>
    <head>
    <title></title>
    <style type="text/css">
    #text {
    font-family: Arial;
    font-size: 14px;
    }
    </style>
    </head>
    <body>
    
    <script language="JavaScript">
    
    var arrBday = [
    ['Joe Blogs Class4','09/28/2001'],
    ['Michael Ball Class4','09/28/2001'],
    ['Donald Duck Class6','01/22/2004']
    ];
    
    function displayBdayList(today){
    var bday,strList='';
    for (var i=0;i<arrBday.length;i++){
    bday = new Date(arrBday[i][1]);
    if (!isNaN(bday) && bday.getMonth()==today.getMonth() && bday.getDate()==today.getDate())
    strList+='- '+arrBday[i][0]+" ("+(today.getFullYear()-bday.getFullYear())+")<br>";
    }
    if (strList=='') strList='- NONE'
    document.write("<div id="text"><h4>Today's Birthdays:</h4></div>"+strList)
    }
    
    displayBdayList(new Date());
    </script> 
    
    </body>
    </html>
    To change the formatting, change the code in the css in the head of the page.

  14. Thanks to 3s-gtech from:

    titch (10th October 2012)

  15. #14
    titch's Avatar
    Join Date
    Feb 2007
    Posts
    170
    Thank Post
    102
    Thanked 8 Times in 7 Posts
    Rep Power
    17
    Thanks for that. Doesnt seem to have worked though. Not sure what I am doing wrong or if it is something to do with xibo. Any chance anyone can test it on another xibo install? TA

  16. #15

    Join Date
    Feb 2013
    Location
    Chippenham
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Im having a little problem trying to get this to work, I've created a database in Phpmyadmin called Birthdays.students with a table of three fields, Forname, Surname and Dob. I then add the code above into an emded page in xibo. I think this might be where i'm going wrong. Do I need to create a .php or put said code into xibo? Also where should i put config.php


    I feel like I'm nearly there!


    Thanks for all the help above!

    Update: Seems i've got config.php to connect to the database! but i get this error when viewing .birthday.php

    "
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\Birthdays.php on line 49
    No birthday's today!"


    Last edited by cleverleyson; 1st March 2013 at 10:23 AM.

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. LAN VoIP or similar
    By Samson in forum Wireless Networks
    Replies: 5
    Last Post: 20th June 2007, 10:02 AM
  2. Replies: 1
    Last Post: 8th June 2007, 08:43 PM
  3. PHP or ASP.NET
    By plugged_in in forum Web Development
    Replies: 38
    Last Post: 8th March 2007, 11:08 AM
  4. PHP or JavaScript password obfuscator
    By ajbritton in forum Web Development
    Replies: 2
    Last Post: 18th October 2006, 08:30 AM
  5. Replies: 11
    Last Post: 3rd February 2006, 12:29 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •