Results 1 to 4 of 4

Thread: Lianja architecture and integration in details

  1. #1
    Junior Member
    Join Date
    Jan 2015
    Posts
    1

    Lianja architecture and integration in details

    So I am a beginner in Lianja, after watching all the video tutorials, I understood some of the basic features of the click and drops. Unfortunately, I still have no idea where the coding begins and how they integrate.

    I have no idea where to put lianja code vs where to put the PHP code, and what are the limit of these codes. For example, I tried putting echo 'hello world' (simple PHP) and see how that would affect a section / gadget, but I don't see hello world displayed anywhere in any section / gadget. So is there a limitation on the PHP codes I can write? How do they integrate into Lianja code base and the UI components?

    I've read a lot of documentations but they are all over the place, there is no concentrated subject on this matter and each forum thread addresses a small part of this big question that raises more questions than they answer.

    Thanks

  2. #2
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hi acrien,

    Welcome to the Lianja community.
    I think most people are overwhelmed when they are first introduced to Lianja.

    One of the documentations is the developer's guide.
    http://www.lianja.com/documentation/developers-guide

    This guide introduces people on how to program in Lianja using VisualFoxPro, PHP, Javascript and Python.
    Take a look at this and try some of the example.

    Hopefully this will help to sort out some of your questions and ease your confusion.

    Cory

  3. #3
    Hi acrien,

    Bear in mind that Lianja is designed to help you be as productive as possible by allowing you to create Apps with little to no code. That being said, you can use code in a couple of ways. First, you can write code to be executed by custom delegates at the Page, Section, or Field level. The other way to use code in Lianja is in a Custom Section where you can write anything you like. There are examples of each in the Lianja Demo App. Hopefully this will help you to get started.
    Last edited by barrymavin; 2015-02-04 at 18:59.

  4. #4
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Hi acrien

    You do not need to be frustrated. We all had such confusion.
    PHP is just fine and stick with it in delegates as you are comfortable with it. For example I am VFP developer and now javascript does not seems so strange to me.

    For beginning I would suggest you make copy of apps folder. Then open some demo app written in PHP and insert your code somewhere, run to see what happened.

    Where you can find demo in "your" language? This link might help (not so outdated):
    http://www.lianja.com/community/show...ipting-languag

    Lianja is datacentric. You want to make an application which will show your tables in some relation, so your end user will Create new records/rows, Read it, Update and Delete (CRUD). Thinking that abstract way: you drag tables (sections) and define relations visually. These are Standard sections which are responsible for all CRUD and are doing this automatically.

    Second way is Custom section. Here you write more code in your language according object hierarchy (same for all languages). Lianja is live, connected to data. As you add code, your page get more and more stuff. Even you reenter, all is there for ever. And all without any designer.

    Third way is Canvas section. More dragging of visual elements we used to, but running it - you will see it is not responsive for various devices and resolutions. Not nice.

    If you are here for desktop applications, all ways are yours, pick any or mix.
    If you tend to nondesktop applications only, or all (desktop + nondesktop), than you need to separate client and server side.
    For client side VFP guys need to use javascript in delegates/methods which web browsers understand. This is bad news for us. VFP is good for server side only.
    We can use only Standard sections or javascript version of Custom section or javascript version of Canvas section for client side.

    Back to demo. Open Lianja Demo (in group Demo Desktop Apps, "lianjademo").
    Click "Custom" in upper part of screen. In this menu click "PHP Custom Section" (5.option). What you are looking at is made by PHP code and this is Way #2.
    Preferred way is #1 (Standard sections), but you are currently eager to see as much PHP code in action as you can, Right?

    You see grey subtitle "This is a PHP custom section"? On the right is the group of 4 icons. Click first (keyboard).
    Editor will open in ppage_section1.php You will see comments explaining steps how to make such a section from scratch.

    I suggest you change code here (or comment existing code) to see what is going on. I am looking at PHP for the first time in my life. I will add a button in step 3

    Code:
    // Step 3: create a "Pageframe" class and add it to the "Section"
    $mysection->addObject("ui_tabs", "Pageframe");
    $mysection->addObject("ui_button", "Commandbutton");
    Then I click in the upper row of screen to 5.icon (sheet of paper). Under grid I get looong button.
    Back to code by clicking "keyboard" icon or 5th icon in first row (pencil)

    Then I try to define button's caption. Ups! $ui_button.text="Click me" is wrong in PHP. Need "->". Ups! need ";" at end.
    Finally I got it.

    Code:
    $ui_button->text="Click me";
    I would then try to remove left listbox by commenting the line with addobject and every mention of ui_listbox.
    5th icon to see it - and there is no listbox. I even did not need to "Desktop App View" to see my changes.

    Code:
    //--------------------------------------------------------------------------
    // Step 6: Add a "Listbox" to the "Container" and set some of its properties
    //$ui_cont->addobject("ui_listbox", "myListbox");
    //$ui_listbox->fixedwidth = 200; 
    //
    ////--------------------------------------------------------------------------
    //// Step 7: Invoke the "Additems" method with a comma separated list of items to add to the Listbox
    //$ui_listbox->additems("All,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
    You see my point? Try change code in little steps. "Try PHP data access" (8th option from Custom menu).

    After that make new app with PHP as language and on southwind database (Dashboard: Create an App).
    Drag some table (customers) and and Shift+drag (orders). Click + in front customers and click on header of second section of orders. You get all orders of one customer.
    Navigate through customers and see how it is all bound. This is preferred NOCODE way.
    There you can open attributes and insert code in PHP. But for now - enough.
    Last edited by josipradnik; 2015-02-04 at 16:40.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us