Foros del Web » Creando para Internet » Diseño web »

xml flash y php

Estas en el tema de xml flash y php en el foro de Diseño web en Foros del Web. Buenos dias, me han pedido hacer una modificacion en una pagina web, pero no se como hacerlo, paso ha explicar lo que hay que hacer. ...
  #1 (permalink)  
Antiguo 15/06/2010, 03:21
 
Fecha de Ingreso: diciembre-2005
Ubicación: Vigo
Mensajes: 135
Antigüedad: 18 años, 3 meses
Puntos: 3
xml flash y php

Buenos dias, me han pedido hacer una modificacion en una pagina web, pero no se como hacerlo, paso ha explicar lo que hay que hacer.

Tengo una carpeta con videos que hay que mostrar en la web, los videos estan en formato FLV, para visualzarlos tenemos un reproductor en la web y una lista con el titulo de los videos al lado, al ir pinchando en el listado se van reproduciendo el video sobre el que pinchas en el reproductor, esto es lo hay en estos momentos, pero me han pedido que en vez de un listado con el titulo de video ponga una imagen de cada uno de los videos, lo que es un gran problema ya que no se como poner una imagen en un archivo XML.

Pongo aqui en codigo de la pagina, haber si alguien me puede ayudar gracias.
Código PHP:
<STYLE type=text/css>



#txt { POSITION:relative; LEFT:0px; TOP:0px; Z-INDEX:1 }

#playerroot {
    POSITION:relative;
    WIDTH:580 px;
    HEIGHT:260px;
    BORDER-RIGHT:#333 0px solid;
    BORDER-TOP:#333 0px solid;
    BORDER-LEFT:#333 0px solid;
    BORDER-BOTTOM:#333 0px solid;
    BACKGROUND-COLOR: #ffffff;
    
}
#listroot { POSITION:relative; WIDTH:321px; HEIGHT:244px; BORDER-LEFT:#333 0px solid; BORDER-RIGHT:#333 0px solid; BORDER-TOP:#333 0px solid; BORDER-BOTTOM:#333 0px solid; BACKGROUND-COLOR: #ffffff; Z-INDEX:2 }

#playerhandle {
    WIDTH:315px;
    PADDING-LEFT:2px;
    PADDING-RIGHT:0px;
    PADDING-TOP:2px;
    PADDING-BOTTOM:2px;
    MARGIN:2px;
    COLOR:white;
    BACKGROUND-COLOR:#FFF;
    FONT-WEIGHT: bold;
}
#listhandle {
    WIDTH:315px;
    PADDING-LEFT:2px;
    PADDING-RIGHT:0px;
    PADDING-TOP:2px;
    PADDING-BOTTOM:2px;
    MARGIN:2px;
    COLOR:white;
    BACKGROUND-COLOR:#FFF;
    FONT-WEIGHT: bold;
}

