MyBB Community Forums

Full Version: [1.8] XML Database League Plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
[1.8] XML Database League Plugin

Note:
First thanks for the community, i am learning to development in MyBB!
Thanks for the tutorials like: Plugin Authoring For Beginners, Plugins Explained, Plugin Basic, My First Plugin and all Guides are found in thise community, its very usefull.


XML Database League Plugin:
I Will Like to Created a Plugin in MyBB with Extensible Markup Language (XML) And Extensible Stylesheet Language (XSL). the purpose is to develop a SimpleCode Database League to can display in a simple form with MyBB to generate a League, Football Clubs / Leagues and Tournaments Information Like:
  • League
  • Teams
  • Logo Images Teams
  • Players
  • Standings
XML Schema Diagram :
League (Example: Premier League, LFP, World Cup 2014)
  • League
    • Teams 
    • Logo
    • Player (Position: Gk, DF, Med, DC) Info Player
    • City
  • Standings  
Note:
Created Stylesheet (XSL) to Generate a Template to Database in XML Schema!

Example Test On Line the Code:
http://diegopino.besaba.com/we11world/xmleague.xml
http://diegopino.besaba.com/we11world/xm...league.php

Requirement:
- Mybb 1.8.4 

How install XML Database League:
- Actived The Plugin in ACP

Download Plugin:
In That Post Attachment

Note
Based on my studies Learning XML, XSL And MyBB Board System

Collaborator and suggestions Are Welcome

Plugin Test OnLine:
goo.gl/DMZFvt


To Fix in next Version of Plugin:

- Study and Update the Schema of Database in Xml
- Add Logos or images
- Add Xml Leagues Code
- MyBB Performance Update
- More Suggest are welcome…

Enjoy!
Update XML Database League Plugin:
to install you should delete all files from the previous version and upload all the files of the New Version 1.1

Update Details:
  • Implement new code in XML
  • Add images folder
  • Add Code JavaScript
  • Add Template: Home » Template Sets » Global Templates » Add Template » xmleague_template
  • Video Tutorial: Add Template » xmleague_template
Code To Add Template in xmleague_template


<html>
<head>
<title>XML Database League</title>
{$headerinclude}

<script type="text/javascript">
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.open("GET", "xmleague.xml", false);
            xmlhttp.send();
            xmlDoc = xmlhttp.responseXML;
            var x = xmlDoc.getElementsByTagName("Team");

            function displayXMLeague(i) {
                var leagueElement = x[i];
                Team_Name = (leagueElement.getElementsByTagName("Team_Name")[0].childNodes[0].nodeValue);
                description = (leagueElement.getElementsByTagName("description")[0].childNodes[0].nodeValue);
                City = (leagueElement.getElementsByTagName("City")[0].childNodes[0].nodeValue);
                Stadium = (leagueElement.getElementsByTagName("Stadium")[0].childNodes[0].nodeValue);

                var players = leagueElement.getElementsByTagName("first_name");
                var player;
                var playerString;
                for(var index = 0; index < players.length; index++)
                {
                    player = players[index];
                    if (index == 0)
                    {
                        playerString = player.childNodes[0].nodeValue;
                    }
                    else
                    {
                        playerString = (playerString + "<br />" + player.childNodes[0].nodeValue);
                    }

                }

                Players = playerString;
                image = (leagueElement.getElementsByTagName("image")[0].childNodes[1].childNodes[0].nodeValue);
                txt = "<b>Team_Name:</b> " + Team_Name + "<br><b>description:</b> " + description + "<br><b>City:</b> " + City + "<br><b>Stadium:</b> " + Stadium + "<br><b>Players:</b> " + Players + "<br><b>image:</b>" + image;
                document.getElementById("showXMLeague").innerHTML = txt;
            }

            displayXMLeague(0);
        </script>
	
</head>
<body>
{$header}

<h2>List of Premier League clubs </h2>
<p><small><i>Update with More <ins>Teams Clubs And Leagues</ins>... for the next version</i></small> </p>
	

<div id='showXMLeague'>Click on a Team Club to display information.</div><br>
<script>
document.write("<table border='2'>");
for (var i=0;i<x.length;i++)
  { 
  document.write("<tr onclick='displayXMLeague(" + i + ")'>");
  document.write("<td>");
  document.write(x[i].getElementsByTagName("Team_Name")[0].childNodes[0].nodeValue);
  document.write("</td><td>");
  document.write(x[i].getElementsByTagName("City")[0].childNodes[0].nodeValue);
  document.write("</td></tr>");
  }
document.write("</table>");
</script>
	
{$footer}
</body>
</html>


How install XML Database League:
- Actived The Plugin in ACP

Collaborator and suggestions Are Welcome…



Plugin Test OnLine:
http://goo.gl/DMZFvt

Test OnLine Plugin

Smile
If this is a release, which it seems to be, you should rather upload it here: http://community.mybb.com/mods.php?actio...ry=plugins and then create a thread here: http://community.mybb.com/forum-102.html Plugins here are considered not safe to use on live boards.
(2015-07-06, 12:40 PM)Destroy666 Wrote: [ -> ]If this is a release, which it seems to be, you should rather upload it here: http://community.mybb.com/mods.php?actio...ry=plugins and then create a thread here: http://community.mybb.com/forum-102.html Plugins here are considered not safe to use on live boards.

Thanks for the Comment, I'll update the information plugin in those Forums Support!

You Are Welcome!

http://docs.mybb.com/mods/owners/#mods-s...ect-owners


Smile
I am still studying but I think... at this point to continue with the Plugin Development need help...

The Stylesheet Language .xsl  in the file .xml does not work for Display Style MyBB?  Why? 

Example Online:

xmleague.xml
xml-database-league.php  (Plugin Read The File xmleague.xml but not Display the Stylesheet .xsl) in MyBB.
XSLTLeague.xsl  Stylesheet for the File xmleague.xml

<?xml-stylesheet type="text/xsl" href="XSLTLeague.xsl" ?>


Any suggestion or recommendation is welcome!

Thanks in Advance for the Support!

bye