Mashup (Formula-Share on your website)

You can easy integrate Formula-Share functions in your own webpage.



XMLRPC Interface

Start

# Script language: Python

from xmlrpclib import ServerProxy
s = ServerProxy("http://www.formula-share.net/xmlrpc")

               # Parameters:
ret = s.formulas.addFormula("a^2 + b^2 = c^2", # TeX
                            "some formula",    # Title
                            "",                # Description
                            "",                # Founder
                            "Andreas",         # Name of poster
                            -1,                # Response to-ID (if it's no response, set to -1)
                            "http://www.formula-share.net/", # The site which posted the formula (your site)
                            "cool, formula"    # Tags
                           )

               # Title, Description, Founder, Name of poster and Tags can be a empty string.
               # Note: Tags is a string, comma-seperated (no array!)



if ret["error"] == 0:
   print "Link: %s" % ret["link"]
   print "Image: %s" % ret["imgurl"]
else:
   print "Error-Nr: %i" % ret["error"]  # 0 on success,
                                        # Bit-Mask when errors are occurred:
                                        #    Note: in Python, Exponentiation is not ^, it is ** (e.g. 2**2 == 4)
                                        #
                                        #    No TeX given        := 2^0
                                        #    Invalid TeX         := 2^1
                                        #    Unknown Response ID := 2^2

Methods

  • formulas.addFormula (tex, title, description, founder, name, tags)


Including images

You are allowed to include Formula-Share-Images on your website.
If it doesn't make you much troubles, please link that image to the Formula-Share-View-Site.

Example (XHTML):

<a href="http://www.formula-share.net/view/1/Satz-des-Pythagoras/"><img src="http://www.formula-share.net/viewimg/1.png" /></a>