Page 2 of 9
Posted: 2006-05-16 05:24:49
by mjs7231
Hi,
I am still working out a few kinks in the newest version. One of which is a weird CSS issue in FF with the IMBD display and the image. Have a look, mouse over the image, you will see only half of it is clickable. My CSS is still a bit rusty I suppose.
Thanks for finding the bug with the code, this will definetly be fixed in the next release.
As for XVID / DVD / CAM. I am not sure what to do there because, instinct tells me too many options is a bad thing. It could be added in place of the num results per page selection that I have added in the newest release as picking the number of results is not all that useful, adding this is a slightly large code change.. So for now, you could always just type XVID or DVD in the search.
I do like the idea of adding the media type images.
---
Sat_Wolf: What script did you use to get the category in that format? I will look into seperating this.
Posted: 2006-05-16 09:12:54
by kazgor
thanks for the update news..
I kinda still like the idea of being able to filter based on DVD/XVID/CAM, i've done a mock up of this and it sits between the Categories Panel & Search panel, had to create a new MDB field.
Now im not really sure if when selecting the Media type, that the result should be based on All films rather than based on films in just the category currently selected.. eg all XVID films that are Action. (haven't quite mastered the logic for this bit)
Just i like the idea of Mediatype panel being built based on the Media type field and also means you get to see DVD (56), XVIDS (12) etc.
Number of films per page returned from the search should just go of the num per page already setup in normal view.. keeps things neater.
My thinking of the DVD logo etc, way i done it was to just name my graphic as per the Mediatype field.. eg.. DVD.gif, xvid.gif...
I have to say DIVS are freaky.. and DIVS inside DIVS are even more freaky.
Not sure if you've notices.. but the info block to the right of the IMDB ratiing do not left align correctly once you add a few more values in there, such as Date Added and Media type, yet the Short Description Info box is perfectly aligned. Very odd.. only way to fix it from a Hack point of view was to increase the Image Height of the IMDB graphics..
How on earth do you get the Media logo so it appear under the film cover, seems a perfect place to put the image.. just can't work it out with the divs.
Cheers for an excellent script.. im enjoying just playing with it and increasing my knowledge of PHP/MYSQL.
Posted: 2006-05-17 21:25:37
by kazgor
new bug to do with the JUMP TO panel.
in my example sample, i have 16 films, showing 10 per page, the last film is TAXI.
Now if i try to quick jump to V it will crash the script with invalid arrays etc. MDB_PAGE shows up has 0 on the URL line.
The problem is in this line
if (strtolower(substr($this->filtered_movies[$i]['ORIGINALTITLE'], 0, 1)) >= $char)
if the highest movie titles starts with a T, but we try to jump to V, the above will never be true so $alphapage will always be zero, which seem to be the main problem.
Hmm... chances are the more films in the database the less chance the above will happen though.
Now sure what the best fix for this should be.. either Jump to the nearest letter to one choose.... dont make that letter clickable...
** Edit **
Decided to make the letter none clickable if there no page found for them..
so in
get_alphabet_html() made the following change
Code: Select all
if ($alphapage > 0) {
$html .= " <td><A href='".$char_link."'>$char</A></td>\n";
} else {
$html .= " <td>".$char."</td>\n";
}
Posted: 2006-05-19 16:22:39
by kazgor
I've been chatting alot so here's what it looks like so far.
http://kazgor.awardspace.com/
Aider moi svp
Posted: 2006-05-25 13:06:14
by MisconductQC
Je ne sais pas comment créer ma base de données. images et informations des films. Il en aurais pas un que j'aurais pas besoin de modifier?
Jveut juste m'arranger pour updater mes films apres modifier mon MovieDB.awardspace.com jpourrais vous donner le mot de passe pour l'arranger.
Ce serais TRÈS TRÈS apprécié.
vous pouvez me contacté sur ce email:
allthatremains@sympatico.ca
Posted: 2006-05-27 10:40:33
by pretty_man
Bonjour,
Effectivement un how-to serait grandement apprécié...
Posted: 2006-05-27 12:19:17
by MisconductQC
À ce que je vois je ne suis pas le seul qui a de la misère.
Posted: 2006-05-27 19:55:51
by kazgor
sorry i do not speak french.
What problems are you both having?
Are you having problems with using awardspace?
if errors with the language file then just load it to moviedb.inc instead.
example
so in function post_setup_envirnment() instead of doing
require_once($this->UNIXPATH."/resource/language/".$this->lang_file);
just copy the language file instead
eg
/** ===============================================================================================
* FRENCH Language file for MovieDB by PK-Designs.com
* @author: M. Shepanski
*=============================================================================================== */
$this->lang['categories'] = "Catégories";
$this->lang['category'] = "Catégorie";
$this->lang['comments'] = "Commentaires";
$this->lang['country'] = "Pays";
$this->lang['description'] = "Description";
$this->lang['director'] = "Réalisateur";
$this->lang['jump_to'] = "Aller à";
$this->lang['length'] = "Durée";
$this->lang['more'] = "plus";
$this->lang['most_recent'] = "Récents";
$this->lang['next'] = "Suivant";
$this->lang['of'] = "of";
$this->lang['page'] = "Page";
$this->lang['previous'] = "Prev";
$this->lang['rating'] = "Note";
$this->lang['search'] = "Recherche";
$this->lang['showing'] = "Montrer";
$this->lang['sort_by'] = "Trier par";
$this->lang['starring'] = "Distribution";
$this->lang['title'] = "Titre";
$this->lang['year'] = "Année";
Posted: 2006-05-28 13:16:50
by MisconductQC
We dont know how use this template... Export... create de file for the website.
We need tutorial to how to do the export of the movie list
And what the line we need to modify...
And how i do all setting on awardspace.com
Your theme is awesome. Its why i need to use it.
PS.: Sorry, english is not my first language. :P
Posted: 2006-05-28 16:43:32
by xaxgo
Je serais entierement d'accord parceque la je nage un peu.J'ai reussi a pas mal avancer tous seul mais la je me retrouve avec ce message.
Warning: mysql_connect(): Unknown MySQL Server Host '<db4.awardspace.com>' (4) in /home/www/dvdtheque.awardspace.biz/mysql_db.inc on line 30
Cannot connect to database with login .
Merci d'avance
Anthony
Posted: 2006-05-28 19:37:10
by kazgor
Warning: mysql_connect(): Unknown MySQL Server Host '<db4.awardspace.com>' (4) in /home/www/dvdtheque.awardspace.biz/mysql_db.inc on line 30
Cannot connect to database with login .
I will try and do a tutorial for you people
ANT Movie.
1. load your movie database.
2. ctrl+E
3. select SQL
4. move all the field to the right hand box, ie (fields to export)
5. tablename (movies)
6. tick (drop table if exists & create table)
7. advance sort (use DATE ADDED/ORIGINAL TITLE)
8. click export
9. finished.. you have a filename.sql + images.
AWARDSPACE.
1. login to Awardspace (create subdomain first)
2. click database management
3. create database (eg mymovies)
4. copy DBHOST eg (db4.awardspace.com) or whatever it says to your Index.php. also your DBname & DBuser details.
5. login into `phpadmin` with DBname/DBpassword
6. if not already create a TABLE.. eg movies
7. select the database (eg mymovies)
8. click SQL tab
9. in `location of the textfile` click browse
10. find SQL file you exported from ANTE
11. you should now have you database loaded.
12. upload images to images directory.
hope that helps abit.
Posted: 2006-05-29 08:04:37
by xaxgo
Thank you Kazgor.
I have only forget to remove <> in database configuration.
I've an other question,Your script is without accent.Can I put them because it's write "?".
Thank you
Anthony
Posted: 2006-05-29 09:11:16
by kazgor
this is not my script.. im just like it so much i like modifying it.
Not sure how to fix the ascent problem. sorry.
Glad you go it working though
Posted: 2006-05-29 12:09:06
by MisconductQC
I do all these thing but i dont know how to do the index page.
i have my subdomain mymovielist.awardspace.com
i dont know what i need to write in index.html
Posted: 2006-05-29 12:15:53
by kazgor
rename _example.php to index.php
then edit the file and update the following fields
$db = new mysql_db("DB_SERVER", "DB_USERNAME", "DB_PASSWORD");
$moviedb = new Moviedb($db, "DATABASE_NAME", "DATABASE_TABLE");
with your database details.
Posted: 2006-05-29 18:43:04
by wako
Hi
I get this error:
SELECT * from `wakofilms`.`movies` ORDER BY
Invalid Query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
I've no idea of php nor sql and I don't know how to solve this.
I've modified the files like kazgor said to upload my database to Awardspace.
Thanks for your help and sorry for my english.
Posted: 2006-05-29 18:55:54
by kazgor
Here is the original
moviedb.inc file with all my changes in it to make it work for
awardspace.
hope that get you all sorted.
Code: Select all
<?
/** ===============================================================================================
* Create a dynamic view of ANT's movie database.
*
* <b> REQUIREMENTS </b>
*
* 1. PHP4+
* 2. MySQL Server 4.1+
* 3. ANT Movie Catalog export to a MySQL Database
* 4. At least some knowledge of standard HTML and PHP processes.
*
*
* <b> INSTRUCTIONS </b>
*
* 1. Download ANT Movie Catalog to build your movie database.
* 2. Export your Movie Database as SQL, check the option for include images.
* 3. Import the SQL into your MySQL Database on the server, and upload the images to the server.
* 4. Add the following code to the page you want this script to be displayed. Don't
* forget to also include the style sheet within the header of your HTML file.
* $db = new mysql_db("<DB_SERVER>", "<DB_USERNAME>", "<DB_PASSWORD>");
* $moviedb = new Moviedb($db, "<DATABASE_NAME>", "<TABLE_NAME>");
* print $moviedb->get_html();
* 5. There are several SET functions available which can be used to tweak the way this script
* works on your server. Include the function calls just before the print statement included
* on step four (above). The SET functions available are:
* $moviedb->set_min_cat_num($int); // Sets the Minimum number of movies before a category for that type is displayed. (Default 5)
* $moviedb->set_lang_file($filename); // Sets the language file to use (filename only, NOT path)
* $moviedb->set_moviedb_title($string); // Sets the title to be displayed at the top of the script
* $moviedb->set_default_npp($int); // Sets the number of movies per page to be displayed (Default 10)
* $moviedb->set_img_folder($http_path); // Sets the cover images directory (full HTTP path required) (Default: <SCRIPT PATH>/images)
*
* *. YOU SHOULD NOT NEED TO EDIT THIS FILE AT ALL UNLESS YOU KNOW WHAT YOU ARE DOING. :)
*
*
* <b> LICENSE </b>
*
* Copyright © 2005-2006 PK-Designs, Some Rights Reserved. This work is licensed under
* a "Creative Commons License" The below is a human-readable summary of the full Legal Code
* found at: http://creativecommons.org/licenses/by/2.5/legalcode
*
* - <b>You are free..</b>
* - to copy, distribute, display, and perform the work
* - to make derivative works
* - to make commercial use of the work
*
* - <b>Under the following conditions..</b>
* - Attribution. You must attribute the work in the manner specified by the author or licensor.
* - For any reuse or distribution, you must make clear to others the license terms of this work.
* - Any of these conditions can be waived if you get permission from the copyright holder.
*
*
* <b> ATTRIBUTION </b>
*
* If you plan to use this code on any site you own or help create, you must site the author
* M. Shepanski along with a link back to PK-Designs.com. Like most designers, I too do not like
* to include random links to someone's site when I use their script. Because of this I do not
* require that you include this link right near where the script is used on your page, but rather
* just mentioned on your site someplace; perhaps the disclaimer, or about page.
*
* Not required, but it is always nice to hear from people who find my work useful to them.
* If you wish, drop me a line so I can see how you implemented this script on your site.
*
* @author Michael Shepanski <mshepanski@pk-designs.com>
* @copyright Copyright © 2005-2006, Michael Shepanski
* @package PK-Designs
* @version Version 2.2 (2006.04.22)
*=============================================================================================== */
class Moviedb {
# Public Required Variables - Defined with the Constructor
var $db; // Mysql_db Object (Required)
var $dbname; // Database Name (Required)
var $tbname; // Table Name (Required)
# PUBLIC VARIABLES - Use the SET functions below to edit these
var $img_folder; // Path to movie images folder (Default: $SCRIPTDIR/images)
var $moviedb_title; // MovieDB Title to be displayed (Default: PK's Movie Database)
var $min_cat_num; // Minimum number of matches for a category to get its own option (Default: 5)
var $default_npp; // Default number of matches to show per page (Default: 10)
var $lang_file; // Language File to be used (Default: lang-english.inc)
var $res_folder; // Resources folder
# Private Variables - These are used internally within this class
var $THISPAGE; // HTTP Path to this Script
var $HTTPDIR; // HTTP Path to this Script's Folder
var $UNIXDIR; // UNIX Path to this Script's Folder
var $mdb_cat; // GETVAR: Current Category
var $mdb_num; // GETVAR: Current Selected Movie
var $mdb_page; // GETVAR: Current Page Number
var $mdb_npp; // GETVAR: Current Num/Page
var $mdb_search; // GETVAR: Current Search String
var $mdb_order; // GETVAR: Current Order Displayed
var $non_moviedb_gets; // Holds all non-MovieDB GET variables
var $filtered_movies; // Array containing ALL movie info
var $categories; // Array containing ALL category options
var $misc_categories; // All categories to be filed under Miscellaneous
var $num_matches; // Number of movie matches made with selected criteria
var $num_pages; // Total number of pages in the filtered view
var $num_movies; // Total number of movies in the database
/** -------------------------------------------------------------------------------------------
* Create or Load an instance of the worldplot database script.
* @access public
* ------------------------------------------------------------------------------------------*/
function Moviedb($mysql_db, $dbname, $tbname) {
$this->db = $mysql_db;
$this->dbname = $dbname;
$this->tbname = $tbname;
$this->pre_setup_envirnment();
}
/** -------------------------------------------------------------------------------------------
* Sets up envirnment to be used within this class
* @access public
* ------------------------------------------------------------------------------------------*/
function pre_setup_envirnment() {
$unixfile = str_replace("\\", "/", $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']);
$this->THISPAGE = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$this->HTTPPATH = substr($this->THISPAGE, 0, strrpos($this->THISPAGE, "/"));
$this->UNIXPATH = substr($unixfile, 0, strrpos($unixfile, "/"));
}
/** -------------------------------------------------------------------------------------------
* Finishes the setup of envirnment options AFTER the programmer had a chance to alter any
* public variables.
* @access public
* ------------------------------------------------------------------------------------------*/
function post_setup_envirnment() {
if (!isset($this->img_folder)) { $this->img_folder = $this->HTTPPATH."/images"; }
if (!isset($this->moviedb_title)) { $this->moviedb_title = "PK's Movie Database"; }
if (!isset($this->min_cat_num)) { $this->min_cat_num = 5; }
if (!isset($this->default_npp)) { $this->default_npp = 10; }
if (!isset($this->res_folder)) { $this->res_folder = $this->HTTPPATH."/resource/language/"; }
if (!isset($this->lang_file)) { $this->lang_file = "lang-english.inc"; }
require_once($this->res_folder.$this->lang_file);
$this->fetch_get_vars();
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the movie database to the screen.
* @access public
* ------------------------------------------------------------------------------------------*/
function get_html() {
$this->post_setup_envirnment();
$html = "<div id='mdb_container'>\n";
$html .= $this->get_header_html();
if ($this->mdb_num > 0) {
$html .= $this->get_full_detail_html($this->mdb_num);
} else {
$html .= $this->get_default_html();
}
$html .= $this->get_footer_html();
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* SETS - These are not checked for validity, so make sure you just use them correectly! :)
* @access public
* ------------------------------------------------------------------------------------------*/
function set_min_cat_num($int) { $this->min_cat_num = $int; }
function set_lang_file($filename) { $this->lang_file = $filename; }
function set_moviedb_title($string) { $this->moviedb_title = $string; }
function set_default_npp($int) { $this->default_npp = $int; }
function set_img_folder($http_path) { $this->img_folder = $http_path; }
function set_res_folder($http_path) { $this->res_folder = $http_path; }
/** -------------------------------------------------------------------------------------------
* Collect and Set all the Default GET variables. Stores all non-MovieDB GET variables to
* ensure that we do not forget to include them later.
* @access private
* ------------------------------------------------------------------------------------------*/
function fetch_get_vars() {
$mdb_vars = array("mdb_cat", "mdb_num", "mdb_page", "mdb_npp", "mdb_search", "mdb_order");
# Populate the non_moviedb_gets to contain all GETS not used in this script.
$this->non_moviedb_gets = array();
foreach($_GET as $var => $val) {
if (!in_array($var, $mdb_vars)) { $this->non_moviedb_gets[$var] = $val; }
}
#Set the Default GET values for this script.
$this->mdb_cat = (isset($_GET['mdb_cat']) ? $_GET['mdb_cat'] : "");
$this->mdb_num = (isset($_GET['mdb_num']) ? $_GET['mdb_num'] : 0);
$this->mdb_page = (isset($_GET['mdb_page']) ? $_GET['mdb_page'] : 1);
$this->mdb_npp = (isset($_GET['mdb_npp']) ? $_GET['mdb_npp'] : $this->default_npp);
$this->mdb_search = (isset($_GET['mdb_search']) ? $_GET['mdb_search'] : "");
$this->mdb_order = (isset($_GET['mdb_order']) ? $_GET['mdb_order'] : "DATEADD");
}
/** -------------------------------------------------------------------------------------------
* Convert an associative array to a proper GET string for the address bar.
* @access private
* ------------------------------------------------------------------------------------------*/
function array_to_get($array) {
$str = "";
foreach($array as $var => $val) {
if ($str != "") { $str .= "&"; }
$str .= $var."=".$val;
}
return $str;
}
/** -------------------------------------------------------------------------------------------
* Convert an associative array to private form inputs.
* @access private
* ------------------------------------------------------------------------------------------*/
function array_to_post($array) {
$str = "";
foreach($array as $var => $val) {
$str .= "<input type='hidden' name='".$var."' value='".$val."' />\n";
}
return $str;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the default movie view to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_default_html() {
$i = 0;
$oldchar = "";
$this->fetch_categories();
$this->fetch_filtered_movies();
$this->num_matches = sizeof($this->filtered_movies);
$this->num_pages = ceil($this->num_matches / $this->mdb_npp);
$html = "<div id='mdb_content'>\n";
$html .= " <div class='panel'>\n";
$html .= $this->get_categories_html();
$html .= $this->get_search_html();
$html .= $this->get_alphabet_html();
$html .= " </div>\n";
$html .= " <div class='mdb_filter_page'>\n";
$html .= $this->get_filter_header_html();
while (($i < $this->mdb_npp) && ((($this->mdb_page-1)*$this->mdb_npp)+$i < $this->num_matches)) {
$newchar = strtolower(substr($this->filtered_movies[(($this->mdb_page-1)*$this->mdb_npp)+$i]['ORIGINALTITLE'], 0, 1));
if ($newchar != $oldchar) {
$oldchar = $newchar;
$html .= " <a name='".$newchar."'></a>\n";
}
$html .= $this->get_short_description_html($this->filtered_movies[(($this->mdb_page-1)*$this->mdb_npp)+$i]);
$i++;
}
$html .= $this->get_filter_footer_html();
$html .= " </div>\n";
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the short movie description to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_short_description_html($movieinfo) {
$i = 0;
$actors_string = "";
$directors_string = "";
# Get the Non-MDB Gets
$non_mdb_gets = $this->array_to_get($this->non_moviedb_gets);
$non_mdb_gets = ((strlen($non_mdb_gets) > 0) ? "&".$non_mdb_gets : "");
# Trim the Description if needed
if (strlen($movieinfo['DESCRIPTION']) > 500) {
$movieinfo['DESCRIPTION'] = substr($movieinfo['DESCRIPTION'], 0, 400);
$movieinfo['DESCRIPTION'] = substr($movieinfo['DESCRIPTION'], 0, strrpos($movieinfo['DESCRIPTION'], " "));
$movieinfo['DESCRIPTION'] = trim($movieinfo['DESCRIPTION']).".. <a href='".$this->THISPAGE."?mdb_page=1&mdb_num=".$movieinfo['NUM']."mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$this->mdb_search.$non_mdb_gets."'>".$this->lang['more']."</a>";
}
# Fix the Rating
if($movieinfo['RATING'] == "") { $movieinfo['RATING'] = "na"; }
# Turn the actors list into links
$actors = $this->get_actors($movieinfo['ACTORS'], 0);
$i=0;
foreach($actors as $actor => $role) {
if ($i == 3) { break; }
if ($i > 0) { $actors_string .= ", "; }
$actors_string .= "<a href='".$this->THISPAGE."?mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$actor.$non_mdb_gets."'>".$actor."</a>";
$i++;
}
if (sizeof($actors) > 3) { $actors_string .= ", <a href='".$this->THISPAGE."?mdb_page=1&mdb_num=".$movieinfo['NUM']."mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$this->mdb_search.$non_mdb_gets."'>...</a>"; }
# Turn the directors list into links
$directors = $this->get_actors($movieinfo['DIRECTOR'], 0);
foreach($directors as $director => $role) {
if ($directors_string != "") { $directors_string .= ", "; }
$directors_string .= "<a href='".$this->THISPAGE."?mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$director.$non_mdb_gets."'>".$director."</a>";
}
# Create the HTML
$html = "<div class='short_detail'>\n";
$html .= " <a href='".$this->THISPAGE."?mdb_num=".$movieinfo['NUM']."&mdb_page=".$this->mdb_page."&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$this->mdb_search.$non_mdb_gets."'><img class='cover' src='".$this->img_folder."/".$movieinfo['PICTURENAME']."' alt='".$movieinfo['ORIGINALTITLE']."' /></a>\n";
$html .= " <div class='title'>\n";
$html .= " <a href='".$this->THISPAGE."?mdb_num=".$movieinfo['NUM']."&mdb_page=".$this->mdb_page."&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$this->mdb_search.$non_mdb_gets."'>".$movieinfo['ORIGINALTITLE']."</a>\n";
$html .= " </div>\n";
$html .= " <div class='quickinfo'>\n";
$html .= " <div class='imdb'><a href='".$movieinfo['URL']."'><img src='".$this->HTTPPATH."/resource/imdb/".$movieinfo['RATING'].".jpg' border=0></a></div>\n";
$html .= " <div class='info'>\n";
$html .= " <span>".$this->lang['year'].":</span> <a href='".$this->THISPAGE."?mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$movieinfo['YEAR'].$non_mdb_gets."'>".$movieinfo['YEAR']."</a>\n";
$html .= " <br /><span>".$this->lang['director'].": </span>\n".$directors_string."\n";
$html .= " <br /><span>".$this->lang['category'].":</span> <a href='".$this->THISPAGE."?mdb_cat=".$movieinfo['CATEGORY']."&mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order.$non_mdb_gets."'>".$movieinfo['CATEGORY']."</a>\n";
$html .= " </div>\n";
$html .= " </div>\n";
$html .= " <div class='short_description'>\n";
$html .= $movieinfo['DESCRIPTION'];
$html .= " </div>\n";
$html .= " <div class='stars'>\n";
$html .= " <span>".$this->lang['starring'].":</span>\n";
$html .= $actors_string;
$html .= " </div>\n";
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the full description to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_full_detail_html($num) {
$count = 0;
$actors_string = "";
# Get the Non-MDB Gets
$non_mdb_gets = $this->array_to_get($this->non_moviedb_gets);
$non_mdb_gets = ((strlen($non_mdb_gets) > 0) ? "&".$non_mdb_gets : "");
$res = $this->db->query("SELECT * FROM `".$this->dbname."`.`".$this->tbname."` WHERE NUM='".$this->mdb_num."'");
$movieinfo = $res->fetch_assoc();
if($movieinfo['RATING'] == "") { $movieinfo['RATING'] = "na"; }
$actors = $this->get_actors($movieinfo['ACTORS'], 0);
foreach ($actors as $actor => $roll) {
if ($count > 0) { $actors_string .= ", "; }
$actors_string .= "<a href='".$this->THISPAGE."?mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$actor.$non_mdb_gets."'>".$actor."</a>".$roll;
$count++;
}
$html = "<div id='mdb_full_detail'>\n";
$html .= " <a href='".$this->img_folder."/".$movieinfo['PICTURENAME']."'><img class='cover' src='".$this->img_folder."/".$movieinfo['PICTURENAME']."' alt='".$movieinfo['ORIGINALTITLE']."' /></a>\n";
$html .= " <div class='title'>".$movieinfo['ORIGINALTITLE']."</div>\n";
$html .= " <div class='quickinfo'>\n";
$html .= " <div class='imdb'><a href='".$movieinfo['URL']."'><img src='".$this->HTTPPATH."/resource/imdb/".$movieinfo['RATING'].".jpg' border=0></a></div>\n";
$html .= " <div class='info'>\n";
$html .= " <span>".$this->lang['year'].":</span> <a href='".$this->THISPAGE."?mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$movieinfo['YEAR'].$non_mdb_gets."'>".$movieinfo['YEAR']."</a>\n";
$html .= " <br /><span>".$this->lang['country'].":</span> <a href='".$this->THISPAGE."?mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$movieinfo['COUNTRY'].$non_mdb_gets."'>".$movieinfo['COUNTRY']."</a>\n";
$html .= " <br /><span>".$this->lang['director'].":</span> <a href='".$this->THISPAGE."?mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$movieinfo['DIRECTOR'].$non_mdb_gets."'>".$movieinfo['DIRECTOR']."</a>\n";
$html .= " <br /><span>".$this->lang['category'].":</span> <a href='".$this->THISPAGE."?mdb_cat=".$movieinfo['CATEGORY']."&mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order.$non_mdb_gets."'>".$movieinfo['CATEGORY']."</a>\n";
$html .= " <br /><span>".$this->lang['length'].":</span> ".$movieinfo['LENGTH']." min\n";
$html .= " </div>\n";
$html .= " </div>\n";
$html .= " <div class='description'>\n";
$html .= " <span>".$this->lang['description'].":</span><br />\n";
$html .= $movieinfo['DESCRIPTION'];
$html .= " </div>\n";
$html .= " <div class='comments'>\n";
$html .= " <span>".$this->lang['comments'].":</span><br />\n";
$html .= $movieinfo['COMMENTS'];
$html .= " </div>\n";
$html .= " <div class='stars'>\n";
$html .= " <span>".$this->lang['starring'].":</span>\n";
$html .= $actors_string;
$html .= " </div>\n";
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Returns a list containing the first $num actors on the roster. A $num of 0 will return
* all actors.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_actors($actor_string, $num) {
$rtnval = array();
$actors = split(",", $actor_string);
if ($num == 0) { $num = 10000; }
$count = 0;
while(($count < sizeof($actors)) && ($count < $num)) {
$actor = trim($actors[$count]);
$role = "";
if (strpos($actor, "(") != 0) {
$role = " ".trim(substr($actor, strpos($actor, "("), strrpos($actor, ")")));
$actor = trim(substr($actor, 0, strpos($actor, "(")-1));
} else if (strpos($actor, "(") === 0) {
$actor = "";
}
if ($actor != "") { $rtnval[$actor] = $role; }
$count++;
}
return $rtnval;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the Filter Header to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_filter_header_html($footer=FALSE) {
$divid = ($footer ? "mdb_filter_footer" : "mdb_filter_header");
$showing_min = (($this->mdb_page-1) * $this->mdb_npp) + 1;
$showing_max = (((($showing_min+$this->mdb_npp)-1) > $this->num_matches) ? $this->num_matches : ($showing_min+$this->mdb_npp)-1);
$non_mdb_gets = $this->array_to_get($this->non_moviedb_gets);
$non_mdb_gets = ((strlen($non_mdb_gets) > 0) ? "&".$non_mdb_gets : "");
$prev_html = "";
$next_html = "";
if ($this->mdb_page > 1) {
$prev_page = $this->mdb_page-1;
$prev_link = $this->THISPAGE."?mdb_cat=".$this->mdb_cat."&mdb_page=".$prev_page."&mdb_npp=".$this->mdb_npp."&mdb_search=".$this->mdb_search."&mdb_order=".$this->mdb_order.$non_mdb_gets;
$prev_html = "« <a href='".$prev_link."'>".$this->lang['previous']."</a> |";
}
if ($this->mdb_page < $this->num_pages) {
$next_page = $this->mdb_page + 1;
$next_link = $this->THISPAGE."?mdb_cat=".$this->mdb_cat."&mdb_page=".$next_page."&mdb_npp=".$this->mdb_npp."&mdb_search=".$this->mdb_search."&mdb_order=".$this->mdb_order.$non_mdb_gets;;
$next_html = "| <a href='$next_link'>".$this->lang['next']."</a> »";
}
$html = "<div id='".$divid."'>\n";
$html .= " <div class='pages'>".$prev_html." <span>".$this->lang['page'].":</span> ".$this->mdb_page." ".$this->lang['of']." ".$this->num_pages." ".$next_html."</div>\n";
$html .= " <div class='showing'><span>".$this->lang['showing'].":</span> ".$showing_min."-".$showing_max." ".$this->lang['of']." ".$this->num_matches."</div>\n";
$order_options = array( "ORIGINALTITLE" => $this->lang['title'], "YEAR" => $this->lang['year'],
"RATING" => $this->lang['rating'], "DATEADD" => $this->lang['most_recent']);
if (!$footer) {
$html .= " <div class='sort'>\n";
$html .= " <span>".$this->lang['sort_by'].":</span>\n";
$ordertext = "";
foreach($order_options as $field => $text) {
if ($ordertext != "") { $ordertext .= " |\n"; }
$classtext = (($field == $this->mdb_order) ? "class='selected' " : "");
$ordertext .= " <a ".$classtext."href='".$this->THISPAGE."?mdb_cat=".$this->mdb_cat."&mdb_npp=".$this->mdb_npp."&mdb_search=".$this->mdb_search."&mdb_order=".$field.$non_mdb_gets."'>".$text."</a>";
}
$html .= $ordertext;
$html .= " </div>\n";
}
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the Filter Header to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_filter_footer_html() {
return $this->get_filter_header_html(TRUE);
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the category selector to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_categories_html() {
$selected = (($this->mdb_cat == "") ? " selected" : "");
$non_mdb_gets = $this->array_to_get($this->non_moviedb_gets);
$non_mdb_gets = ((strlen($non_mdb_gets) > 0) ? "&".$non_mdb_gets : "");
$cat_link = $this->THISPAGE."?mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$this->mdb_search.$non_mdb_gets;
$html = "<div id='mdb_categories' class='mdb_menu'>\n";
$html .= " <h4>".$this->lang['categories']."</h4>\n";
$html .= " <table class='cat_list' cellpadding='0' cellspacing='0'>\n";
$html .= " <tr>\n";
$html .= " <td class='cat_title".$selected."'><a href='".$cat_link."'>All Categories</a></td>\n";
$html .= " <td class='cat_num".$selected."'>".$this->num_movies."</td>\n";
$html .= " </tr>\n";
foreach($this->categories as $mycat => $mynum) {
$selected = (($this->mdb_cat == $mycat) ? " selected" : "");
$cat_link = $this->THISPAGE."?mdb_cat=".$mycat."&mdb_npp=".$this->mdb_npp."&mdb_order=".$this->mdb_order."&mdb_search=".$this->mdb_search.$non_mdb_gets;
$html .= " <tr>\n";
$html .= " <td class='cat_title".$selected."'><a href='".$cat_link."'>".$mycat."</a></td>\n";
$html .= " <td class='cat_num".$selected."'>".$mynum."</td>\n";
$html .= " </tr>\n";
}
$html .= " </table>\n";
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the Search Box to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_search_html() {
$html = "<div id='mdb_search' class='mdb_menu'>\n";
$html .= " <h4>".$this->lang['search']."</h4>\n";
$html .= " <form method='get' action='".$this->THISPAGE."'>\n";
$html .= " <input type='hidden' name='mdb_cat' value='".$this->mdb_cat."' />\n";
$html .= " <input type='hidden' name='mdb_npp' value='".$this->mdb_npp."' />\n";
$html .= " <input type='hidden' name='mdb_order' value='".$this->mdb_order."' />\n";
$html .= " <input type='input' name='mdb_search' value='".$this->mdb_search."' />\n";
$html .= $this->array_to_post($this->non_moviedb_gets);
$html .= " </form>\n";
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the Alphabet Box to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_alphabet_html() {
$modval = 8;
$non_mdb_gets = $this->array_to_get($this->non_moviedb_gets);
$non_mdb_gets = ((strlen($non_mdb_gets) > 0) ? "&".$non_mdb_gets : "");
$char_link = $this->THISPAGE."?mdb_cat=".$this->mdb_cat."&mdb_page=1&mdb_npp=".$this->mdb_npp."&mdb_order=ORIGINALTITLE&mdb_search=".$this->mdb_search.$non_mdb_gets;
$html = "<div id='mdb_alphabet' class='mdb_menu'>\n";
$html .= " <h4>".$this->lang['jump_to']."</h4>\n";
$html .= " <table class='char_list' cellpadding='0' cellspacing='0'><tr>\n";
$html .= " <td><a href='".$char_link."'>#</a></td>\n";
$charnum = 1;
while ($charnum <= 26) {
$char = chr($charnum+96);
$alphapage = $this->get_char_page($char);
$char_link = $this->THISPAGE."?mdb_cat=".$this->mdb_cat."&mdb_page=".$alphapage."&mdb_npp=".$this->mdb_npp."&mdb_order=ORIGINALTITLE&mdb_search=".$this->mdb_search.$non_mdb_gets."#".$char;
if ($alphapage > 0) {
$html .= " <td><A href='".$char_link."'>$char</A></td>\n";
} else {
$html .= " <td>".$char."</td>\n";
}
$charnum++;
if($charnum % $modval == 0) { $html .= " </tr><tr>\n"; }
}
while($charnum % $modval != 0) { $html .= " <td> </td>\n"; $charnum++; }
$html .= " </tr></table>\n";
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Returns the Page Number that the Character Starts ats
* @access private
* ------------------------------------------------------------------------------------------*/
function get_char_page($char) {
$alphapage = 0;
$i = 0;
while(($alphapage == 0) && ($i < sizeof($this->filtered_movies))) {
if (strtolower(substr($this->filtered_movies[$i]['ORIGINALTITLE'], 0, 1)) >= $char) {
$alphapage = ceil(($i+1) / $this->mdb_npp);
}
$i++;
}
return $alphapage;
}
/** -------------------------------------------------------------------------------------------
* Populates the two variables $categories and $misc_categories to be used when displaying
* the category options. Array structure is array(name => number) of all categories. If
* there is less movies than displayed in $this->min_cat_num, the movies will be filed to
* category other.
* @access private
* ------------------------------------------------------------------------------------------*/
function fetch_categories() {
$this->categories = array();
$this->misc_categories = array();
$this->num_movies = 0;
$misc_count = 0;
$res = $this->db->query("SELECT category,count(*) FROM `".$this->dbname."`.`".$this->tbname."` GROUP BY category");
while ($row = $res->fetch_assoc()) {
if (($row['count(*)'] >= $this->min_cat_num) && (trim($row['category']) != "")) {
$this->categories[$row['category']] = $row['count(*)'];
} else {
$misc_count += $row['count(*)'];
array_push($this->misc_categories, $row['category']);
}
$this->num_movies += $row['count(*)'];
}
if ($misc_count > 0) {
$this->categories['Other'] = $misc_count;
}
}
/** -------------------------------------------------------------------------------------------
* Returns array of an array of movie information based on the selections made for $mdb_cat,
* $mdb_page, $mdb_npp, $mdb_search. It's a nasty function, I know. :(
* @access private
* ------------------------------------------------------------------------------------------*/
function fetch_filtered_movies() {
$this->filtered_movies = array();
$query = "SELECT * from `".$this->dbname."`.`".$this->tbname."`";
if (($this->mdb_cat != "") || ($this->mdb_search != "")) { $query .= " WHERE"; }
if (($this->mdb_cat != "") && ($this->mdb_cat != "Other")) { $query .= " CATEGORY = '".$this->mdb_cat."'"; }
if ($this->mdb_cat == "Other") {
$i=0;
while ($i < sizeof($this->misc_categories)) {
if ($i==0) { $query .= " (CATEGORY = '".$this->misc_categories[$i]."'"; }
else { $query .= " OR CATEGORY = '".$this->misc_categories[$i]."'"; }
$i++;
}
$query .= ")";
}
if ($this->mdb_search != "") {
if ($this->mdb_cat != "") { $query .= " AND"; }
$query .= " (MEDIA LIKE '%".$this->mdb_search."%'";
$query .= " OR MEDIATYPE LIKE '%".$this->mdb_search."%'";
$query .= " OR SOURCE LIKE '%".$this->mdb_search."%'";
$query .= " OR ORIGINALTITLE LIKE '%".$this->mdb_search."%'";
$query .= " OR TRANSLATEDTITLE LIKE '%".$this->mdb_search."%'";
$query .= " OR DIRECTOR LIKE '%".$this->mdb_search."%'";
$query .= " OR PRODUCER LIKE '%".$this->mdb_search."%'";
$query .= " OR COUNTRY LIKE '%".$this->mdb_search."%'";
$query .= " OR CATEGORY LIKE '%".$this->mdb_search."%'";
$query .= " OR YEAR LIKE '%".$this->mdb_search."%'";
$query .= " OR ACTORS LIKE '%".$this->mdb_search."%'";
$query .= " OR DESCRIPTION LIKE '%".$this->mdb_search."%'";
$query .= " OR COMMENTS LIKE '%".$this->mdb_search."%'";
$query .= " OR VIDEOFORMAT LIKE '%".$this->mdb_search."%'";
$query .= " OR VIDEOBITRATE LIKE '%".$this->mdb_search."%'";
$query .= " OR AUDIOFORMAT LIKE '%".$this->mdb_search."%'";
$query .= " OR AUDIOBITRATE LIKE '%".$this->mdb_search."%'";
$query .= " OR RESOLUTION LIKE '%".$this->mdb_search."%'";
$query .= " OR FRAMERATE LIKE '%".$this->mdb_search."%'";
$query .= " OR LANGUAGES LIKE '%".$this->mdb_search."%')";
}
$query .= " ORDER BY ".$this->mdb_order." ";
if (($this->mdb_order == "YEAR") || ($this->mdb_order == "RATING") || ($this->mdb_order == "DATEADD")) { $query .= "DESC , ORIGINALTITLE"; }
$res = $this->db->query($query);
while($row = $res->fetch_assoc()) {
array_push($this->filtered_movies, $row);
}
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the movie database HEADER to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_header_html() {
$html = "<div id='mdb_header'>\n";
$html .= " <h3><span>".$this->moviedb_title."</span></h3>\n";
$html .= "</div>\n";
return $html;
}
/** -------------------------------------------------------------------------------------------
* Return the HTML to print the movie database FOOTER to the screen.
* @access private
* ------------------------------------------------------------------------------------------*/
function get_footer_html() {
$html = "<div id='moviedb_footer'>\n";
$html .= " <div class='copyright'>PK's Movie Database - © 2006 <a href='http://pk-designs.com'>PK-Designs.com</a>.</div>\n";
$html .= "</div>\n";
return $html;
}
}
Posted: 2006-05-29 20:39:07
by wako
I don't know why but now it works!
Well, I've put the language file into moviedb.inc as you said.
Thanks for responding so quickly kazgor and mjs7231 for this great template. Waiting for your updates...
Posted: 2006-05-29 22:11:21
by MisconductQC
I have another error... With the code for awardspace.com
Warning: post_setup_envirnment(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/www/mymovielist.awardspace.com/moviedb.inc on line 137
Warning: post_setup_envirnment(
http://mymovielist.awardspace.com/resou ... french.inc): failed to open stream: Address family not supported by protocol in /home/www/mymovielist.awardspace.com/moviedb.inc on line 137
Fatal error: post_setup_envirnment(): Failed opening required '
http://mymovielist.awardspace.com/resou ... french.inc' (include_path='.:/usr/local/php4/share/pear') in /home/www/mymovielist.awardspace.com/moviedb.inc on line 137
Posted: 2006-05-29 23:03:13
by kazgor
hmm.. you are not alone.. it works for me but not for others.. perhaps i was lucky... i'l have to find a better solution but for now i guess you will just have to put the language file back into moviedb..
so in the above code i put up..
change this line
function post_setup_envirnment() to be
for
Code: Select all
function post_setup_envirnment() {
if (!isset($this->img_folder)) { $this->img_folder = $this->HTTPPATH."/images"; }
if (!isset($this->moviedb_title)) { $this->moviedb_title = "PK's Movie Database"; }
if (!isset($this->min_cat_num)) { $this->min_cat_num = 5; }
if (!isset($this->default_npp)) { $this->default_npp = 10; }
if (!isset($this->res_folder)) { $this->res_folder = $this->HTTPPATH."/resource/language/"; }
if (!isset($this->lang_file)) { $this->lang_file = "lang-english.inc"; }
/** Do not fully understand so doing it this way should fix it for now */
if ($this->lang_file == "lang-english.inc") {
$this->lang['categories'] = "Categories";
$this->lang['category'] = "Category";
$this->lang['comments'] = "Comments";
$this->lang['country'] = "Country";
$this->lang['description'] = "Description";
$this->lang['director'] = "Director";
$this->lang['jump_to'] = "Jump To";
$this->lang['length'] = "Length";
$this->lang['more'] = "more";
$this->lang['most_recent'] = "Most Recent";
$this->lang['next'] = "Next";
$this->lang['of'] = "of";
$this->lang['page'] = "Page";
$this->lang['previous'] = "Prev";
$this->lang['rating'] = "Rating";
$this->lang['search'] = "Search";
$this->lang['showing'] = "Showing";
$this->lang['sort_by'] = "Sort By";
$this->lang['starring'] = "Starring";
$this->lang['title'] = "Title";
$this->lang['year'] = "Year";
}
else {
$this->lang['categories'] = "Catégories";
$this->lang['category'] = "Catégorie";
$this->lang['comments'] = "Commentaires";
$this->lang['country'] = "Pays";
$this->lang['description'] = "Description";
$this->lang['director'] = "Réalisateur";
$this->lang['jump_to'] = "Aller à";
$this->lang['length'] = "Durée";
$this->lang['more'] = "plus";
$this->lang['most_recent'] = "Récents";
$this->lang['next'] = "Suivant";
$this->lang['of'] = "of";
$this->lang['page'] = "Page";
$this->lang['previous'] = "Prev";
$this->lang['rating'] = "Note";
$this->lang['search'] = "Recherche";
$this->lang['showing'] = "Montrer";
$this->lang['sort_by'] = "Trier par";
$this->lang['starring'] = "Distribution";
$this->lang['title'] = "Titre";
$this->lang['year'] = "Année";
}
$this->fetch_get_vars();
}
there must be a better way.. so will see if i can find out whilst at work.