Jump to content

Ahhh! "Movies section" rollover links wont work


motleycrewl

Recommended Posts

I'm in need of a wizards assistance once again. The problem I have is with the PHP script you made for the "movies / concerts / events" tabbed section on this website: http://universitycenters.ucsd.edu/new2/index.php .  Now right off the bat, I dont have access to the MYSQL tables so that's super inhibiting.  I have access to the CRUD pages where I can view, edit, and add new rows but I dont have the field names etc. like I would via phpMyAdmin or something.  Anyways, my problem is that I can't get the rollover function for the movie posters working (ie. rollover the name of a movie and its poster pops-up to the right) and I can't get the "Watch Trailer Now" button working: it simply takes me to the directory where all the trailers are but doesn't open the trailer I've selected.  I've tinkered with it a fair amount but most of this PHP is really beyond me and I need help from a master.

 

Below is the code from the include file for the movies section called 'mce-movies':

 

$result = mysql_query($sql);

$count = 0;

print "<div class='mce-data'>";

$poster_images = array();

$poster_video = array();

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {

if ($count % 2 == 1)

print("\n<div class=\"odd\">");

else

print("\n<div class=\"even\">");

if ($row[4] == "Movie"){

$sql = "SELECT poster FROM movies WHERE id=" . $row[0];

$result_movie = mysql_query($sql);

$row_movie = mysql_fetch_array($result_movie, MYSQL_NUM);

$poster_images[$count] = $posters_dir . $row_movie[0];

 

}

else{ //not a movie to and need to set image

$poster_images[$count] = $categories_dir . $categories_imgs[$row[4]];

}

 

 

// Cut lengthy movie titles

$movieTitle =  $row[3];

$length = 30;

$replacement = '…';

 

if (strlen($movieTitle) > $length)

    {

        $output  = substr($movieTitle, 0, $length - 3);

        $output .= $replacement;

        $movieTitle = $output;

    }

    else

    {

        $movieTitle = $movieTitle;

    }

 

print (" Monday $row[1]/$row[2]</div><div style='float:left;margin:0 5px 0 10px;'>6pm:</div> <div style=' float:left; width:150px; border:0px solid #F00;

margin:0 0 0 5px;'><a href=\"#\" onmouseover=\"image_swap('$count') \"> $movieTitle </a></div><br /><br />");

print("\n");

$count++;

}

print "</div>";

?>

 

 

And this is the code for the homepage part of the movie section:

 

<div class="movies">  

    <h2>This Week's Movies</h2><?php include ("includes/mce-movies.php"); ?>

<div class="poster"><img name="event_image" alt="movie poster" src="../events_beta/posters/<?php echo $row_movie[0] ?>" height="133" width="80" /><br>

<a href="../events_beta/movie_clips/<?php echo $row_movie[1] ?>">Watch the Trailer</a></div>

<div style="clear:both;"></div>

  </div>

 

 

OK, I'm an idiot  ;D, heres the java script function for the rollovers:

 

<!-- mce poster rollover script -->
<script type="text/javascript">
	var _i = new Image();	_i.src="../events_beta/posters/davinci.jpg";

	var img_1 = new Image();	img_1.src="<?php echo $poster_images[0] ?>";
	var img_2 = new Image();	img_2.src="../events_beta/posters/blank.gif";
	var img_3 = new Image();	img_3.src="../events_beta/posters/blank.gif";
	var img_4 = new Image();	img_4.src="../events_beta/posters/blank.gif";
	var img_5 = new Image();	img_5.src="<?php echo $poster_images[4] ?>";

	function image_swap( _img)
	{	
		if ( _img == 0)
			document.images["event_image"].src = img_1.src;
		if ( _img == 1)
			document.images["event_image"].src = img_2.src;
		if ( _img == 2)
			document.images["event_image"].src = img_3.src;
		if ( _img == 3)
			document.images["event_image"].src = img_4.src;
		if ( _img == 4)
			document.images["event_image"].src = img_5.src;
	}
</script>

 

and heres the small PHP script that references the image directory:

 

<?php
$category_dir = "../events_beta/categories/";  // Define category directory
$posters_dir = "../events_beta/posters/";      // Define poster image directory
$video_dir = "../events_beta/video/";  //Define video trailer directory
//$categories_imgs["Art Reception"] = $category_dir . "art_reception.jpg"; //id: 1 - Art Reception
?>

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.