View Full Version : imdb integration
lebanon
05-26-2005, 11:51 AM
Hello,
I have this imdb source that is working fine as in searching and fecthing information from imdb , anyway none of the files that the whole code is based on , i wasnt able to add on any of them the header and/oor footer of vb .
Am confused, whenever i try ti include the global.php and the header template they are parsed but my code is not, or vise versa !
here is a sample of one of the pages am trying to include a header and footer for ;
<?
require_once("imdb_config.php");
require_once("imdb.class.php");
$conf = new imdb_config;
echo "<HTML><HEAD><TITLE>cache</TITLE></HEAD><BODY>";
$movie = new imdb ("0");
if ($d = opendir ($conf->cachedir)) {
while (false !== ($entry = readdir ($d))) {
if (strstr ($entry, "Title")) {
$imdbid = substr ($entry, 0, 7);
// echo $imdbid."<BR>";
$movie->setid ($imdbid);
echo "<a href=imdb.php?mid=";
echo $imdbid;
echo ">";
echo $movie->title ();
echo "</a>";
echo " <a href=\"http://us.imdb.com/title/tt";
echo $imdbid;
echo "\">imdb page</a>";
echo "<br>\n";
}
}
}
echo "</BODY></HTML>";
?>
any ideas ?
id like those file to have same theme as my forum !
Oh, i tried it using logician web templates hack , if i parse them using the template body as php , they show up alone , and if i parse them using his INCLUDE field ( he already stated the result there anyway) its parsed above the header .
Reeve of shinra
05-26-2005, 03:17 PM
Take a look at the vb tutorial section for how to create a vb powered webpage (https://vborg.vbsupport.ru/showthread.php?t=62164).
That will give you the tie in to use the vb header and footer to call a template.
You can add most of your script in to the body part of that tutorial but I think you'll need to strip out the echos and call that via the variable in the template.
Hope this helps. I am curious to see how this turns out.
ericgtr
05-26-2005, 03:24 PM
I dug this up at sourceforge and installed it, it's pretty cool stuff. I don't have a real need to integtrate it into my board but like Reeve mentions, all the echos would have to be removed and the variables outputted to templates. Not a major task but still a pain, it wouldn't be too hard to integrate with a little time though.
Logician
05-29-2005, 07:23 AM
Hello,
I have this imdb source that is working fine as in searching and fecthing information from imdb , anyway none of the files that the whole code is based on , i wasnt able to add on any of them the header and/oor footer of vb .
Am confused, whenever i try ti include the global.php and the header template they are parsed but my code is not, or vise versa !
here is a sample of one of the pages am trying to include a header and footer for ;
<?
require_once("imdb_config.php");
require_once("imdb.class.php");
$conf = new imdb_config;
echo "<HTML><HEAD><TITLE>cache</TITLE></HEAD><BODY>";
$movie = new imdb ("0");
if ($d = opendir ($conf->cachedir)) {
while (false !== ($entry = readdir ($d))) {
if (strstr ($entry, "Title")) {
$imdbid = substr ($entry, 0, 7);
// echo $imdbid."<BR>";
$movie->setid ($imdbid);
echo "<a href=imdb.php?mid=";
echo $imdbid;
echo ">";
echo $movie->title ();
echo "</a>";
echo " <a href=\"http://us.imdb.com/title/tt";
echo $imdbid;
echo "\">imdb page</a>";
echo "<br>\n";
}
}
}
echo "</BODY></HTML>";
?>
any ideas ?
id like those file to have same theme as my forum !
Oh, i tried it using logician web templates hack , if i parse them using the template body as php , they show up alone , and if i parse them using his INCLUDE field ( he already stated the result there anyway) its parsed above the header .
Regarding webtemplates:
* Set parsing as HTML or TEXT (not PHP).
* Put your code into seperate .php file where view.php resides (eg. mycode.php)
* Use this code in your webtemplate's phpinclude field:
ob_start();
include("mycode.php");
$my_code = ob_get_contents();
ob_end_clean();
* Then you can use $my_code variable to paste the content of your php file in anywhere you like in your webtemplate.
lebanon
05-30-2005, 11:24 AM
Hi guys,
thanks for your advices ,
regarding the first two replies , i tried to do that and since am not good at php i wasnt able to , and when i tried playing around , it returned variables messed up
Or it returned blank files !
Another thing , the cache file is one listed above , for example the imdbsearch file gets posted data ( method post in search box ) and the imdbsearch uses _GET ,
Adding global.php somehow stops the rest from being parsed and i dont know why !
As for logician suggestion i will try now , but logically speaking cache.php code (above code) will work but as for imdbsearch .php am confused if it will work because
example : imdbsearch.php?name=Rock ( is a sample of a posted request )
Logician templates will require | /forum/view.php?pg=test
So if i parse the search within it , how should i post the data to url ?
Is it possible logician ?
If its not , is there a way to just include the header to other sections of my website located outside of it !
The problem is i have many free sections outside my forum and movies search is one of them , i wish to include headers so users ( might be tempted to register ) and widen my users database !
Just an update ,
Logician advice made the cache.php work fine ,
But as i expected that wouldnt just work for the search.php !
imdbSearch gets variables from a post like :
<FORM ACTION="imdbsearch.php" METHOD=get>
<p>
<INPUT TYPE="text" NAME="name" SIZE=30 MAXLENGTH=50><BR>
<INPUT TYPE="submit" VALUE="Submit">
Even if i included the imdbsearch in ob_start as above example
and changed the form to post name=pg and value=movies (for example )
And the link will show as view.php?pg=movies&name=rock (for example )
but the variable is not passed to the included moviesearch and will not be excuted .
Again my whole porpuse is to include the HEADER to a PHP file and making a VB page example using templates works when ur adding HTML page , anything including codes or php GET or POST will not be passed , unlike what i want .
Logician
05-30-2005, 07:29 PM
define "$name" in the outside variables of your webtemplate so that webtemplate will not clear it.
lebanon
05-31-2005, 05:19 PM
hello
how do u mean add it as an outside variable ?
name is what it gets from http get variable ...
oh why am speaking it , here is the code line
<?
require ("imdbsearch.class.php");
$search = new imdbsearch ();
$search->setsearchname ($HTTP_GET_VARS["name"]);
echo "<HTML><HEAD><TITLE>search</TITLE></HEAD><BODY>";
$results = $search->results ();
foreach ($results as $res) {
echo "<a href=imdb.php?mid=";
echo $res->imdbid();
echo ">";
echo $res->title();
echo "(".$res->year().")";
echo "</a> ";
echo " <a href=\"http://us.imdb.com/title/tt";
echo $res->imdbid();
echo "\">imdb page</a>";
echo "<br>\n";
}
echo "</BODY></HTML>";
//echo $search->page;
?>
if you want check the normal excuted code at
http://www.tchatting.com/forum/imdbsearch.php?name=rock
when we create a web template the code new link will look like
http://www.tchatting.com/forum/view.php?pg=moviesearch&name=rock
The idea would be great if the results are passed within the template itself !
Logician
05-31-2005, 05:40 PM
Screenshot will help
lebanon
06-07-2005, 09:48 AM
sorry i havent replied this for a while, i had too much work , ill try your method again and let you know of my results , thanks again !
KevinL
06-07-2005, 10:20 AM
I was actually thinking about something like this just the other day.
I would like to know how this turns out :)
lebanon
06-08-2005, 10:50 AM
Hi again , and thanks to Logician and his great suggestion of the ob_start ,
ob_start();
include("mycode.php");
$my_code = ob_get_contents();
ob_end_clean();
Except that it didnt work exactly as the $name variable wouldnt pass
so i finally did the include line replaced with the line below :
include "http://www.tchatting.com/forum/imdb.php?mid=".$mid."&xm=".$xm;
now the pages do load , and the form to post works as well , i still have a minor issue am going to solve by today which is trimming white spaces.
As for example : when searching for "the end" will make the url go like : "the+end" and that will break the eval code which logician templates use .
From the form i will trim the white spaces as i noticed that searching for "theend" does return the same results , although i do find this a bit annoying as am afraid some movies will not return a search result if it didnt find it in IMDB without the spaces.
IF there is a way to leave the + without affecting the eval parse error in Logician templates it will be nice , if not i will use the removal of white spaces from the initial form poster.
I will update u with results anyway.
Hi again !
Finally its working ...
I wasted a bit of time trying to trim the user search movie input before its sent to the url then i was like i said wasting my time , i just did it through Logician templates ( thanks again to logician where his hack made this possible )
I used str_replace to the string above to eliminate the white spaces in the line , then i have now a working demo
http://www.tchatting.com/forum/view.php?pg=movies
Thanks again for the help logician , your tips made it possible !
I'll attach the files related to this later on here depending on which section is suitable or if anyone is interested anyway !
KevinL
06-08-2005, 08:27 PM
That looks excellent!
Nice work :)
I wouldnt mind knowing how you got it to work. I got a lot of positive feedback when I added just a IMDB VBA portal, so Im sure people would love this.
lebanon
06-09-2005, 10:33 AM
Ok where should i post this in which section ?
As i dont have the right to call it my hack , i wouldnt have done it except for logician templates , so maybe a logician templates " imdb templates addon?"
KevinL
06-09-2005, 10:33 PM
I guess you could post it here in beta (https://vborg.vbsupport.ru/forumdisplay.php?f=34) or in Full (https://vborg.vbsupport.ru/search.php?searchid=1295625) releases.
I would also ask logician if it would be ok if you can call it a 'add on' or to just make a mention that you first have to use his hack in order to have this one work. :)
lebanon
06-10-2005, 09:04 AM
KevinL thanks for the advice , i just sent him a prvt msg and waiting his reply
Am writing a readme file on how to install this , except that i added manual entries in the files users will have to change manually and not only a config file.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.