Re: code test
| From: | John Miller | Date: | Wed, 18 Jan 2012 23:50:01 +0000 |
| Subject: | Re: code test | ||
| References: | 1 | Groups: | php.test |
| Request: | Send a blank email to php-test+get-887@lists.php.net to get a copy of this message | ||
################################################################################
Tabellen
################################################################################
####################################################
# #zum einen Teil ein ...# # Der Mensch ist... ######################## # #zum anderen Teil ei...##################################################### #weder ein...#noch ein ri...#menschlich, allzume...# #################################################### ################################################################################ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"><html> <head> <title>Zellen spalten- und zeilenweise zugleich verbinden</title> </head> <body> <h1>Zoologie (III)</h1> <table border="1"> <tr>
<th colspan="2" rowspan="2">Der Mensch ist...</th>
<td>zum einen Teil ein Esel</td>
</tr>
<tr>
<td>zum anderen Teil ein Affe</td></tr> <tr>
<td>weder ein richtiger Esel</td>
<td>noch ein richtiger Affe</td>
<td><b>menschlich, allzumenschlich</b></td>
</tr>
</table>
</body>
</html>
################################################################################
Terminplaner
################################################################################
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Terminplaner</title> </head> <body>
<div>
<form method="post" action="save.php">
<div>Datum:<br/><input type="text" name="date" value="" size="15"/></div>
<div>Startzeit:<br/><input type="text" name="starttime" value="" size="15"/></div>
<div>Endzeit:<br/><input type="text" name="endtime" value="" size="15"/></div>
<div>Betreff:<br/><input type="text" name="subject" value="" size="80"/></div>
<div>Beschreibung:<br/><textarea name="description" rows="10" cols="50"></textarea></div>
<div><input id="submit" type="submit" value="OK" /></div>
</form>
</div>
</body>
</html>
################################################################################
<?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Terminplaner</title> <meta http-equiv="refresh" content="1; display.php"> </head> <body>
<?php
class Date {
public $date;
public $starttime;
public $endtime;
public $subject;
public $description;
};
$nDate = new Date;
$nDate -> date = $_POST['date'];
$nDate -> starttime = $_POST['starttime'];
$nDate -> endtime = $_POST['endtime'];
$nDate -> subject = $_POST['subject'];
$nDate -> description = nl2br($_POST['description']);
$_SESSION['date'] = $nDate;
?>
<a href="display.php">weiter</a>
</body>
</html>
################################################################################
<?php session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Terminplaner</title> </head> <body>
<?php
class Date {
public $date;
public $starttime;
public $endtime;
public $subject;
public $description;
};
$nDate = new Date;
$nDate = $_SESSION['date'];
?>
<table border="1">
<tr>
<th colspan="2" rowspan="2"><?php echo $nDate-> date,"<br/>",$nDate-> starttime,"<br/>",$nDate-> endtime;?></th>
<td><?php echo $nDate-> subject;?></td>
</tr>
<tr>
<td><?php echo $nDate-> description;?></td>
</tr>
</table>
</body>
</html>
################################################################################
XSLT Wetter
################################################################################
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="fn xs"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xhtml"/>
<xsl:template match="/">
<html>
<head>
<title>Wetterdaten</title></head> <body>
<dl>
<xsl:for-each select="history/weather">
<dt><xsl:value-of select="@measured,' ',humidity,'% ',pressure,pressure/@unit,' ',rain,rain/@unit,' ',wind,wind/@unit" separator=""/></dt>
<dd><xsl:value-of select="temperature, temperature/@unit" separator=" "/></dd>
</xsl:for-each>
</dl>
<xsl:variable name="niederschlag">
<xsl:value-of select="fn:sum(history/weather/rain) div fn:count(history/weather/rain)" />
</xsl:variable>
Durschnittlicher Niederschlag: <xsl:value-of select='format-number($niederschlag, "#.00")' />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
################################################################################
XSLT Bücher
################################################################################
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="fn xs"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xhtml" encoding="UTF-8"/>
<xsl:template match="buchhandel">
<html>
<head>
<title>
<xsl:text>Example</xsl:text>
</title>
</head>
<body>
<xsl:for-each select="buch[@ersch-jahr > '1998'] | buch[@kat = 'reisen']">
<div>
<xsl:value-of select="buchtitel" />
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
################################################################################
Buchhandel
################################################################################
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="fn xs"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xhtml" encoding="UTF-8"/>
<xsl:template match="buchhandel">
<html>
<head>
<title>
<xsl:text>Example</xsl:text>
</title>
</head>
<body>
<xsl:for-each-group select="buch" group-by="@ersch-jahr">
<xsl:sort select="@ersch-jahr" data-type="number"/>
<p><b><xsl:value-of select="current-grouping-key()"/>
</b><br/>
<xsl:value-of separator=", " select="current-group()/buchtitel"/>
</p>
</xsl:for-each-group>
</body>
</html>
</xsl:template>
</xsl:stylesheet>