Publishing EQL Data live tables and queries on your web site

Question

I have my database tables published to EQL Data and I can browse and chart them using the web database viewer. How do I put them on my own web site so customers can see them?

Answer

Any EQL Data table or query can be embedded into an html page and styled however you want. You do this by adding a <script> tag to your page. The code looks like this:

<script type="text/javascript"
  src="http://eqldata.com/db/test1db/MyTest/Table/Junk.ehtml?jsonp=document.write&header=1&comments=1&maxrows=5&filter=a&highlight_tag=strong">
</script>

If you paste the above code into your web page, then the result will look something like this:

(In fact, this article is actually using the <script> tag to generate the above table.)

Matching your web site's style

The fragment above generates a simple HTML table that gets styled according to your document's CSS.

(Loading...)

You can define the look of EQL tables simply by overriding the CSS style for the .eqltable class. For example:

.eqltable th {
    font-size: 2.2em;
    font-weight: bold;
}

Options

The script src URL can contain zero or more option flags. Here's what they do:

    m: the data mode, one of ehtml ("embedded html"), json, or
    yaml. We used ehtml in this example so that we can simply paste the html directly into our document. You can provide the mode either as a parameter (like ?m=json) or as a file extension (like .json).

    jsonp: the JSON prefix, used for converting the data into a valid <script> tag. Here, we used document.write, which produces a simple javascript command to write the raw html into your document. (More about JSONP.) If you just want to retrieve the data using a CGI or PHP script, you can leave out the jsonp flag.

    maxrows: the maximum number of data rows to return. Defaults to 20.

    filter: the search keywords. Only rows that match the filter will be returned.
    filter is a full-text search, so it searches across all columns in a particular query.

    highlight_tag: the html tag to use for highlighting search results. The default is "strong", which uses the <strong> tag for highlighting. In our example, we searched for "a", so every instance of the letter "a" in the result is printed as
    <strong>a</strong>.

    comments: enable or disable "comment" rows in the table, such as "Not all rows are shown" and "No matches."

    header: enable or disable the first (header) row in the table.

Related Articles

Unrelated Articles