|
|
| Author |
Message |
Maxx
Not So New User
Joined: 13 Jul 2003
Posts: 67
|
Posted: March 31st 2007, 8:45 am Post subject: Rewrite TV-Guide script |
|
|
Hi,
I've a site about TV-series (Dutch) and I've found a PHP-script by a guy named Flesh [Belgium] for a TV-Guide (mainly Dutch and Belgium networks). One of my crewmembers, Feolener, rewrote the script a little to make it suitable for our site. The rewritten result looks like this, but I want to let it look something like this (I used my limited html and php-skills for this last example).
My question: is there anybody here who can rewrite te script below into a true phpBB-script with a corresponding tpl-file? I would be very thankful for this.
| Code:
|
<?
//Instellingen:
//vul hier de zenders in welke je wilt showen..
$arDisplayZenders = array('Nederland 1', 'Nederland 2', 'Nederland 3', 'RTL 4',
'RTL 5', 'RTL7', 'Net 5', 'SBS 6', 'Veronica', 'Tien', 'Nickelodeon',
'Een', 'Ketnet/Kanvas', 'The Box', 'TMF', 'MTV', 'BBC 1', 'BBC 2');
//Aantal kolommen breed
$columns = 4;
if(!$_GET['tvall'])
{
//Bron openen of foutmelding geven
$bron = @file("http://www.tvgids.nl/nustraks/index.php?volledig=1");
$found = 0;
//Variabelen Declareren
$gevonden = 0;
$originalzender = '';
$programmanaam = array();
$programmatijd = array();
$teller = 0; // wordt gebruikt voor het tellen van het aantal zenders om de kolommen te bepalen
echo "<table><tr>";
foreach ($arDisplayZenders as $zender)
//while ($zender = each ($arDisplayZenders))
{
$zender = str_replace(' ', '', $zender);
$zender = str_replace('é', 'e', $zender);
$zender = strtolower($zender);
if (($zender == 'nederland1') || ($zender == 'nederland2') || ($zender == 'nederland3') || ($zender == 'z@ppelin')){ $tabblad = 0; }
if (($zender == 'rtl4') || ($zender == 'trl5') || ($zender == 'yorin')){ $tabblad = 1; }
if (($zender == 'sbs6') || ($zender == 'net5') || ($zender == 'veronica')){ $tabblad = 2; }
if (($zender == 'nickelodeon') || ($zender == 'cartoonnetwork') || ($zender == 'tien')){ $tabblad = 3; }
if (($zender == 'bnv') || ($zender == 'een') || ($zender == 'ketnet/canvas')){ $tabblad = 4; }
if (($zender == 'bbc1') || ($zender == 'bbc2') || ($zender == 'bbcprime')){ $tabblad = 5; }
if (($zender == 'bbcworld') || ($zender == 'cnn') || ($zender == 'eurosport')){ $tabblad = 6; }
if (($zender == 'discoverychannel') || ($zender == 'nationalgeographic') || ($zender == 'animalplanet')){ $tabblad = 7; }
if (($zender == 'tmf') || ($zender == 'mtv') || ($zender == 'thebox')){ $tabblad = 8; }
if (($zender == 'ard') || ($zender == 'zdf') || ($zender == 'rdl')){ $tabblad = 9; }
if (($zender == 'ndrfernsehen') || ($zender == 'sudwestfernsehen') || ($zender == 'wdrfernsehen')){ $tabblad = 10; }
if (($zender == '3sat') || ($zender == 'sat1') || ($zender == 'pro7')){ $tabblad = 11; }
if (($zender == 'vtm') || ($zender == 'kanaal2') || ($zender == 'vt4')){ $tabblad = 12; }
if (($zender == 'rtbfla1') || ($zender == 'rtbfla2') || ($zender == 'tv5')){ $tabblad = 13; }
if (($zender == 'raiuno') || ($zender == 'trtint.') || ($zender == 'tve')){ $tabblad = 14; }
if (($zender == 'at5') || ($zender == 'tvnoord-holland')){ $tabblad = 15; }
if (($zender == 'tvwest') || ($zender == 'regiotvutrecht')){ $tabblad = 16; }
if (($zender == 'arte') || ($zender == 'tcm') || ($zender == 'mezzo')){ $tabblad = 17; }
if ($zender == 'spiceplatinum'){ $tabblad = 18; }
if (($zender == 'canal+rood') || ($zender == 'canal+blauw') || ($zender == 'canal+geel')){ $tabblad = 19; }
//debug output
if ($_GET['debug']==1)
echo "<br><b>Debug Zender: ".$zender."</b><br>";
//Bron uitlezen
$bron = @file("http://www.tvgids.nl/alleprogrammas/?tab=".$tabblad);
for($regel=0;count($bron)>$regel;$regel++)
{
if ((eregi('<caption>', $bron[$regel])) && $gevonden == 0){
//Zenders
$p=strpos($bron[$regel], 'alt="');
$p2=strpos($bron[$regel], '" />');
$zenders=substr($bron[$regel], ($p+5), ($p2-$p-5));
$zenders = str_replace(' ', '', $zenders);
$zenders = str_replace('é', 'e', $zenders);
$zenders = strtolower($zenders);
//Indien gevonden, switch verzetten
if ($zender == $zenders){
$gevonden = 1;
if (!$originalzender){
$originalzender=substr($bron[$regel], ($p+5), ($p2-$p-5));
$originalzender = str_replace('é', 'e', $originalzender);
}
}
}
//Indien begin nieuwe zender gevonden , stoppen met zoeken
if ((eregi('<caption>', $bron[$regel+1])) && $gevonden == 1){
$gevonden = 0;
}
//Programmagegevens uitlezen
if ((eregi('<th width="25">', $bron[$regel])) && $gevonden == 1){
//Tijd
$p=strpos($bron[$regel], '<th width="25">');
$p2=strpos($bron[$regel], '</th>');
$programmatijd[]=substr($bron[$regel], ($p+15), ($p2-$p-15));
//Naam
$bron[$regel+1]=str_replace('<td><div><a href="/programmadetail/', '', $bron[$regel+1]);
$p=strpos($bron[$regel+1], '>');
$p2=strpos($bron[$regel+1], '</a></div></td>');
$programmanaam[]=substr($bron[$regel+1], ($p+1), ($p2-$p-1));
}
}
if ($teller > 0 && $teller % $columns == 0)
echo "</tr><td> </td><tr>";
echo "<td valign=top width=200>";
$teller++;
if (count($programmatijd) > 0)
{
echo "<strong>".$originalzender."</strong><br>";
echo "<table>";
for($nr=0;count($programmatijd)>$nr;$nr++) {
echo "<tr><td valign=top width=25>";
echo $programmatijd[$nr] ;
echo "</td><td>".$programmanaam[$nr];
echo "</td></tr>";
}
echo "</table>";
} else {
echo "<strong>".$zender."</strong><br>";
echo "<table>";
echo "<tr><td valign=top>";
echo "Programmering " .$zender. " niet gevonden!";
echo "</td></tr>";
echo "</table>";
}
$originalzender = '';
$programmanaam = NULL;
$programmatijd = NULL;
echo "</td>";
}
}
?>
|
|
|
| Back to top |
|
 |
