Hi,
I’ve done a grid following the directions of video presentation in Grid product page.
Well, I need to show images of products in grid view. My database have the name of filenames and I used (in others systems I’ve build) a concatenation of paths like this:
<img src="products_images/th<?php echo $picture;?>" />
There are some way to show images in other folder than the setup in
mygrid.setImagePath('codebase/imgs/')
?
How must be done?
Here are my actual code:
produtos-grid.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="codebase/dhtmlxgrid.css" />
<link rel="stylesheet" type="text/css" href="codebase/skins/dhtmlxgrid_dhx_skyblue.css" />
<script src="codebase/dhtmlxcommon.js"></script>
<script src="codebase/dhtmlxgrid.js"></script>
<script src="codebase/dhtmlxgridcell.js"></script>
<script src="codebase/ext/dhtmlxgrid_srnd.js"></script>
<div id="gridbox" style="width:632px; height:370px;"></div>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath('codebase/imgs/')
mygrid.setHeader("ID, Foto, Código, Tipo, Linha, Estoque, Preço");
mygrid.setInitWidths("100,*");
mygrid.setColTypes("ro,img,ed,ed,ed,ed,ed");
mygrid.setSkin("dhx_skyblue");
mygrid.init();
mygrid.enableSmartRendering(true);
mygrid.loadXML("produtos-grid-connector.php");
</script>
</head>
<body>
</body>
</html>
produtos-grid-connector.php:
<?php
require_once('codebase/grid_connector.php');
$res = mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('jwsis5') or die(mysql_error());
$grid = new GridConnector($res);
$grid->dynamic_loading(100);
$grid->render_table("jwsis_produtos","id","id,foto,codigo,id_tipo,id_linha,estoque,preco_venda");
?>