MyBB Community Forums

Full Version: Make your own Anime List.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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

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.
<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
Thanks for making this for our site!

Example:

You can see an example of it in action at https://pomf.cafe/anilist.php?u=domokun1134
https://atomiconline.wufoo.com/forms/mal...ification/

You should include that in your tutorial. MAL only allow a certain number of API requests before they b& you (or throttle) for a short time.
(2016-07-25, 01:20 PM)Marisa Wrote: [ -> ]https://atomiconline.wufoo.com/forms/mal...ification/

You should include that in your tutorial. MAL only allow a certain number of API requests before they b& you (or throttle) for a short time.

Ah yes thank you. I knew I was forgetting something. Appreciated
(2016-07-25, 01:28 PM)Garden of Sinners Wrote: [ -> ]Ah yes thank you. I knew I was forgetting something. Appreciated

No problem.

Consider also adding some form of pagination to this script in future versions to save on requests.

There's a pretty decent section in the tutorial below.

https://github.com/dragonexpert/tutorial...pment.html
To answer your concern; it's PHP in Templates that is required.
I love NarutoSmile