Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Special page with external functions
#1
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
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);?>
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

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
Reply


Messages In This Thread
Special page with external functions - by jay_m - 2012-09-03, 01:55:05
Special page with external functions - by shawn_a - 2012-09-03, 02:32:06
Special page with external functions - by jay_m - 2012-09-03, 23:26:48
Special page with external functions - by shawn_a - 2012-09-03, 23:53:21



Users browsing this thread: 1 Guest(s)