Jump to content

code returning first letter only


binibi

Recommended Posts

the following code is used as part of a online shop to filter the product into a alphebatised index eg a, b, c... i'm trying to replace the alphabets into colour reference so in essence this will become a colour index selector and instead of a, b, c... it will be red, blue, green...

 

please can anyone look at this code and tell me what the obvious mistake is thanks in advance

 

<?php

 

$eol      = $this->globals('khxc.eol');

$prodidx  = $this->globals('ecom.prod_prodidx');

$dispapp  = $this->globals('khxc_display.app');

$ref      = $this->globals('khxc.ref');

 

// +--

// | Display navigation links if there are any.

// +--

 

if (!(empty($prodidx))) {

 

    print '<div class="khxc_storelink">' . $eol . $eol;

    print '<p><strong>Index</strong>: ' . $eol . $eol;

 

    $plinks = '';

 

    foreach ($prodidx as $num => $data) {

 

          $idx  = $data['prodidx'];

          $eidx = $this->xhtml_encode($idx);

 

          if ($ref == $idx) {

 

              $plinks .= $eidx . ' | ';

 

          } else {

 

              $href = $this->link_namespace($dispapp,'prodidx',array('ref'    => $idx));

 

              $plinks .= '<a href="' . $href . '" title="Product Index ';

              $plinks .= $eidx . '">' . $eidx . '</a> | ';

 

          } // End of if statement.

 

    } // End of foreach statement.

 

    if (preg_match('/ \| $/',$plinks)) {$plinks = rtrim($plinks,' | ');}

 

    print $plinks;

 

    print '</p>' . $eol . $eol;

    print '</div>' . $eol . $eol;

 

} // End of if statement.

 

?>

Link to comment
https://forums.phpfreaks.com/topic/93719-code-returning-first-letter-only/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.