Hi

I am trying to read XML files (invoices) from a directory and display them to the visitor. Each XML file contains several invoices. The visitor then clicks on the XML file (invoices). My PHP snippet should open the xml file and locate the appropriate invoice and display the content.


I have managed to list the directory contents using the following PHP snippet. The function call below DisplayBill($MemberId, $FileName, $StyleSheet) should take the memberid (login), the xml file name which has been clicked and the stylesheet to be used.

I now have the following doubts for which I need clarifications

Architecturally is it necessary the DisplayBill should be a seperate php file or can it exist as a function in the same file as the code below?

Should the Invoices be displayed as a web form for me to capture the user click to retrieve the appropriate file and invoice so that I can display it to the user.

I intend to parse the XML file using XPath (at this stage I am not sure if php supports Xpath and XQuery!)

Any help would be appreciated

Best regards

Sridhar

-----------------------------------------------------------------------------

<?php
$BillLocation = "/home/cmi/Integration/xml_files";
$StyleSheet = "Bill.xsl";
$DirHandle = opendir($BillLocation);
echo "<table border=\"1\">";
echo "<tr>";
While (($FileName = readdir($DirHandle)) !== false)
{
        if ($FileName != "." && $FileName != "..")
        {
                if (strpos($FileName, "xml") !== false)
                {
                        $BillYear = substr($FileName, 0, 4);
                        $BillMonth = substr($FileName, 5, 2);
                        switch ($BillMonth)
                        {
                                case "01":
                                        $BillMonth = "January";
                                        break;
                                case "02":
                                        $BillMonth = "February";
                                        break;
                                case "03":
                                        $BillMonth = "March";
                                        break;
                                case "04":
                                        $BillMonth = "April";
                                        break;
                                case "05":
                                        $BillMonth = "May";
                                        break;
                                case "06":
                                        $BillMonth = "June";
                                        break;
                                case "07":
                                        $BillMonth = "July";
                                        break;
                                case "08":
                                        $BillMonth = "August";
                                        break;
                                case "09":
                                        $BillMonth = "September";
                                        break;
                                case "10":
                                        $BillMonth = "October";
                                        break;
                                case "11":
                                        $BillMonth = "November";
                                        break;
                                case "12":
                                        $BillMonth = "December";
                                        break;
                        }
echo "<td>" . "<a href='$FileName'>$BillMonth" . " " . "$BillYear</a>" . "</td>" . "\n";
                        echo "</tr>";
                        
                }
        }
}
echo "</table>";
closedir($DirHandle);

$result = DisplayBill($MemberId, $FileName, $StyleSheet);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to