.playlistlo { FONT:11px Verdana,Arial,Helvetica,sans-serif; VERTICAL-ALIGN:top; TEXT-TRANSFORM:none; COLOR:#000000; BACKGROUND-COLOR:#d5dfe8; TEXT-ALIGN: left }
.playlisthi { FONT:11px Verdana,Arial,Helvetica,sans-serif; TEXT-TRANSFORM:none; COLOR:#000000; BACKGROUND-COLOR:#96b1cb; }
.playlistbox { BORDER-RIGHT: #d5dfe8 0px; BORDER-TOP:#d5dfe8 0px solid; BORDER-LEFT:#d5dfe8 0px solid; BORDER-BOTTOM:#d5dfe8 0px solid }
</STYLE>

<SCRIPT type="text/javascript" src="swfobject.js"></SCRIPT>
<SCRIPT type="text/javascript" src="dom-drag.js"></SCRIPT>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

function importXML(theFile) {
    if ((document.implementation)&&(document.implementation.createDocument)) {
        xmlDoc = document.implementation.createDocument("", "", null);
        xmlDoc.onload = loaded;
    } else if (window.ActiveXObject) {
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.onreadystatechange = function() { if (xmlDoc.readyState == 4) loaded() }; 
    } else { alert('Sorry, your browser can\'t handle this script'); return; }

    xmlDoc.load(theFile);
}


function loaded() {    
  showTags('track','writeroot');
  createPlayer(Urls[0], Imgs[0], false, true);
}


var Urls = new Array();
var Imgs = new Array();

function showTags(theTag,thePlace) {

  function getTag(tag) { 
    var tmp='';
    xx=x[i].getElementsByTagName(tag);     
    try { tmp=xx[0].firstChild.data; } 
    catch(er) { tmp=''; }    
    return(tmp); 
  }

  var xx; var x; var txt;
  x = xmlDoc.getElementsByTagName(theTag);
  txt='<table border="0" cellPadding="2" width="210">'; 

  for (i=0; i<x.length; i++) { 
    Urls[i]=getTag("location"); Imgs[i]=getTag("image");  //getTag("title"); getTag("creator"); getTag("info");

    txt+='<tr><td><table width="295" onclick="play('+i+')" class="playlistlo" onmouseover="this.className = \'playlisthi\';" onmouseout="this.className = \'playlistlo\';"><tr>';
   // txt+='<tr><td><table width="295" onclick="play('+i+')" class="playlistlo" onmouseover="this.className = \'playlisthi\';" onmouseout="this.className = \'playlistlo\';"><tr>';
    txt+='<td></td><td width="300" valign=top>';
    txt+='<p>&nbsp;<b>'+getTag("title")+'</b>';
    txt+='<img src='+getTag("image")+'>';
    //txt+='&nbsp;by: '+getTag("creator")+'...<br>';
    //txt+='&nbsp;<a href="'+getTag("info")+'" target="_blank">website</a></p>';
    txt+='</td></tr></table></td></tr>';
  }
  txt+="</table>";

  document.getElementById(thePlace).innerHTML=txt; 
}


var thePlayer;
var thePlayerRoot;
var theList;
var theListRoot;

function initialize() {
    thePlayer = document.getElementById("playerhandle");
    theList = document.getElementById("listhandle");
    thePlayerRoot  = document.getElementById("playerroot");
    theListRoot  = document.getElementById("listroot");
    Drag.init(thePlayer, thePlayerRoot);    
    Drag.init(theList, theListRoot);
}

function createPlayer(theFile, theImg, start, icons) {
    var s1 = new SWFObject("mediaplayer.swf","dragplayer","320","240","7");
    s1.addParam("allowfullscreen", "true");
    s1.addVariable("file", theFile);
    s1.addVariable("width", "320");
    s1.addVariable("height", "240");
    s1.addVariable("displaywidth", "320");
    s1.addVariable("displayheight", "221");
    s1.addVariable('frontcolor','0x005096');
s1.addVariable('lightcolor','0x005096');
    if (start) s1.addVariable("autostart", "true");
    if (! icons) s1.addVariable("showicons", "false");
    if (theImg != "") s1.addVariable("image", theImg);

    s1.write("placeholder");
}

function play(number) { 
  createPlayer(Urls[number], Imgs[number], true, true);
}

// -->
</SCRIPT>

</head>

<?php
    
//crear xml
$dir "Videos/galeria_de_videos";
    function 
ordenar($a,$b){
        global 
$dir;
         
$a filemtime($dir."/".$a); 
         
$b filemtime($dir."/".$b); 
         if (
$a == $b) { 
            return 
0
            } 
            return (
$a $b) ? -1
    }
    
$dh  opendir($dir);
    
$archivos = array();
    while (
false !== ($nombre_archivo readdir($dh))) {
        if (
eregi (".flv",$nombre_archivo)){
            
$archivos[] = $nombre_archivo;
        }
    }    
    
closedir($dir);
    
usort($archivos"ordenar"); 
    
$xml fopen ("temp_galeria_de_videos.xml""w+");

    
$contenido '<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">'
;
    
$contenido .=  "<trackList>";
    
//echo(count($archivos));    
    
if (count($archivos)>0){

        for (
$i=0;$i<count($archivos);$i++){
            
$imagen=preg_replace('/.flv/','.jpg',$archivos[$i]);
            
$titulo substr($archivos[$i],0,strlen($archivos[$i])-4);
            
$titulo str_replace("_"," ",$titulo);
            
$contenido .=  "<track>";
            
$contenido .=  "<title>".$titulo."</title>";
            
$contenido .=  "<creator>Video</creator>";
            
$contenido .=  "<location>".$dir."/".$archivos[$i]."</location>";
            
$contenido .=  "<info></info>";
            
$contenido .=  "<image>".$imagen."</image>";
            
$contenido .=  "</track>";
        }
    }
    
$contenido .=  "</trackList>";
    
$contenido .=  "</playlist>";
    
fwrite ($xml$contenido);

    
fclose ($xml);
        
?>
<BODY onLoad="initialize(); importXML('galeria_de_videos.xml');">

<div id="cuerpoPrincipal">
  <div id="cabecera">
      <div id="flashcabecera">
        <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','930','height','162 ','src','cabecera','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','flashvars','seccionActiva=galeria','bgcolor','#F7F5F6','wmode','transparent' ); //end AC code
    </script>
        <noscript>
  <object data="" type="application/x-shockwave-flash" width="930" height="162">
            <param name="FlashVars" value="galeria" />
            <param name="movie" value="cabecera.swf" />
            <param name="quality" value="high" />
            <param name="wmode" value="transparent" />
          </object>
        </noscript>
      </div>
      
</div>
  
  <div id="contenidorContenidosGenerales">
  <div id="contenedortxtEspacioArriba"></div>
   <div class="txtTitulosGrandes" id="contenedorTitulosGenerales">GALER&Iacute;A DE VIDEOS </div>
  
      <div class="txtGeneral" id="contenedorTelevisorVideos">
      
    <div class="txtGeneral" style="width:400px; height:17px">Esta es una selección de videos grabados en los distintos talleres.   </div>  
      
 <DIV id="playerroot" style="float:left">
  <DIV id="playerhandle"></DIV>
<DIV id="placeholder"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</DIV>

</DIV>



<DIV id="listroot" style="float:left">
<DIV id="listhandle"></DIV>
<DIV class="playlistbox" align="left" style="MARGIN: 0px; OVERFLOW: auto; WIDTH: 320px; HEIGHT: 220px">
<DIV id="writeroot"></DIV>
</DIV>



  
  </div> 
  
  </div>
podeis ver lo que tengo funcionando en "alfameta.com/galeria.php"
__________________
AlfaMeta formacion

Etiquetas: flash, php, xml
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 08:33.