Afkamm
Well Known User
Joined: 20 Oct 2004
Posts: 238
Location: Scotland
|
|
| Back to top |
|
 |
Maxx
Not So New User
Joined: 13 Jul 2003
Posts: 67
|
Posted: March 31st 2007, 11:16 am Post subject: |
|
|
Tnx Afkamm, I really appriciate that! _________________ SerieJunkies.nl - Nederlands forum over TV-series. |
|
| Back to top |
|
 |
Afkamm
Well Known User
Joined: 20 Oct 2004
Posts: 238
Location: Scotland
|
|
| Back to top |
|
 |
Maxx
Not So New User
Joined: 13 Jul 2003
Posts: 67
|
Posted: April 1st 2007, 1:13 am Post subject: |
|
|
You mean that users would be able to select which channels should be shown? And that the page 'remembers' their settings? If that's what you mean, I must say I hadn't even thought about such a feature, but a personal TV Guide for every user sounds really cool.
Since you clearly understand this stuff better then me, I have another question. Would it be possible to filter out the series and soaps and just display those (since that's what the forum is about) or, dare I say it, give the user an option to either "show all" or just "show series\soaps"?
On the site we get the information from, there's a seperate page for that (see here), but we haven't been able to filter that, so the information might come from another sourcepage. |
|
| Back to top |
|
 |
Afkamm
Well Known User
Joined: 20 Oct 2004
Posts: 238
Location: Scotland
|
|
| Back to top |
|
 |
Maxx
Not So New User
Joined: 13 Jul 2003
Posts: 67
|
Posted: April 1st 2007, 10:51 am Post subject: |
|
|
| I'm not exactly sure what you meant in your last post. Can you show me an example of what you meant? |
|
| Back to top |
|
 |
Afkamm
Well Known User
Joined: 20 Oct 2004
Posts: 238
Location: Scotland
|
|
| Back to top |
|
 |
Maxx
Not So New User
Joined: 13 Jul 2003
Posts: 67
|
Posted: April 1st 2007, 11:10 pm Post subject: |
|
|
That looks amazing!!!
I'll react more tonight (have to go to work now).
Edit: Couldn't do a new post, so I will react here futher:
---------------------
Hi Afkamm,
So far I'm really impressed by you work, it looks incredible. I was wondering if the following changes\extras are possible:
---
1) Instead of a page where the user choses the channels and where 2 programs per channel are displayed, is it possible to make a table on the top of the page with the channels (without any programs) for the user to choose from? And when the user chooses and submits the channels that they would display beneath this table?
2) In the channel-selection-screen, is it possible to have a "Select all"-button there?
3) This one is the hardest (I think), but also the coolest modification. Is it possible that for every program the page displays, the program first looks in the database (within a couple of defined subforums) to see if there's a topic about the program. And if so, that the name of the program is linked to the specific topic?
After a bit of brainstorming we thought there should be a query where it says something like select id from series where name = 'topicname' and then a replace-function where <a href='...php?id=xxx'>programname</a> replaces the actual programname.
Also for programs starting with The or De (which are in our topicnames are defined as for example Deadzone, The) the query should be a bit more advanced, like: where topicname like '%the%' and topicname like '%dead%' and topicname like '%zone%'
4) The forum is about TV-series (including soaps). On the TVGids.nl-page they have a page where they just show the series (and soaps). It would be great if 'our' TV Guide would display only those series (and soaps) and exclude programs as news, sports, movies etc. Or, even better, if the user would be able to choose if they want to "Show series" or "Show all".
---
I know I am asking a lot, but again, the work you did thusfar is awesome and these changes\extras are just possibilities we where wondering about.
Tnx for doing this much already! |
|
| Back to top |
|
 |
Afkamm
Well Known User
Joined: 20 Oct 2004
Posts: 238
Location: Scotland
|
|
| Back to top |
|
 |
|