Post to database

I'm sure this must have been asked before.

1) Is there any way of posting to a database like MySQL?
2) Instead of uploading html to a site can we upload an XML file or csv file to an ftp area?

Either of these would help in integration with current websites.
Thanks

Hi,

that’s what we do. You can set it to FTP under the global settings. We’ve got a Joomla based website that looks for the incoming files and then presents them in a menu using the page title for the menu item.

···


Steve Vyse**Chairman, Royal Escape Committee

33 East Meadway, Shoreham-by-Sea, West Sussex BN43 5RF, Angleterre
Mobile +44 (0)7785 275 378
Skype stevevyse

www.royalescaperace.co.uk

On 4 Mar 2010, at 11:05, rsclass600 wrote:

I’m sure this must have been asked before.

  1. Is there any way of posting to a database like MySQL?
  2. Instead of uploading html to a site can we upload an XML file or csv file to an ftp area?

Either of these would help in integration with current websites.
Thanks

I'm sure this must have been asked before.

1) Is there any way of posting to a database like MySQL?

- Since no-one has answered straight =No. Not currently. There was some big discussions about making sailwave go web based etc a few months back. CJ will be able to confirm where that is headed. But for now there is no capability to put the data into SQL straight out. That may be no bad thing the datatable for an event is certainly not a single SQL table and XML is the sensible way to store it!

2) Instead of uploading html to a site can we upload an XML file or csv file to an ftp area?

You can do File / Save as XML but u'll need to manually FTP it.

Have to say this is a fairly sensible request. The work around would be to have a little script that looks for new XML files and ftp's them over for you (:slight_smile: ) If you are thinking of fiddling with XML a script may well be the least of your challenges. I've not played in XML before but have played with PHP, SQL and Joomla before. I can see a lot of attractions.

For those who've never looked at XML and XLST take a look here:
http://www.w3schools.com/Xml/tryxslt.asp?xmlfile=simple&xsltfile=simple

Then try exporting something like the RYA return example to xml.

For simplicity I then created a VERY simple file based on the example above which I called rya.xslt :
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<xsl:for-each select="sailwave-data/competitors/competitor">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold"><xsl:value-of select="compclass"/></span>
         - <xsl:value-of select="comprating"/>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="compsailno"/>
<span style="font-style:italic">
<xsl:value-of select="comphelmname"/> (Helm)
</span>
</div>
</xsl:for-each>
</body>
</html>

I then added one line to the XML file that was exported:
(after the first tag:
<?xml-stylesheet type="text/xsl" href="rya.xslt"?>

Then simply open the rya.xml file in firefox and you see formatted output...

I'm assuming the stylesheet could dynamically be inserted into the XML depending on the 'format' requested. But I'm certainly thinking this offers a fairly flexible option for CMS's to take this kind of data and allow the CMS to re-process what's being displayed at the request of the user (eg I guess it could allow re-sorting of data by rank, sail number, helm name etc - without having an html file for each uploaded - just by having the raw XML and some XSLT templates which could apply across multiple events...

The complexity may come in handling the results section which seems to be relational to the race and competitor sections... ..I don't know enough about XML to know if thats easy to do!
eg:

The XML looks like this:
<result comHandle="10" racHandle="2">
<rpos c="10" r="2">4</rpos>

Not sure if the plain XML/XLST can be used to do a for-each comhandle to get ComHandle 10's name and then on the same table row do a for each racHandle to get his <rpos> values... If not I guess you'd need to parse the XML using PHP and the populate the values... Sounds like additional work!

Publishing needs a revamp. the existing templates
just handle HTML.

Currently workign on extending them so they can do XML, CSV and become
javascript based so that esentially Sailwave just creates a load a
array statements at the start then you can use javascript to do
whatever you like. Also use some jquery to do prettier verions of what
is there. I agree it’s well past the need for refurbishment.

Colin

sailwave.com

Calum Polwart wrote:

···

http://www.w3schools.com/Xml/tryxslt.asp?xmlfile=simple&xsltfile=simple"http://www.w3.org/1999/XSL/Transform""http://www.w3.org/1999/xhtml"http://www.yachtsandyachting.com/http://www.sailing.org/http://www.sailwave.com/http://www.abyc.org/upload/Sailwave_ABYC_User_Guide_2009-08-21.pdfsailwave-digest@yahoogroups.comsailwave-unsubscribe@yahoogroups.comhttp://groups.yahoo.com/group/sailwave/http://groups.yahoo.com/group/sailwave/joinsailwave-digest@yahoogroups.comsailwave-fullfeatured@yahoogroups.comsailwave-unsubscribe@yahoogroups.comhttp://docs.yahoo.com/info/terms/www.avg.com

Colin Jenkins wrote:

Publishing needs a revamp. the existing templates just handle HTML.

Currently workign on extending them so they can do XML, CSV and become javascript based so that esentially Sailwave just creates a load a array statements at the start then you can use javascript to do whatever you like. Also use some jquery to do prettier verions of what is there. I agree it's well past the need for refurbishment.

Colin
sailwave.com

Hi Colin,

I'd never played before with XML but had a quick play per my post the other day. It does seem like it could do a lot of the work! Plus it leaves a lot of good options for file sahring in the future if sailwave can read the XML back in you get some of what was discussed earlier this year in terms of an online and offline solution.

BUT - I did notice that all the data would currently be there in the XML - that would include things like medical info? Some thought to data security is proabbly needed...

Calum

Calum Polwart wrote:

Not sure if the plain XML/XLST can be used to do a for-each comhandle to
get ComHandle 10's name and then on the same table row do a for each
racHandle to get his <rpos> values... If not I guess you'd need to
parse the XML using PHP and the populate the values... Sounds like
additional work!

For completeness heres a quick attempt at it. It cant do fleets (but that'd be easy enough to add) and I think to make it really functional you'd want to make things linkable so that you could say sort by class by clicking the class heading But the basic concept his here:

<?xml version="1.0" encoding="ISO-8859-1"?>

<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">

<table>
<th>Sail No</th> <th>Class</th> <th>Helm</th> <th>Rating</th>

<xsl:for-each select="sailwave-data/races/race">
<th> <xsl:value-of select="racedate"/> </th>
</xsl:for-each>
<th>Points</th>

<xsl:for-each select="sailwave-data/competitors/competitor">
<xsl:sort select="comprank" data-type="number" order="ascending"/>
<tr style="background-color:teal;color:white;padding:4px">

<td> <xsl:value-of select="compsailno"/> </td>
<td> <xsl:value-of select="compclass"/> </td>
<td> <xsl:value-of select="comphelmname"/> </td>
<td> <xsl:value-of select="comprating"/> </td>

<xsl:variable name="currentComp" select="@handle"/>

<xsl:for-each select="/sailwave-data/results/result[@comHandle=$currentComp]">
<td><center>
<xsl:if test="rdisc = 1"><xsl:text>(</xsl:text></xsl:if>
<xsl:value-of select="rpts" /> <xsl:text> </xsl:text> <xsl:value-of select="rcod" />
<xsl:if test="rdisc = 1"><xsl:text>)</xsl:text></xsl:if></center>
</td>
</xsl:for-each>

<td> <center> <em>
<xsl:value-of select="compnett"/>
</em> </center>
</td>
</tr>
</xsl:for-each>

</table>
</body>
</html>