Quantcast
Channel: MyBB Community Forums - Tutorials
Viewing all articles
Browse latest Browse all 690

Make your own Anime List.

$
0
0
I was not sure whether this belonged in integration or tutorials but I felt it was probably safer to post it in this section.

Requirements:
PHP in Templates or Template Conditionals I cannot for the life of me remember which ones was needed.
White-List your application to prevent throttle/ban

Step 1:

make a new file with the following code and upload it to your forums root directory.
PHP Code:
<?php

define
('IN_MYBB'1); require "./global.php";
add_breadcrumb("Page Title""File Name.php");
eval(
"\$html = \"".$templates->get("Template name")."\";");
output_page($html);
?>

Step 2:

After you've done that go to Templates & Style -> Templates -> Global Templates -> Add Template

Enter this code and name the template whatever you set the template name to be in the first file.
PHP Code:
<html>

<
head>
    <title>Anime List.</title>
    {$headerinclude}
</
head>
<
body>
    {$header}

<
center>

<
table>
    <
tr>
      <
td class="thead" colspan="1" style="text-align:center;">Image</td>
      <td class="thead" colspan="1" style="text-align:center;">Anime Title</td>
      <td class="thead" colspan="1" style="text-align:center;">Status<br></td>
      <td class="thead" colspan="1" style="text-align:center;">Episodes Out</strong><br></td>
      <td class="thead" colspan="1" style="text-align:center;">Episodes Watched<br></td>
      <td class="thead" colspan="1" style="text-align:center;">Score<br></td>
    </
tr>
    
<?
php 

$user
$_GET["u"];
$mypix simplexml_load_file('http://myanimelist.net/malappinfo.php?u=' $user '&status=all&type=anime');

    foreach (
$mypix->anime as $pixinfo):
        
        echo 
"<tr>";
        
        
$title $pixinfo->series_title;
                $image $pixinfo->series_image;
                $episodes $pixinfo->series_episodes;
                $status $pixinfo->series_status;

    if ($status == "1") {
      $status "Watching";
    } elseif ($status == "2") {
      $status "Completed";
    } elseif ($status == "3") {
      $status "On-Hold";
    } elseif ($status == "4") {
      $status "Dropped";
    } elseif ($status == "5") {
      $status "Plan to Watch";
    }else {
      $status "No idea.";
  }

                $score $pixinfo->my_score;
                $watch $pixinfo->my_watched_episodes;
        
        echo "
              <td><center>
{$image}</center></td>
              <td><center>
{$title}</center></td>
              <td><center>
{$status}</center></td>
              <td><center>
{$episodes}</center></td>
              <td><center>
{$watch}</center></td>
              <td><center>
{$score}/10</center></td>";
        
        echo 
"</tr>";
        
    endforeach;
?>
</table>
</center>

    {$footer}
</body>

</html> 

And your done.

Explanations:

$user= $_GET["u"]; : This means that the results will change depending on the user you input for example https://example.com/pagename.php?u=example1 will show different results than https://example.com/pagename.php?u=example2 (One small bug is that the page will display only the table with no information if you do not input a user there)

End Result:

[Image: ns6zrGm.png]

Credits:

My Onii-chan. <3

Viewing all articles
Browse latest Browse all 690

Trending Articles