[PHP] Re: mySQL Results To XML -- my xmltag() functions
posted mailed mike wrote: I made this at one point: function array2xml($array, $complete = true) { $xml = $array[NODE] ; unset($array['NODE']); ksort($array); foreach(array_keys($array) as $key) { $xml .= $key=\$array[$key]\ ; } if($complete) { $xml .= /; } $xml .= ; return $xml; } What about the reverse - converting the XML back to MySQL? (I'm interested for an address book project, but don't know too much of XML or mySQL!) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar booking form in PHP/MySQL
I'm looking for a PHP/MySQL calendar booking form, which I am sure must have been done a million times. This will show a calendar on the web mirroring a MySQL table. Each entry in the MySQL table will show two dates, Start and End. The dates between these should be shown in red on the calendar. Any pointers or scipts or suggestions gratefully received. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Address book - LDAP or MySQL?
I'm thinking of setting up an address-book on my server, but I'm not sure whether to use LDAP or MySQL. As I see it, LDAP is actually designed for this, and seems to have a more-or-less standard address-book format. On the other hand, I'm already using MySQL for several things, eg gallery2. But there doesn't seem to be any standard address-book format for SQL. Another thing, kmail and other mail clients seem to have standard LDAP interfaces. I'm using phpMyAdmin with MySQL, but there seems to be a PHP interface to LDAP too. I don't really like LDAP, but it seems the way to go. Is that right ... ? I'd be interested to hear your views. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Address book - LDAP or MySQL?
Jay Blanchard wrote: I'm thinking of setting up an address-book on my server, but I'm not sure whether to use LDAP or MySQL. First of all LDAP is not a database, it is a connection protocol that can connect to many things, most notably Active Directory seems to be the most popular usage. Therefore you cannot compare it to MySQL, because MySQL is a database product. Are you talking about Active Directory being the database? As I understand it, LDAP and MySQL offer two different ways of setting up a networked address book. So I take it they can be compared as far as that is concerned. Actually, I normally run Linux, so Active Directory would not be a priority for me. I didn't say LDAP was a database. However, the principal usage of LDAP, as far as I can see (by googling for LDAP) is in fact to set up a network address book of some kind. It may be used for other purposes, but they are not really relevant to my enquiry. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Booking form, please
I'm looking for a form to allow people to book an hour on a computer system. Is there a standard PHP program for this? Or can you point me to such a program, please? -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Standard Address Book?
Is there any kind of standard for a PHP/SQL/XML addressbook? -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Standard Address Book?
Jim Lucas wrote: Is there any kind of standard for a PHP/SQL/XML addressbook? Are you asking if there is any type of standard for building an address book in general? That you are using PHP/SQL/XML is your preference. With a few clicks from Google, I found these: http://groupware.openoffice.org/ab_schema/index.html http://developer.apple.com/documentation/AppleApplications/Reference/SyncServicesSchemaRef/Articles/Contacts.html Thanks, those are useful suggestions. As is probably clear, I was thinking of setting up an address book for my own use, using a PHP/XML format, and I just wondered if there was any kind of agreed standard in this area. vCards and Jabber seem to be alternative approaches; but as far as I can see no format has won general approval, which I find rather surprising. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
Just showing my ignorance, probably, but what exactly is meant by a PHP editor? Does it mean an editor for editing PHP scripts, or an editor written in PHP? -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP editor
On Fri 13 Apr 2007, Jay Blanchard wrote: [snip] Just showing my ignorance, probably, but what exactly is meant by a PHP editor? Does it mean an editor for editing PHP scripts, or an editor written in PHP? [/snip] Something to edit PHP with...unless you're trying to be funny I wasn't trying to be funny - I'm not very knowledgeable about PHP, but it doesn't seem to me its syntax is sufficiently complicated to warrant using a special editor. I'm interested (slightly) in any editors written in PHP, as I use WordPress (WP), and am not particularly enamoured of any of the WP editors I have seen. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple question on simplexml
Haydar TUNA wrote: You can use following example:) ?php $xml = simplexml_load_file(test.xml); $xml-body[0]-addChild(book, Atat�rk The Rebirth Of A Nation); ? This doesn't work. It allows to add a child with some text, as in your example. But it doesn't allow you to add a tree, ie a node with sub-nodes, which is what I was looking for. If it does, could you give an example where eg the item to add is book authorSmith, J/author titlePHP for dummies/title publisherOUP/publisher /book I have a catalog in XML format: ?xml version=1.0 encoding=iso-8859-1 ? catalog book ... book book ... book ... /catalog Now I want to add another book, which I have as a SimpleXMLElement: $book = new SimpleXMLElement($string); where $string reads book ... book Can I add this new entry to the catalog using SimpleXML functions, or do I have to introduce a DOMDocument? As may be obvious, I am very new to PHP programming; and advice or suggestions gratefully received. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simple question on simplexml
Jochem Maas wrote: there is this: http://php.net/manual/en/function.simplexml-element-addChild.php which will allow adding of string data (so you won't be needing to create the new SimpleXMLElement object as per your example below). obviously you will have to first load tghe complete xml document into simplexml using one of the following: http://php.net/manual/en/function.simplexml-load-file.php http://php.net/manual/en/function.simplexml-load-string.php I tried this, with several variations, and I have come to the conclusion that it is impossible to add a tree to a node as I asked using only simplexml functions. If you have such a solution, I would love to see it. If you would like an example, I might want to add the item: book authorSmith, J/author titlePHP for dummies/title publisherOUP/publisher /book My solution, for what it is worth, is something like - $docA = new DOMDocument; $docB = new DOMDocument; $docB-loadXML($book); $xpath = new DOMXPath($docB); $nodes = $xpath-query('//catalog/book'); foreach($nodes as $n) { $new = $docA-importNode($n, true); $docA-documentElement-appendChild($new); } $output = $docA-save(/tmp/catalog.xml); - Timothy Murphy wrote: I have a catalog in XML format: ?xml version=1.0 encoding=iso-8859-1 ? catalog book ... book book ... book ... /catalog Now I want to add another book, which I have as a SimpleXMLElement: $book = new SimpleXMLElement($string); where $string reads book ... book Can I add this new entry to the catalog using SimpleXML functions, or do I have to introduce a DOMDocument? -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple question on simplexml
I have a catalog in XML format: ?xml version=1.0 encoding=iso-8859-1 ? catalog book ... book book ... book ... /catalog Now I want to add another book, which I have as a SimpleXMLElement: $book = new SimpleXMLElement($string); where $string reads book ... book Can I add this new entry to the catalog using SimpleXML functions, or do I have to introduce a DOMDocument? As may be obvious, I am very new to PHP programming; and advice or suggestions gratefully received. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP textbook suggestions?
Chris Lott wrote: Looking for suggestions for a PHP textbook for an Intro to Web Programming class that will be using PHP5 and MySQL. This is a first-semester course, so no programming experience required. It would be nice to have a text that adhered to (what I see as) good practice using quotation marks... i.e. print 'The cost is ' . $cost; NOT print The cost is $cost; AND CERTAINLY NOT print (The cost is $cost); echo substr('abcdef', 1); NOT echo substr(abcdef, 1); I will be teaching, so a book that a student can-- before the class-- work through and understand is good-- doesn't have to be a traditional textbook! But it shouldn't be a reference manual either. Why do you think these are good/bad, as a matter of interest? -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Example from www.php.net
I was trying Example 2147, which reads: --- ?php $string = XML a xmlns:b foo name=one game=lonely1/foo /a XML; $xml = simplexml_load_string($string); foreach($xml-foo[0]-attributes() as $a = $b) { echo $a,'=',$b,\\n; } ? --- It says that 'The above example will output: name=one game=lonely' However, in my case it outputs nothing. (I'm running php-5.1.6 under Fedora-6.) Is there an error in the example; or is the error mine? -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Example from www.php.net
Timothy Murphy wrote: I was trying Example 2147, which reads: --- ?php $string = XML a xmlns:b foo name=one game=lonely1/foo /a XML; $xml = simplexml_load_string($string); foreach($xml-foo[0]-attributes() as $a = $b) { echo $a,'=',$b,\\n; } ? --- ... However, in my case it outputs nothing. (I'm running php-5.1.6 under Fedora-6.) I see that the example does work if I substitute a for a xmlns:b. [I'm not sure what effect the xmlns:b has?] -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with XSLT importStyleSheet
I've been trying to use PHP/XSLT on my desktop, running Fedora-6 Linux (with all current updates). The function importStyleSheet() seems to cause a Segmentation Violation, as eg in the following script from http://ie2.php.net/manual/en/function.xsl-xsltprocessor-construct.php // Example 2520. Creating an XSLTProcessor ?php $doc = new DOMDocument(); $xsl = new XSLTProcessor(); $doc-load($xsl_filename); $xsl-importStyleSheet($doc); $doc-load($xml_filename); echo $xsl-transformToXML($doc); ? [EMAIL PROTECTED] Test]# php ex2520.php // Example 2520. Creating an XSLTProcessor Segmentation fault Or this script from http://www.phpbuilder.com/manual/en/function.xsl-xsltprocessor-transform-to-xml.php ?php $xsl = new DOMDocument('1.0','UTF-8'); $xml = new DOMDocument('1.0','UTF-8'); $xml-loadXML('collection.xml'); $xsl-loadXML('collection.xsl'); $xsl-documentURI = 'collection.xsl'; $xslProc = new XSLTProcessor(); $xslProc-importStyleSheet($xsl); ? [EMAIL PROTECTED] Test]# php test29.php Segmentation fault I'd be very grateful if someone could check if these scripts work for you, so I can see if it is a problem with Fedora PHP, or with PHP itself, (or if I am doing something silly, which is quite probable). -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with XSLT importStyleSheet
posted mailed Tijnema ! wrote: I've been trying to use PHP/XSLT on my desktop, running Fedora-6 Linux (with all current updates). The function importStyleSheet() seems to cause a Segmentation Violation, Thanks for your response. I have no problem with testing, i'm running home-made linux system with PHP5 PHP6 (Apache). Also running PHP5 under windows (Apache). Just need an example XSL/XML file to test:) Could you send one? (Off-list maybe because attachments are giving trouble sometimes on this list) Actually, the first example I gave comes from what I assume is the official PHP manual at http://ie.php.net/xsl%22%3E. There are 3 files, collection.xml, collection.xsl and the actual PHP script, Example 2526 (which I call ex2526.php), from http://ie.php.net/manual/en/function.xsl-xsltprocessor-transform-to-xml.php All 3 files are very short, so I give them here: collection cd titleFight for your mind/title artistBen Harper/artist year1995/year /cd cd titleElectric Ladyland/title artistJimi Hendrix/artist year1997/year /cd /collection xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xsl:param name=owner select=Nicolas Eliaszewicz'/ xsl:output method=html encoding=iso-8859-1 indent=no/ xsl:template match=collection Hey! Welcome to xsl:value-of select=$owner/'s sweet CD collection! xsl:apply-templates/ /xsl:template xsl:template match=cd h1xsl:value-of select=title//h1 h2by xsl:value-of select=artist/ - xsl:value-of select=year//h2 hr / /xsl:template /xsl:stylesheet ?php // Load the XML source $xml = new DOMDocument; $xml-load('collection.xml'); $xsl = new DOMDocument; $xsl-load('collection.xsl'); // Configure the transformer $proc = new XSLTProcessor; $proc-importStyleSheet($xsl); // attach the xsl rules echo $proc-transformToXML($xml); ? Now I get [EMAIL PROTECTED] Test]# php ex2526.php Segmentation fault I tried a few other examples, but all those with importStyleSheet() in them caused the same Segmentation fault. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP newbie question on xslt
Miguel J. Jiménez wrote: // Example 2520. Creating an XSLTProcessor ?php $xml_filename = collection.xml; $xsl_filename= collection.xsl; $doc = new DOMDocument(); $xsl = new XSLTProcessor(); $doc-load($xsl_filename); $xsl-importStyleSheet($doc); $doc-load($xml_filename); echo $xsl-transformToXML($doc); ? (where I have added the two filenames, and copied the files collection.x?l from the manual). When I run PHP I get: [EMAIL PROTECTED] Test]# php ex2520.php // Example 2520. Creating an XSLTProcessor Segmentation fault I'm running the program under Fedora-6 Linux with the latest versions of all programs. Is there something I should have included, to get the program to run? Any advice or suggestions gratefully received. Try not to load both xml and xsl in the same $doc variable... use one for the xsl and another for the xml. I think you are destroying the dom for the xsl before the transform... Thanks for the response. I'm sure you are right. However, I wasn't trying anything really - I just copied (electronically) Example 2520 from http://www.php.net/manual/en/function.xsl-xsltprocessor-construct.php and ran it. Is there in fact some confusion in this manual between different versions of PHP, or at least of PHP/XSLT? I notice that I get the same (bad) result if I run - // Example 2526. Transforming to a string ?php // Load the XML source $xml = new DOMDocument; $xml-load('collection.xml'); $xsl = new DOMDocument; $xsl-load('collection.xsl'); // Configure the transformer $proc = new XSLTProcessor; $proc-importStyleSheet($xsl); // attach the xsl rules echo $proc-transformToXML($xml); ? - from http://www.php.net/manual/en/function.xsl-xsltprocessor-transform-to-xml.php - [EMAIL PROTECTED] Test]# php ex2526.php // Example 2526. Transforming to a string Segmentation fault - Is there any way of debugging a PHP program like this? (I tried running strace php ex2526.php but this didn't enlighten me.) -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP newbie question on xslt
I've been trying some of the programs in the PHP manual at http://www.php.net/manual/en/ in chapters CLXXXI and CLXXXII to work, for example // Example 2519. Creating an XSLTProcessor ?php $xml_filename = collection.xml; $xsl_filename= collection.xsl; $doc = new DOMDocument(); $xsl = new XSLTProcessor(); $doc-load($xsl_filename); $xsl-importStyleSheet($doc); $doc-load($xml_filename); echo $xsl-transformToXML($doc); ? (where I have added the two filenames, and copied the files collection.x?l from the manual). When I run PHP I get: [EMAIL PROTECTED] Test]# php ex2519.php // Example 2519. Creating an XSLTProcessor Segmentation fault I'm running the program under Fedora-6 Linux with the latest versions of all programs. Is there something I should have included, to get the program to run? Any advice or suggestions gratefully received. -- Timothy Murphy e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie tel: +353-86-2336090, +353-1-2842366 s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php