
Ninja, for you...

Moderator: General Moderators
That isn't what I'm talking about... let me post some of the code I have to deal with hang on...GM wrote:I think a lot of it comes down to individual style. What is neat code for one person is messy code for another. What is readable for one person is illegible for another. What is necessary for one person is a waste of bytes for another.
In general, if you look at any big script that is not written by yourself, you always find yourself thinking "Why has he indented it like this?". "Why hasn't he split that long string onto multiple lines?". etc. etc.
Code: Select all
<?
echo'<style type="text/css">
<!--
@import url("../normal.css");
-->
</style>';
//require_once("./projfunc/data_func.php");
require_once("alerts.js");
require_once("./projfunc/selqueryPage.php");
//include ("style.css");
function redate($date)
{
$data=explode('/',$date);
$mm=$data[0];
$dd=$data[1];
$yyyy=$data[2];
$newDate=$yyyy."-".$mm."-".$dd;
return $newDate;
}
//$compid=$_REQUEST["conum"];
//$numrows=$_REQUEST["numrows"];
//$typedev=$_REQUEST['typedev'];
//$zoning=$_REQUEST['zoning'];
//$F=$_REQUEST["F"];
//Start Pagination process
$approve=$_REQUEST['approve'];
if(!isset($_GET['page'])){
$numrows=$_REQUEST['numrows'];
}else {
$numrows=$_GET['numrows'];
}
if(!isset($_REQUEST['numrows'])){
$numrows=10;
}else {
$numrows=$_GET['numrows'];
}
if(!isset($approve)){
$approve="NO";
}else {
$approve=$_GET['approve'];
}
if(!isset($_GET['page'])){
$page=1;
}else {
$page=$_GET['page'];
}
$from=(($page*$numrows)-$numrows);
//echo "from=".$from;
//echo "numrows=".$numrows;
$compInfo=propList(0,100000,'',$typedev,$zoning,$compid,$approve);
$Tmemdata=count($compInfo);
if($numrows=="all"){$numrows=100000000;}
$Tpages=ceil($Tmemdata/$numrows);
echo"<table width=800 class="bodycopy" cellpadding=7>
<tr>
<td>Select a Page<br />";
if($page>1){
$prev=($page -1);
echo"<a href="".$_SERVER['PHP_SELF']."? page=".$prev."&numrows=".$numrows."&compid=".$compid."&zoning=".$zoning."&typedev=".$typedev."&approve=".$approve."&F=2"><<Previous</a> ";
}
for($i=1;$i<=$Tpages;$i++){
if(($page)==$i){
echo $i." ";
}else {
echo "<a href="".$_SERVER['PHP_SELF']."?page=".$i."&numrows=".$numrows."&compid=".$compid."&zoning=".$zoning."&typedev=".$typedev."&approve=".$approve."&F=2">$i</a> ";
}
}
if($page<$Tpages){
$next=($page+1);
echo"<a href="".$_SERVER['PHP_SELF']."?page=".$next."&numrows=".$numrows."&compid=".$compid."&zoning=".$zoning."&typedev=".$typedev."&approve=".$approve."&F=2">Next>></a>";
}
echo"</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td align=RIGHT><a href="search.htm" ><img src="..\\images\\newsearch.gif" border=0></td></tr></table>";
//end paganation process
//echo $from.",".$numrows.",".$typedev.",".$zoning.",".$compid.",".$approve;
echo '<form name=compsearch method="post" action="">';
if(!$compInfo=propList($from,$numrows,'',$typedev,$zoning,$compid,$approve)){
echo'<TABLE width="800" class="bodycopy" border="0" cellpadding="7">
<tr><td>Sorry, There are no unapproved properties at this time. <br> <br>
Would you like to see a list of all properties?<br><a href="complist.php?approve=YES"><img src="../images/viewprop.gif" border=0></img></a></td></tr>
</table> ';
}else{
echo'<TABLE width="800" class="bodycopy" border="0" cellpadding="7">
<tr>
</tr>
<TR>
<td>
<b>Address</b>
</td>
<td>
<b>Type Development</b>
</td>
<td>
<b>Reference Name</b>
</td>
<td>
</td>
<td>
</td>
</tr>';
foreach ($compInfo as $data){
$compid=$data['cell_0'];
$add_id=$data['cell_9'];
echo "<tr>";
echo "<td align="LEFT">".$data['cell_4']."</td>";
echo "<td align="LEFT">".$data['cell_1']."</td>";
echo "<td align="LEFT">".$data['cell_5']."</td>";
echo' <TD align="RIGHT">
<a href=./PropEditEntry.php?compid='.$compid.'&F=2"><img src=".\images\edit-approve.gif" border=0></img></a>
</td>
<TD align="RIGHT">
<a href="javascript:confirm_ex(\'./PropDeleteEntry.php?compid='.$compid.'\',\'Clicking OK will permantly\n\n Remove this data, ARE YOU SURE YOU WANT TO DO THIS???\');"><img src=".\images\deleteprop.gif" border=0></img></a>
</td>
</tr> ';
echo "
<tr>
<td>
</td>
</tr>
";
}
echo" <tr>
<td>
Would you like to see a list of all properties?<br><a href="complist.php?approve=YES"><img src="./images/viewprop.gif" border=0></img></a>
</td>
</tr> ";
echo'
</table>';
echo' </form>';
}
?>ohjayshields wrote:That's nothing, didn't you see my post in the I hate osCommerce thread?