Witam serdecznie . mam mały kłopot z porcjowanie i sortowaniem danych. Mam sklep opart na plikach a z racji że nie mam serwera który obsługuję mysql to musi mi to wystarczać ...
Chodzi mi o to żeby lista produktów byla porcjowana a linki do poszczególnych stron wyglądały << 1 - 2 -3 - 4 - 5 - 6 - 7 >> itd .. oprucz tego przydało by się też sortowanie alfabetyczne ale mi to nie wychodzi próbował z sort() z asort() i z wszystkimi podobnymi funkcjami które powinny sortować ale nic z tego . Najważniejsze dla mnie jest to porcjowanie . poniżej fragment kodu .
proszę o pomoc
[php:1:79cc756a5d]
<?
// Display the shop header. This is the search box, category select, links etc.
function dispHeader ($categ,$search,$cat) {
?>
<SCRIPT LANGUAGE="JavaScript">
<!--
function jumpto(){
location = document.links.link_select.options[document.links.link_select.selectedIndex].val
e
}
//-->
</SCRIPT>
<center>
<table width="477" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<p><table class="tableBackground" width="477" cellspacing="0" cellpadding="2">
<tr>
<td><font class="titleFont">Store Options</font></td>
</tr>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<form method="POST" name="links">
<tr>
<td width="50%" valign="top">
<br><select name="link_select">
<P><option value="index.php">View all products
<?
$cartFile = File("dbase.txt");
$length = sizeof($cartFile);
$i = 1;
while ($i < $length) {
list($categ) = explode("|",$cartFile[$i]);
if (!$lookupAr[$categ]) {
$lookupAr[$categ] = 1;
$categ2 = "$categ";
$categ = ereg_replace("&","%26",$categ);
$categ = ereg_replace(" ","%20",$categ);
echo "<option value="index.php?cat=$categ">$categ2 n";
}
$i++;
}
?>
</select>
<input type="button" value="go" onClick="jumpto()">
</td>
</form>
<form method="post" action="index.php">
<td width="50%" align="right" valign="bottom">
<input type="hidden" name="option" value="search">
<input type="text" name="search" size="17" value="<?=$search?>">
<input type="submit" value="Search">
</td>
</tr>
</form>
</table>
<p align="right"><a href="index.php">Shop Front</a> | <a href="view.php">View Shopping</a> | <a href="checkout.php">Check Out</a>
<? } ?>
<?
// Display the shop footer
function dispFooter () {
include("vars.php");
?>
<center>
All prices quoted in <?=$currency?>. Prices are
<?
if ($tax == "")
echo "exclusive ";
else
echo "inclusive ";
?>
of <?=$tax_name?>.
</center>
</td>
</tr>
</table>
<? } ?>
<?
// This will display each item
function displayProd ($categ,$type,$id,$name,$itemoptions,$price,$normpr,$img,$stockop,$advdate,$deta
ls,$desc) {
include("vars.php");
?>
<tr>
<td valign="top">
<? if ($img != "") { ?>
<center>
<img src="images/<?=$img?>" border="0">
<? if ($details != "") { ?>
<p><font size="1"><a href="<?=$details?>">Click for more details</a>
<? } ?>
<? } ?>
</td>
<td width="30"></td>
<td valign="top">
<font class="itemTitleFont"><b><?=$name?></b></font>
<?
if ($stockop == "advance")
echo "<br><b>Advance Order Only</b> - Available $advdate";
elseif ($stockop == "outof")
echo "<br><b>Out of Stock</b>";
?>
<p><?=$desc?>
<?
if ($stockop == "instock" || $stockop == "advance") {
if ($type == "single") {
if ($normpr != "")
echo "<p>RRP: <strike>$cur$normpr</strike> | <font class="ourPrice"><b>Our Price: $cur$price</b></font>";
else
echo "<p><font class="ourPrice"><b>Price: $cur$price</b></font>";
echo " | <input name="".$id."info" type="hidden" value="$name|$price"> ";
} else {
$tokAr = explode("~",$itemoptions);
$numTok = sizeof($tokAr);
for ($i=0;$i<$numTok;$i++) {
if (trim($tokAr[$i])!="") {
$tokformat = ereg_replace(" - ","|",$tokAr[$i]);
$tok = ereg_replace(" - "," - $cur",$tokAr[$i]);
$itemoptions2 .= "<option value="$name - $tokformat">$tok";
}
}
$itemoptions = $itemoptions2;
echo "<p><select name="".$id."info">$itemoptions2</select> ";
}
?>
<input type="value" name="<?=$id?>quant" value="1" size="3"> <input type="button" name="<?=$id?>add" value="Add" onclick="addItem(document.itemsform.<?=$id?>info,document.itemsform.<?=$id?>quant.value)">
<? } ?>
</td>
</tr>
<tr>
<td colspan="3"><br><hr width="100%" size="1" noshade color="black"><br></td>
</tr>
<? } ?>
[/php:1:79cc756a5d]