WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this Article to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES SUBMIT AN ARTICLE PRINT
Title : Data, its presentation and user interface forms
Categories : PHP, XML, User Interface
Dmitry Sheiko
Dmitry Sheiko
Date : 2005-03-25
Grade : 0 of 5 (graded 0 times)
Viewed : 4754
Search : More Articles by Dmitry Sheiko
Action : Grade This Article
Tools : My Favotite Articles


  Submit your own code examples 
 


XML has acquired a distinguished popularity lately. No one doubts its perspectives of overall use. The concept of semantic web is no longer an abstraction and is implemented into life with confidence. In the world net’s information cacophony there appears harmony. In the hands of talented conductors such as W3C, ISO, OASISî it can diversify into a symphony.

Today XML family has so many standards available that it seems there should be quite enough for all possible aspects of information technology world. It is generally so. But let’s see how XML era has influenced ordinary web development tasks.

To deliver information to a user a site is needed. Web site content should be managed and that involves separation data from its presentation. The task is still often solved with the help of templates in program technologies. Though now we have XSLT technology at our disposal. Any document can be represented with data that is structured in detail with the help of XSL. It is quite enough to report the corresponding XSL template to define a proper graphic presentation for the data. XSL language is polymorphous and permits high flexibility in format changes of documents.
This might seem to be St.Grail of web development — we add XSL tools to our arsenal and shorten the time of the project development thus raising its quality.

However if we analyze time spent at creating a web project, it turns out that programming of user interfaces takes the most time. It is one thing to fill in the information, to deliver it to the user, and it is another thing to reconstruct multifunctional and easy to navigate interface. The tendency of content volume growth in the Internet is also worth mentioning here which makes effectiveness of user interfaces even more important.

XSL technology gives opportunities for managing document’s presentation theoretically with any form of user interface. With its help the state of user interface can be analyzed and algorithms for data presentation be created depending on the conditions. But XSL operates XML data and it is necessary to prepare corresponding XML data file to assign an ordinary navigation menu in XSL.

In practice it turns out that XSLT template layers contain a mixture of user interface forms and presentation algorithms. Moreover the logics of user interface database forming is duplicated in CMS program code. How to avoid unnecessary program coding? How to achieve more visual presentation for user interface form algorithms?

In October 2004 Red Graphic Systems company published XML Sapiens specification. This technology aspires to take the place of a layer between XML and XSL. When XML Sapiens processor meets a link to a file with user interface forms’ script, initial XML file is broaden with appropriate data. Let’s suppose we want to form a vertical site menu page. We will need to create a script file (interface.sapi) and to describe a user interface form in it (DDC menu). We indicate that under any environment conditions we want to have reflection of the whole menu content. Using sapi:for-each construction, we can request any necessary data from CMS system function.

Then we manage enumeration of the data. We specify what exactly and in what cases should be returned within enumeration process. To send data dynamically formed by script to the initial XML-file we only need to arrange pointers. That means that after script file interface.sapi analysis XML Sapiens processor will broaden initial XML data file to the extent that is necessary for the following XSLT transformation.

Initial XML


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='template.xsl'?>
<?xml-sapi type='text/xml' href='interface.sapi'?>
<content xmlns:sapi="http://www.xmlsapiens.org/spec/sapi.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
<data1>data1</data1>
<data2>data2</data2>
<menu><sapi:apply name="ddc.menu.value" /></menu>
<title><sapi:apply name="qc.title.value"></title>
<publication><sapi:apply name="qc.publication.value"></publication>
</content>


XML Sapiens file script interface.sapi


