| ** | . | - |
Greatabase | programmable, extensible web multi-editor
 

Greatabase

Technical overview by Steve Fentriss of Fentriss.com

    • Greatabase takes a familiar web problem:

      • To edit an "X", you must first go to "_X_" website";
        To edit a "Y", you must first go to "_Y_" website";
        To edit any "Z", you must first go to "_Z_" website";

      And replaces it with this simple solution:

      • Open any "N" with Greatabase, and it will open program "_N_" for you.

       

      It does all this without forcing the editor programs to brand themselves as "Greatabase Apps", or any such nonsense.

    • A user opens up Greatabase and sees this:

      Users can have many categories (which are eerily similar to database tables)

      So, they click on a category and open a given record:

      Users can have many entries in a given category (which is eerily similar to having many records in a database table)

      Greatabase then asks itself two questions:

        Hmm...
      • What kind of record did they open?

      • Which program do they use for those?

      Based on its answers to those questions, it can then open the user's desired program.

      I always edit "notes" with my dad's program, "3,2,1 Notes"...

      I clicked on a note - obviously I want the computer to open up my note editing program.

      ...but I use a different program for photos, and a different one for html, and a different one for (you get the idea). Finally, I can make all these edits without leaving my web browser (or even my current browser tab).

    • As a web user, I got tired of having my stuff scattered across like fifty different websites.

      Instead of "your site > my stuff"..

      ...I wanted to do "my stuff > your site".

       

      As a web developer, I got tired of choosing between:

      • MORE MONEY:

        Build "my app" and sacrifice immediate fame

      • LESS WORK:

        Build "my (twitter|facebook|etc.) app" and sacrifice brand control

      I wanted more money and less work.

      • You're looking at one!

        Routines are server-side-scripts written in a simple, tag-based language. They are useful for outputting HTML code, displaying dynamic data from the Greatabase and helping users work with... stuff.

        Features of Routines:

        • To put HTML in a routine...

          <h1>This is...</h1>
          <p>
              <b>Sweet.</b>
          </p>

          ...just write the HTML.

        • Routines support tags like if, loop and var:

          <var my_list = "Me,Myself,You,I">
           
          My favorite people are:<br>
           
          <loop list="#my_list#" index="item">
              <if item NEQ "you">
                  - #item#<br>
              </if>
          </loop>

          The above code would produce:

          My favorite people are:
          - Me
          - Myself
          - I

          Notice that pound signs (#) are used to output variables. This means that if you want to literally write a pound sign, you need to escape the symbol by typing it twice:

          I wear #17, throw it to me!
        • Any routine can select, insert, update or delete data from the Greatabase.

          Routines always execute on behalf of the current user; they can only accomplish database tasks which that user is authorized to complete. The current user's name and id number are always dereferenced as user_name and user_id, respectively.

          Each table in the Greatabase is called an "orb". We always get a set of data from a given orb.

          Perform a query:

          <set orb="widget"
            select="widget.id,widget.title"
            where="widget.user_id = #client_id#">
           
              <!--- Store query in a variable: --->
              <var my_query = set>
           
          </set>
           

          Use the "setcrawl" tag to iterate over records:

          <set orb="note"
            select="note.id,note.title"
            where="note.title LIKE('how to%')"
            maxrows="10">
           
              <h3>Useful Notes:</h3>
              <setcrawl>
                 #set.title#<br>
              </setcrawl>
           
          </set>
           

          Add a new record:

          <insert orb="page"
            title="#some_variable#"
            notes="#some_other_var#">
           

          Update existing records:

          <update orb="page"
            title="#a_new_variable#"
            where="page.id = #some_id_number#">
           

          Delete existing records:

          <delete orb="user"
            where="user.id <> 0">
        • Encapsulation is the practice of storing commonly-used code separately from other code, so it can be easily reused. The art of encapsulation is sometimes called "don't repeat yourself", or "DRY" (ha!).

          Encapsulation in routines is particularly cool, because routines live on the web. So, as soon as you save a routine, it becomes instantly available to other routine programmers (unless, of course, you set it to "private").

          If I made a routine called "do_something":

          <h1>I did something!</h1>

          Then you could use it like this:

          <tag.do_something>

           

          You could also specify certain attributes...

          <tag.do_something color="blue">

          ...which my routine would handle like this:

          <h1 style="color:#att.color#">I did something!</h1>

      • Simply log into Greatabase and click "new routine":

        What program edits routines? An old (and newly revised) in-browser code editor called "Routiniverse".

      • Greatabase's default editor for routines is a program I made a few years ago (and recently revised) called "Routiniverse".

        Routniniverse not only provides an in-browser code editing experience, but also uses code auto-complete to hook you up to the world of routines made by other users. This saves you from typing things others have already typed, and also from coding things others have already coded.

        A screenshot of the Routiniverse editor.

        Opening a routine is just like opening any other record in Greatabase.

      • Routiniverse is the program that I used to make Greatabase. Nowadays, it is known mainly as Greatabase's default editor for routines.

        Routiniverse is also an independent website (Routiniverse.com) that you can use with or without your Greatabase account.

        The main reason we still use Routiniverse is because it is simply the most direct way to just get to a piece of code and begin editing it. Use it to see this page's source code, and you'll see what I mean.

         

        (Notice, by the way, that Routiniverse.com is an example of an editing program that interfaces with Greatabase, but exists largely on its own outside of Greatabase. Can you "spin-off", leave Greatabase and establish your own user base? Absolutely.)

    • To interface with Greatabase, you should make a routine. You can then program the routine to complete your desired Greatabase functions, or bring up an external resource in an iframe.

       
      Important Variables:
      • Greatabase will always send the following GET variables to your routine:

        • idnum

          ID number of record the user chose, number. Ex. 991238

          <var where_clause = "widget.id = #get.idnum#">
          <!--- use this in a query --->
        • otype

          Kind of record the user chose, string. Ex. "widget"

          <if get.otype NEQ "widget">
              <h3>Sorry!</h3>
              <p>I can edit only widgets.</p>
              <BREAK>
          </if>
      • In routines, these variables always tell us about the logged in user (this applies outside of Greatabase as well).

        • client_id

          ID number of logged in user. If "1", user is not logged in.

          <if client_id EQ 1>
              <h3>Please log in:</h3>
              <!--- login form: --->
              <tag.iqtpi_login>
              <BREAK>
          </if>
        • client_name

          Logged in user's name.

          <tag.roundedDiv>
              <h3>Hello, #client_name#!</h3> </tag.roundedDiv>
       
      Example Routines for Greatabase:

© 2007-present

 
 
about | news | search || © 2010
tech