Video website production Example 3

Source: Internet
Author: User

 

The first video starts right when I open the page. As I select each movie from the list on the right, the page reloads and shows the movie I selected.

How sweet and simple was that? One Flex file, one PHP file, and a little database magic for the backend, and viola! Video sharing!

The next step is to see whether you can enhance the user experience a bit by doing more of the work in Flex.

The Flex Interface, Part 1

If you want to provide a mechanic for Flex to show any movie, you must provide the Flex application with the list of movies. the most convenient way to do that is through XML. so, going back to PHP again, you need a page exports the movie list from the database as XML. this movies. php page is shown in Listing 6.

Listing 6. movies. php
<?phprequire "DB.php";$moviebase = 'http://localhost:8080/movies/';header( 'content-type: text/xml' );$dsn = 'mysql://root@localhost/movies';$db =& DB::connect( $dsn );if ( PEAR::isError( $db ) ) { die($db->getMessage()); }?><movies><?php$res = $db->query( 'SELECT title, source, thumb, width, height FROM movies' );while( $row = $res->fetchrow( ) ) {?>  <movie title="<?php echo( $row[0] ) ?>" source="<?php echo( $moviebase.$row[1] ) ?>"    thumb="<?php echo( $moviebase.$row[2] ) ?>" width="<?php echo( $row[3] ) ?>"   height="<?php echo( $row[4] ) ?>" /><?php}?></movies>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.