2012-09-03, 01:55:05
I am trying to add the ability to use http://www.themoviedb.org api to my website. I am basing the api calls on the this PHP wrapper.
This is where I am so far. I installed the wrapper functions into a subdir of my theme. I created a functions.php file and added this code
If I include this call within my template file
I get the url to the movie poster displayed on my page.
If I put the same code inside of the special page "View" code i get the following error message
So how do I incorporate a function with a Special Page
This is where I am so far. I installed the wrapper functions into a subdir of my theme. I created a functions.php file and added this code
Code:
<?php
include ('tmdb/tmdb.php');
$tmdb = new TMDb('555e29f581da1199bf3edb0a1e803a74');
function displayMoviePoster($id, $t)
{
//assign array
$pelinfo = $t->getMovieImages($id);
//set remote file path
$filepath = $pelinfo["posters"]["0"]["file_path"];
//set remote url
$image_url = $t->getImageUrl($filepath, TMDb::IMAGE_POSTER, 'w154');
echo $image_url;
}
?>
If I include this call within my template file
Code:
<?php displayMoviePoster(105, $tmdb);?>
If I put the same code inside of the special page "View" code i get the following error message
Code:
<img src="<br />
<b>Notice</b>: Undefined variable: tmdb in <b>/f5/webmccord/public/plugins/i18n_specialpages/specialpages.class.php(224) : eval()'d code</b> on line <b>29</b><br />
<br />
<b>Fatal error</b>: Call to a member function getMovieImages() on a non-object in <b>/f5/webmccord/public/theme/clean-simple/functions.php</b> on line <b>8</b><br />
So how do I incorporate a function with a Special Page