Jump to content

Recommended Posts

I am using the following code in multiple files to sort my tables:

 

<?php if ($vehicle->status->Visible) { // status ?>
<?php if ($vehicle->SortUrl($vehicle->status) == "") { ?>
	<td>Status</td>
<?php } else { ?>
	<td class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $vehicle->SortUrl($vehicle->status) ?>',1);">
		<table cellspacing="0" class="ewTableHeaderBtn"><tr><td>Status</td><td style="width: 10px;"><?php if ($vehicle->status->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($vehicle->status->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></table>
	</td>
<?php } ?>
<?php } ?>	

 

In one file (and one file only) the sort does not work.

That code is applied to every <td> cell it needs to be, but it just doesn't work.

Can someone point me in the right direction as to where I would look to find the problem.

I used Windows Grep and Notepad++ to do comparisons and searches for related functions, but the comparison only showed that I removed one section about Security (making this publicly viewable without logging in)

 

Any guidance would be much appreciated as I am still learning.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/157146-menu-sort/
Share on other sites

If I click a header, nothing happens.

They give me a clickable cursor, but the click has no results.

 

It works on another file which is almost identical, I just took the content from that file and put it into a table previously designed for the new file.

 

Thanks

 

EDIT:

For further information:

http://craighooghiem.com/goodwills/demo/invent.php?order=price&ordertype=DESC 

Does work and sorts the price column by DESC.

http://craighooghiem.com/goodwills/demo/invent.php

 

It just doesn't seem to work.

Link to comment
https://forums.phpfreaks.com/topic/157146-menu-sort/#findComment-828038
Share on other sites

I have 0 experience with Javascript.

I haven't tried doing anything with it, but I'll go back and compare the two files and check the javascript again.

If you could tell me how to debug, that would be stellar.

 

Craig Hooghiem

 

Working URL :

http://www.craighooghiem.com/goodwills/demo/inventory.php

Link to comment
https://forums.phpfreaks.com/topic/157146-menu-sort/#findComment-828132
Share on other sites

I DID remove this code:

if ($Security->IsLoggedIn()) {
$vehicle_list->lOptionCnt++; // view
}
if ($Security->IsLoggedIn()) {
$vehicle_list->lOptionCnt++; // edit
}
if ($Security->IsLoggedIn()) {
$vehicle_list->lOptionCnt++; // copy
}
if ($Security->IsLoggedIn()) {
$vehicle_list->lOptionCnt++; // Delete
}

 

and

 

<?php if ($Security->IsLoggedIn()) { ?>
<td style="white-space: nowrap;"> </td>
<?php } ?>
<?php if ($Security->IsLoggedIn()) { ?>
<td style="white-space: nowrap;"> </td>
<?php } ?>
<?php if ($Security->IsLoggedIn()) { ?>
<td style="white-space: nowrap;"> </td>
<?php } ?>
<?php if ($Security->IsLoggedIn()) { ?>
<td style="white-space: nowrap;"> </td>
<?php } ?>

 

On a whim, since it makes the pages publicly viewable, sinve the $security variable is related to being logged in.

Could this have changed anything?

 

Otherwise I'm back at stage one and will have to rebuild my page again.. hoping not to miss it this time.

Link to comment
https://forums.phpfreaks.com/topic/157146-menu-sort/#findComment-828187
Share on other sites

All the code will exceed the character limits of this post.

I think it may be the fact that I removed include: header.php

 

Here's the code from Header.php:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Goodwill's Used Cars - Aylmer, St. Thomas, Tilsonburg Ontario</title>
<?php if (@$gsExport == "") { ?>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.6.0/build/container/assets/skins/sam/container.css">
<?php } ?>
<?php if (@$gsExport == "" || @$gsExport == "print") { ?>
<link rel="stylesheet" type="text/css" href="vehicles.css">
<?php } ?>

</head>
<body class="yui-skin-sam">
<?php if (@$gsExport == "") { ?>
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/utilities/utilities.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/container/container-min.js"></script>
<script type="text/javascript">
<!--
var EW_DATE_SEPARATOR = "/"; 
if (EW_DATE_SEPARATOR == "") EW_DATE_SEPARATOR = "/"; // Default date separator
var EW_UPLOAD_ALLOWED_FILE_EXT = "gif,jpg,jpeg,bmp,png,doc,xls,pdf,zip"; // Allowed upload file extension
var EW_FIELD_SEP = ", "; // Default field separator

// Ajax settings
var EW_RECORD_DELIMITER = "\r";
var EW_FIELD_DELIMITER = "|";
var EW_LOOKUP_FILE_NAME = "ewlookup6.php"; // lookup file name

//var EW_ADD_OPTION_FILE_NAME = ""; // add option file name
var EW_BUTTON_SUBMIT_TEXT = "    Add    ";
var EW_BUTTON_CANCEL_TEXT = "  Cancel  ";

//-->
</script>
<script type="text/javascript" src="js/ewp6.js"></script>
<script type="text/javascript" src="js/userfn6.js"></script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js");
//-->

</script>
<div class="ewLayout">
<!-- header (begin) -->
  <div class="ewHeaderRow"><center><img src="phpmkrlogo6.png" alt="" border="0"></center></div>
<!-- header (end) -->
<!-- content (begin) -->
  <table cellspacing="0" class="ewContentTable">
	<tr>	
		<td class="ewMenuColumn">
		<!-- left column (begin) -->
<?php include "ewmenu.php" ?>
		<!-- left column (end) -->
		</td>		
    <td class="ewContentColumn">
		<!-- right column (begin) -->
			<p class="phpmaker"><b></b></p>
<?php } ?>

 

That seems to be the only thing I removed, besides the $security stuff.

 

The following is the beginnning section of the invent.php file that has the problem:

<?php
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg6.php" ?>
<?php include "ewmysql6.php" ?>
<?php include "phpfn6.php" ?>
<?php include "vehicleinfo.php" ?>
<?php include "userfn6.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Define page object
$vehicle_list = new cvehicle_list();
$Page =& $vehicle_list;


// Page main processing
$vehicle_list->Page_Main();
?>

<?php if ($vehicle->Export == "") { ?>
<script type="text/javascript">
<!--

// Create page object
var vehicle_list = new ew_Page("vehicle_list");

// page properties
vehicle_list.PageID = "list"; // page ID
var EW_PAGE_ID = vehicle_list.PageID; // for backward compatibility

// extend page with Form_CustomValidate function
vehicle_list.Form_CustomValidate = 
function(fobj) { // DO NOT CHANGE THIS LINE!

	// Your custom validation code here, return false if invalid. 
	return true;
}
<?php if (EW_CLIENT_VALIDATE) { ?>
vehicle_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
vehicle_list.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<?php } ?>
<?php if ($vehicle->Export == "") { ?>
<?php } ?>
<?php
$bSelectLimit = ($vehicle->Export == "" && $vehicle->SelectLimit);
if (!$bSelectLimit)
	$rs = $vehicle_list->LoadRecordset();
$vehicle_list->lTotalRecs = ($bSelectLimit) ? $vehicle->SelectRecordCount() : $rs->RecordCount();
$vehicle_list->lStartRec = 1;
if ($vehicle_list->lDisplayRecs <= 0) // Display all records
	$vehicle_list->lDisplayRecs = $vehicle_list->lTotalRecs;
if (!($vehicle->ExportAll && $vehicle->Export <> ""))
	$vehicle_list->SetUpStartRec(); // Set up start record position
if ($bSelectLimit)
	$rs = $vehicle_list->LoadRecordset($vehicle_list->lStartRec-1, $vehicle_list->lDisplayRecs);
?>

 

I'm going to try rebuilding the site from scratch with a new database table and different values anyways, but I wanted to use this same site template..

Link to comment
https://forums.phpfreaks.com/topic/157146-menu-sort/#findComment-828703
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.