diff --git a/client/example.php b/client/example.php
index 2dbc3046..f9283e9e 100644
--- a/client/example.php
+++ b/client/example.php
@@ -9,59 +9,68 @@ if (file_exists("local_config.php")) {
include("local_config.php");
}
-print "Connect to $SITE_URL
";
+alert("Connect to $SITE_URL");
$gallery3 = Gallery3::connect($SITE_URL, $USER, $PASSWORD);
$root = $gallery3->get("gallery");
$tags = $gallery3->get("tags");
-print "Create a tag
";
+alert("Create a tag");
$tag = $tags->add()
->set_value("name", "My Tag")
->save();
-print "Create a new album
";
+alert("Create a new album");
$album = $root->add()
->set_value("type", "album")
->set_value("name", "Sample Album")
->set_value("title", "This is my Sample Album")
->save();
-print "Upload a photo
";
+alert("Upload a photo");
$photo = $album->add()
->set_value("type", "photo")
->set_value("name", "Sample Photo")
->set_value("title", "Sample Photo")
->set_file("/tmp/foo.jpg")
->save();
-print "Added: " . $album->members[0] . "
";
+alert("Added: " . $album->members[0] . "");
-print "Tag the album
";
+alert("Search for the photo");
+$photos = $root->get("", array("name" => "Sample"));
+alert("Found: {$photos->members[0]}");
+
+alert("Tag the album");
$tag->add()
->set_value("url", $album->url)
->save();
-print "Tag the photo
";
+alert("Tag the photo");
$tag->add()
->set_value("url", $photo->url)
->save();
-print "Tagged items: " . join($tag->members, " ") . "
";
+alert("Tagged items: " . join($tag->members, " "));
-print "Un-tag the photo
";
+alert("Un-tag the photo");
$tag->remove($photo->url);
-print "Tagged items: " . join($tag->members, " ") . "
";
+alert("Tagged items: " . join($tag->members, " "));
-print "Find and modify the album
";
+alert("Find and modify the album");
$album = $root->get("Sample-Album")
->set_value("title", "This is my title")
->save();
-print "New title: $album->title
";
+alert("New title: $album->title");
// Now delete the album
-print "Delete the album
";
+alert("Delete the album");
$album->delete();
// Delete the tag
$tag->delete();
-print "Done!
";
+alert("Done!");
+
+function alert($msg) {
+ print "$msg
";
+ flush();
+}
?>
\ No newline at end of file