Foros del Web » Programando para Internet » PHP »

De un include llamar la variable

Estas en el tema de De un include llamar la variable en el foro de PHP en Foros del Web. holas miren tengo este include (funcion.php) Código PHP: <?php function  seguridad ( $cadena ) { return  htmlentities ( trim ( addslashes ( stripslashes ( str_replace ...
  #1 (permalink)  
Antiguo 19/04/2012, 08:30
Avatar de LiPoxZ  
Fecha de Ingreso: abril-2012
Mensajes: 4
Antigüedad: 11 años, 11 meses
Puntos: 0
De un include llamar la variable

holas miren tengo este include (funcion.php)

Código PHP:
<?php
function seguridad($cadena)
{
return 
htmlentities(trim(addslashes(stripslashes(str_replace("%20"," ",$cadena)))));
}
function 
abrirArchivo($ruta)
{
$contenido file_get_contents($ruta);
return 
$contenido
}
function 
uniformidadXML($xmls)
{
$xml $xmls;
$myxml str_replace("titulo","title",$xml);
$myxml str_replace("url","url",$myxml);
$myxml str_replace("\n","",$myxml);
$myxml str_replace("<songs>","",$myxml);
$myxml str_replace("</songs>","",$myxml);
$myxml str_replace("<musica","<song",$myxml);
$myxml str_replace("'",'"',$myxml);
return 
$myxml;
}
function 
obj($m,$cad)
{
$trozos explode(" - ",$cad);
if(
$m == 'a')
{return 
$trozos[0];
}else if(
$m == 't')
{return 
$trozos[1];
}
}
function 
showArray($xml)
{
preg_match_all('/title="(.*?)"/',$xml,$titulo);
preg_match_all('/path="(.*?)"/',$xml,$url);
$total count($url[1]); 
for(
$n 0;$n<$total;$n++)
{
 
$array obj("t",$titulo[1][$n])."*";
 
$array.= obj("a",$titulo[1][$n])."*";
 (
$n == $total-1)? $array.= $url[1][$n]: $array.=$url[1][$n]."@";
 echo 
$array;
}
}
function 
showPlaylist($xml)
{
preg_match_all('/title="(.*?)"/',$xml,$titulo);
preg_match_all('/path="(.*?)"/',$xml,$url);
$total count($url[1]); 
//echo "<div align='left'><table bgcolor='FFFFFF' cellspacing='0' cellpadding='0'>\n<tbody>\n";
for($n 0;$n<$total;$n++)
{
$numeral $n+1;
$tit =  obj("t",$titulo[1][$n]);
$artista obj("a",$titulo[1][$n]);

$artista=ucwords(strtolower($artista));
$tit=ucwords(strtolower($tit));

$html ="<tr id='pl_".$n."'onMouseOver ='overM(this);' onMouseOut = outM(this);>\n";
$html .="<td width='280' class='playlix' title='$artista - $tit' href=\"#\" onClick=\"getMusica(".$n.");you('".$artista." - ".$tit."');\">";
//$html .="<td class='playlix' href=\"#\" onClick=\"getMusica(".$n.");you('".$artista." - ".$tit."');lyrc('".$artista." - ".$tit."');\">";
$html .="<span>".$numeral.".- ".$artista." - ".$tit."</td><td width='90'><img src=\"img/fb.gif\" title=\"Compartir En Facebook : $artista - $tit\" <a href=\"mp3.php?tema=".$artista." - ".$tit."&url=".$url[1][$n]."\"></a><a onClick=\"lyrc('".$artista." - ".$tit."');\"><img src=\"img/letr_d.gif\" title=\"Letra : $artista - $tit\"></a><a onClick=\"you('".$artista." - ".$tit."');\" title=\"Video : $artista - $tit\"><img src=\"img/vid_d.gif\"/></a><a href=\"Utiles/mp3.php?down=".$url[1][$n]."&name=".$artista." - ".$tit."\"><img src=\"img/mp3_d.gif\" title=\"Descargar : $artista - $tit\"></a></td></span></td>\n";
$html .="</tr>\n";

echo 
$html;

}
//echo "</tbody>\n</table></div>";
}
?>
en si yo quisiera jalar esto ami index <a href=\"mp3.php?down=".$url[1][$n]."&name=".$artista." - ".$tit."\">

intente lo que havia en otro post :

Código PHP:
<?php
include 'funcion.php';
echo 
"$url["1"]";
?>
pero no me sale t.t
  #2 (permalink)  
Antiguo 19/04/2012, 08:36
 
Fecha de Ingreso: septiembre-2011
Mensajes: 106
Antigüedad: 12 años, 6 meses
Puntos: 19
Respuesta: De un include llamar la variable

Se hace asi:

Código PHP:
Ver original
  1. <?php
  2. include 'funcion.php';
  3. echo $url[1];
  4. ?>

Saludos...
  #3 (permalink)  
Antiguo 19/04/2012, 08:39
Avatar de LiPoxZ  
Fecha de Ingreso: abril-2012
Mensajes: 4
Antigüedad: 11 años, 11 meses
Puntos: 0
Respuesta: De un include llamar la variable

Cita:
Iniciado por ILuzbel Ver Mensaje
Se hace asi:

Código PHP:
Ver original
  1. <?php
  2. include 'funcion.php';
  3. echo $url[1];
  4. ?>

Saludos...
men lo prove pero no jala la url en ese url es para acer una descarga de los mp3s

Última edición por LiPoxZ; 19/04/2012 a las 08:50

Etiquetas: html, include, variables
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 02:30.