KonaKart Community Forum

Installation / Configuration => Configuration of KonaKart => Topic started by: victorius on December 09, 2009, 09:20:37 pm

Title: images in Konakart with configuration record
Post by: victorius on December 09, 2009, 09:20:37 pm
We have changed the parms in the konakartadmin for the base url for the images and the image base path.
Now within the Konakartadmin we can connect to the directory where the images are stored.

On the website we don't see the images that where connected to the product.
It seems that in the .jsp there is no connection to the configuration record of the images directory.
In the .jsp we see the following coding:

<img src="images/<%=prod.getImage()%>" border="0" alt="<%=prod.getName()%>" title=" <%=prod.getName()%> " width="<%=kkEng.getSmallImageWidth()%>" height="<%=kkEng.getSmallImageHeight()%>" hspace="5" vspace="5">

Can anybody gives us how we can connect to the configuration record in th .jsp?
Title: Re: images in Konakart with configuration record
Post by: ReneA on December 11, 2009, 08:41:15 pm
You can add the lines marked in red to you jsp.
In the top of the jsp:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<bean:define id="kkEng" name="konakartKey" type="com.konakart.al.KKAppEng"/>

<%
  com.konakart.app.KKEng eng;
  com.konakart.app.KKConfiguration conf;

  //Instantiate an object to interface to the main engine
  eng = new com.konakart.app.KKEng();
 
  // Replace with the appropiate config key !!
  conf = eng.getConfiguration("IMAGE_BASE_URL");
  if (conf == null)
  { throw new com.konakart.app.KKException(
            "The Configuration record could not be found.");
  }
  String configValue = conf.getValue();
%>


You may use the config value as in:

<img src="<%=configValue%>images/<%=prod.getImage()%>" border="0" alt="<%=prod.getName()%>" title=" <%=prod.getName()%> " width="<%=kkEng.getSmallImageWidth()%>" height="<%=kkEng.getSmallImageHeight()%>" hspace="5" vspace="5">