<?xml version="1.0" encoding="UTF-8"?>
<sapi version="1.0" xmlns:sapi="http://www.xmlsapiens.org/spec/sapi.dtd">
<sapi:ddc name="menu">
<sapi:choose>
<sapi:when exp="TRUE">
<sapi:for-each select="get_tree()">
<sapi:choose>
<sapi:when exp="TRUE">
<sapi:code>
<row sapi:id="this.this.id.value" sapi:activity="this.this.currentpage.value">
<link><sapi:apply name="this.this.href.value" /></link>
<item><sapi:apply name="this.this.title.value" /></item>
</row>
</sapi:code>
</sapi:when>
</sapi:choose>
</sapi:for-each>
</sapi:when>
</sapi:choose>
</sapi:ddc>
</sapi>




XML Sapiens script algorithm (interface.sapi)




Final XML


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='template.xsl'?>
<content xmlns:sapi="http://www.xmlsapiens.org/spec/sapi.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
<data1>data1</data1>
<data2>data2</data2>
<menu>
<row id="01" activity="1">
<link>/intro/</link>
<item>Introduction</item>
</row>
<row id="02" activity="0">
<link>/chapter1/</link>
<item>Chapter 1</item>
</row>
<row id="03" activity="0">
<link>/chapter2/</link>
<item>Chapter 2</item>
</row>
</menu>
<title><![CDATA[Introduction]]></title>
<publication><![CDATA[<p>Content</p>]]></publication>
</content>


It should be admitted that transfer of CMS instructions and receiving of the requested data from the script directly make web development process much easier. Such approach gives opportunity to disengage from the system language programming. Taking this into consideration the document content to be administered can be requested from CMS in XML Sapiens script directly. You just place the corresponding markers in the initial XML.

Displayed document formation chart




It is hard to predict XML Sapiens’ perspectives now. Unlike above-mentioned XSL, it is not an approved W3C standard. Though the tasks covered by XML Sapiens specification such as separation of user interface form algorithms from data presentation, clearness and availability of algorithms descriptions, are quite up to date. This project might attract the attention of developers’ community. That could result in appearance of new technologies able to increase the quality and profitability in web development.


Linked resources:
Extensible Markup Language (XML) 1.0 (Second Edition). W3C recommendation. October 6, 2000. http://www.w3c.org/TR/2000/REC-xml-20001006
Extesible Stylesheet Language (XL). Version 1.0. W3C Working Draft. October 18, 2000. http://www.w3c.org/TR/2000/WD-xsl-20001018
XML Sapiens Specification : http://www.xmlsapiens.org
SAPIPROCESSOR - is a compact toolkit for processing of documents using XML Sapiens: http://sapiprocessor.sourceforge.net/
Open Source CMS based on XML Sapiens: http://sapid.sourceforge.net









Building XML Web Services with PHP NuSOAP
Categories : PHP, NuSOAP, XML
PHP 101 Part 11 of 15 : Sinfully Simple
Categories : PHP, SimpleXML, XML
Serializing XML With PHP
Categories : PHP, XML, Serialize
Parsing XML With DOMXML And PHP
Categories : XML, PHP
More PHP, XML and XSL for Wireless Content
Categories : PHP, XML, XSL, Wireless
Building a Generic RSS Class With PHP
Categories : PHP, XML, Rich Site Summary (RSS), PHP Classes
Injecting XML Content Into Page Templates With patXMLRenderer (part 1)
Categories : PHP, XML, Templates
Build Your Own KlipFolio Klip With PHP
Categories : XML, Content Management, PHP
Building XML Trees with PEAR's XML_Tree Class
Categories : PHP, Pear, XML
Converting XML Into a PHP Data Structure
Categories : PHP, XML
Working with Dates and Times in PHP
Categories : PHP, Date Time
10 PHP Functions I Bet You Didn't Know About!
Categories : PHP, PHP Functions, Filesystem, Arrays, Errors and Logging
Date Arithmetic With MySQL
Categories : PHP, Databases, MySQL, Date Time
Using the .NET Assembly in PHP
Categories : PHP, .NET
PHP 101 Part 8 of 15 : Databases and Other Animals
Categories : PHP, Beginner Guides, Databases