DUMMY51
Joined: 23 Feb 2010
Posts: 1
Posted: 2010-02-23 09:31
Back to top
Reply with quote
|
Hi,
Since I have many columns filled with "Y" or "N", I'm trying to improve the visual result.
I managed to put green tick and red cross images (Y.png and N.png) with this code :
| Code: |
'sql|LF' => 'CONCAT(\'<img src="../phpMyEdit/images/\', category_publish, \'.png">\')',
|
Works fine, the page is much easier to read, but when I save the changes, while the database is correctly updated, the images never change.
Emptying the browser cache and refreshing has no effect. Is there another cache somewhere or my code is it wrong ?
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2010-02-24 18:01
Back to top
Reply with quote
|
Use the forum's Search box to search for other CONCAT examples (examples which are conditional based on the field's value).
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2010-02-24 19:01
Back to top
Reply with quote
|
Display either a red or green icon depending on the value of the `hidden` field.
| Code: |
$opts['fdd']['hidden'] = array(
'css' => array('postfix' => 'right-justify'),
'default' => '0',
'input' => '',
'maxlen' => 1,
'name' => 'Hidden',
'options' => 'ACPVDFL',
'select' => 'D',
'escape|LF' => false,
'sql|LF' => 'if(hidden = "0", CONCAT("<img src=\"images/pme-red.gif\">"), CONCAT("<img src=\"images/pme-green.gif\">"))',
'sqlw' => 'TRIM("$val_as")',
'values2' => $select_no_yes,
'sort' => true,
'tab|ACP' => 'Hidden etc'
); |
http://phpvs.com/misc/pme-screenshot.gif
http://phpvs.com/misc/pme-red.gif
http://phpvs.com/misc/pme-green.gif
|
doug
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2010-02-24 19:27
Back to top
Reply with quote
|
Here's another example (not exactly related to the above) which someone might need someday.
A dummy / virtual field which uses CONCAT and REPLACE to alter the value of the `dir` field in order to display a link to an image (instead of a link to the /tn/ subfolder withiin an images directory).
| Code: |
$opts['fdd']['dummy1'] = array (
'name' => 'Link',
'sql|LF' => 'if(category = "image" || category = "other",
CONCAT("<a href=\"", dir, "/", filename, "\" target=\"_blank\">link</a>"),
if(category = "thumb", CONCAT("<a rel=\"lightbox\" href=\"", REPLACE(dir, "/tn", "/"), filename, "\" title=\"", photo_text, "\"><img src=\"", dir, "/", filename, "\" ", img_src_attr, " alt=\"\"></a>"), ""))',
'options' => 'L',
'escape' => false,
'sort' => false
);
|
|
|
Post new topic
Reply to topic
|
|
|
|