Jump to content

[SOLVED] Ampersands on Pagination in Dreamweaver XHTML Validating Issue


rostros

Recommended Posts

Hi Guys , having a little trouble getting this code through W3 XHTML Validation , Im using a Dreamweaver Pagination extension which I know using extensions is bad but this is a big project. Im familar with the concept of using & rather than & but it appears it still does't work. Anyway here is the code.

 

-

PHP Code / Variable

 

$queryString_tbl_dealer_vehicles = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_tbl_dealer_vehicles") == false && 
        stristr($param, "totalRows_tbl_dealer_vehicles") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_tbl_dealer_vehicles = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_tbl_dealer_vehicles = sprintf("&totalRows_tbl_dealer_vehicles=%d%s", $totalRows_tbl_dealer_vehicles, $queryString_tbl_dealer_vehicles);

 

 

 

XHTML Page Code

 

            <?php
for ($i=0; $i <= $totalPages_tbl_dealer_vehicles; $i++) {
  $TFM_PagesEndCount = $i + 1;
  if($i != $pageNum_tbl_dealer_vehicles) {
    printf('<a href="'."%s?pageNum_tbl_dealer_vehicles=%d%s", $currentPage, $i, $queryString_tbl_dealer_vehicles.'">'.$TFM_PagesEndCount."</a>");
  }else{
    echo(" [<strong>$TFM_PagesEndCount</strong>] ");
  }
  if($i != $totalPages_tbl_dealer_vehicles) echo("");
}
?>

 

XHTML Error

 

cannot generate system identifier for general entity "totalRows_tbl_dealer_vehicles"

…x.php?pageNum_tbl_dealer_vehicles=1&totalRows_tbl_dealer_vehicles=8">2</a> 

 

--

 

It looks like the %s is the part where I need the & but this just gives more errors ? I hope someone can help me as I dont really want to code this site as non xhtml compliant.

 

 

Thanks

Link to comment
Share on other sites

Okay quick fix managed to validate the code , if anybody is using Dreamweaver and you get the same problem just replace

 

$queryString_tbl_dealer_vehicles = sprintf("&totalRows_tbl_dealer_vehicles=%d%s", $totalRows_tbl_dealer_vehicles, $queryString_tbl_dealer_vehicles);

 

With

 

Remove the &totalRows and replace it with "&" . totalRows_

 

$queryString_tbl_dealer_vehicles = sprintf("&" . "totalRows_tbl_dealer_vehicles=%d%s", $totalRows_tbl_dealer_vehicles, $queryString_tbl_dealer_vehicles);

Link to comment
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.