Just nu i M3-nätverket
Jump to content

Ta bort två rader


Ume090

Recommended Posts

Tja, har gjort en script

 

<?[color="#ff0000"]header[/color]("Content-type: application/xml");
[color="#0000ff"]print[/color] "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";?>
<Slides>
<?[color="#0000ff"]php[/color]
$katalog="_fotoalbum/_bilder/";
[color="#0000ff"]if[/color] (is_[color="#ff0000"]dir[/color]($katalog)) {
   [color="#0000ff"]if[/color] ($bilder = [color="#ff0000"]opendir[/color]($katalog)) {
  		[color="#0000ff"]while[/color] (($[color="#ff0000"]file[/color] = [color="#ff0000"]readdir[/color]($bilder)) !== [color="#ff8C00"]FALSE[/color]) {
	   [color="#0000ff"]echo[/color] '<slideNode jpegURL="';
		 [color="#0000ff"]echo[/color] '_fotoalbum/';
 		 [color="#0000ff"]echo[/color] 'bilder/';
		 [color="#0000ff"]if[/color] ($[color="#ff0000"]file[/color] <> "." [color="#0000ff"]and[/color] $[color="#ff0000"]file[/color] <> "..")
    	     [color="#0000ff"]echo[/color] "$[color="#ff0000"]file[/color]";
		 [color="#0000ff"]echo[/color] "\">tom";
		[color="#0000ff"]echo[/color] "</slideNode>";
		[color="#0000ff"]echo[/color] "\n";
       }
   [color="#ff0000"]closedir[/color]($bilder);
   }
}
?>
</Slides>

 

Då det visar XML typ

 

[log]

<?xml version="1.0" encoding="iso-8859-1" ?>

- <Slides>

<slideNode jpegURL="_fotoalbum/bilder/">tom</slideNode>

<slideNode jpegURL="_fotoalbum/bilder/">tom</slideNode>

<slideNode jpegURL="_fotoalbum/bilder/IMG_3551.JPG">tom</slideNode>

<slideNode jpegURL="_fotoalbum/bilder/IMG_3558.JPG">tom</slideNode>

<slideNode jpegURL="_fotoalbum/bilder/IMG_3578.JPG">tom</slideNode>

<slideNode jpegURL="_fotoalbum/bilder/IMG_3622.JPG">tom</slideNode>

[/log]

Men jag vill ta bort de två rader

<slideNode jpegURL="_fotoalbum/bilder/">tom</slideNode>

<slideNode jpegURL="_fotoalbum/bilder/">tom</slideNode>

 

hur ska jag göra?

 

MVH

 

Link to comment
Share on other sites

Du har den här raden på fel ställe:

[color="#0000ff"]if[/color] ($[color="#ff0000"]file[/color] <> "." [color="#0000ff"]and[/color] $[color="#ff0000"]file[/color] <> "..")

 

Flytta upp den och låt hela sektionen ner till echo "\n"; innefattas av if-satsen.

 

[color="#0000ff"]if[/color] (is_[color="#ff0000"]dir[/color]($katalog)) {
  [color="#0000ff"]if[/color] ($bilder = [color="#ff0000"]opendir[/color]($katalog)) {
    [color="#0000ff"]while[/color] (($[color="#ff0000"]file[/color] = [color="#ff0000"]readdir[/color]($bilder)) !== [color="#ff8C00"]FALSE[/color]) {
      [color="#0000ff"]if[/color] ($[color="#ff0000"]file[/color] <> "." [color="#0000ff"]and[/color] $[color="#ff0000"]file[/color] <> "..") {
        [color="#0000ff"]echo[/color] '<slideNode jpegURL="';
        [color="#0000ff"]echo[/color] '_fotoalbum/';
        [color="#0000ff"]echo[/color] 'bilder/';
        [color="#0000ff"]echo[/color] "$[color="#ff0000"]file[/color]";
        [color="#0000ff"]echo[/color] "\">tom";
        [color="#0000ff"]echo[/color] "</slideNode>";
        [color="#0000ff"]echo[/color] "\n";
      }
    }
    [color="#ff0000"]closedir[/color]($bilder);
  }
}

 

\\Anp

 

 

[inlägget ändrat 2005-07-29 16:37:39 av Anp]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...