Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] Sintaxis de esta concatenacion

Estas en el tema de Sintaxis de esta concatenacion en el foro de PHP en Foros del Web. Hola a todos: Tengo este codigo Código PHP: foreach ( $this -> items  as  $row ) :  $imagefile     =  $row -> icono ; echo  "<td valign='top' align='center'>" ; if ( ...
  #1 (permalink)  
Antiguo 06/05/2013, 01:57
Avatar de ManelGomez  
Fecha de Ingreso: diciembre-2007
Ubicación: El Prat de llobregat
Mensajes: 180
Antigüedad: 16 años, 4 meses
Puntos: 2
Sintaxis de esta concatenacion

Hola a todos:

Tengo este codigo
Código PHP:
foreach ($this->items as $row) : 
$imagefile    $row->icono;
echo 
"<td valign='top' align='center'>";
if (
JFile::exists(JPATH_COMPONENT.DS.'assets'.DS.'images'.DS.$imagefile)) {
  echo 
"<img src='".JURI::root(). 'components'.DS.'com_documentos'.DS.'assets'.DS."images/pdf.png'>";
}
echo 
"</td>\n";
echo 
"<td width='100%' valign='top'>\n";
echo 
$this->escape($row->title);
echo 
"</td></tr>";
endforeach; 
Esto hace que si el registro en su campo icono tiene una images y esta existe en la carpeta images, me muestre ese icono previamente al title del registro.

Entonces cual es la sintaxis para sustituir el pdf.png por nombre del icono, en este caso $imagefile.

Un saludo.
  #2 (permalink)  
Antiguo 06/05/2013, 02:01
Avatar de repara2  
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: Sintaxis de esta concatenacion

Código PHP:
Ver original
  1. echo "<img src='".JURI::root(). 'components'.DS.'com_documentos'.DS.'assets'.DS."images/".$imageFile."'>";
__________________
Fere libenter homines, id quod volunt, credunt.
  #3 (permalink)  
Antiguo 06/05/2013, 02:16
Avatar de ManelGomez  
Fecha de Ingreso: diciembre-2007
Ubicación: El Prat de llobregat
Mensajes: 180
Antigüedad: 16 años, 4 meses
Puntos: 2
Respuesta: Sintaxis de esta concatenacion

Hola Repara:

Te has adelantado.

Código PHP:
            echo "<img src='".JURI::root(). 'components'.DS.'com_documentos'.DS.'assets'.DS."images/".$imagefile."'>"
Un saludo y gracias.

Etiquetas: registro, sintaxis
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:13.