I recently started creating a diablo-fansite at d3base.de. It's mainly about items, and thus the first thing i created was an item-database that let's you easily configure different stats/qualities/types and subtypes of items. Well and I created a way to embed those items:
this has to go into the head of the site:
Code:
<script type="text/javascript">
//id: id of the item in the database
//taget: id of the target container in the document (must be unique)
function loadd3item(id, target){
//what this does is, it actually dynamicly creates a new javascript tag which then loads it's own source from my site..it also passes the name of the target div, so the content can write itself into it!
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", "http://www.d3base.de/viewitem_embed.php?id=" + id + "&" + "obj=" + target)
//meep meep
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)
//d3base.de - Finn Sohst
}
</script>
and now you can embed items with:
Code:
<div id="test"></div>
<script type="text/javascript">loadd3item(15,"test")</script>
while the div-id has to be unique of course and the "15" resembles the id of the item in the database...
perhaps this could be useful in the wiki ?!