Displaying Different name from a "List" field

7 posts by 2 authors in: Forums > CMS Builder
Last Post: November 6, 2012   (RSS)

By efi-revivo - November 1, 2012 - edited: November 1, 2012

How can i show a different name in list option instead of "name" to "iconhebrew"

When i insert this line; <?php echo htmlspecialchars($vehicleListed) ?> it's show the name only - and I want to show something else.

<?php $vehicleList = getListLabels('listing', 'icons', $listingRecord['icons']) ?>
<?php foreach($vehicleList as $vehicleListed): ?>
<?php if ($listingRecord['icons']): ?>
<img src="icons/<?php echo htmlspecialchars($vehicleListed) ?>.png" alt="Different name (iconhebrew field instead of name)" width="25" height="25" border="0" title="<?php echo htmlspecialchars($vehicleListed) ?>"/>
<?php endif ?>
<?php endforeach ?>


Thanks,
Efi

Re: [Jason] Displaying Different name from a "List" field

By efi-revivo - November 1, 2012

Hi Jason,

iconhebrew stored inside icons table (category section)
under the "name" i insert a new field "iconhebrew"

the listing section use this table for icons in our site

The "name" field is for english and iconhebrew is for hebrew.

Re: [efi-revivo] Displaying Different name from a "List" field

By Jason - November 1, 2012

Hi,

What field is used for the option value for "icon" in the listing section?
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Displaying Different name from a "List" field

By efi-revivo - November 1, 2012 - edited: November 4, 2012

Hi,

for field option values i use"name"
for the image name.

and for field option labels i use "iconhebrew"

Thanks,
Efi

Re: [efi-revivo] Displaying Different name from a "List" field

By Jason - November 5, 2012

Hi Efi,

If the value of $vehicleListed comes from the name field of your icons table, you can retrieve the entire icons record like this:

<?php $vehicleList = getListLabels('listing', 'icons', $listingRecord['icons']) ?>
<?php foreach($vehicleList as $vehicleListed): ?>
<?php if ($listingRecord['icons']): ?>
<?php $iconRecord = mysql_get("icons", null, "name = '".mysql_escape($vehicleListed)."'"); ?>
<img src="icons/<?php echo htmlspecialchars($vehicleListed) ?>.png" alt="<?php echo @$iconRecord['iconhebrew']; ?>" width="25" height="25" border="0" title="<?php echo htmlspecialchars($vehicleListed) ?>"/>
<?php endif ?>
<?php endforeach ?>


Please give this a try and let me know if you run into any problems.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Displaying Different name from a "List" field

By efi-revivo - November 6, 2012

Thanks Jason :-)