facebook

Simple MobiOne PHP webapp – PHP Text Demo

  1. MobiOne Archive
  2.  > 
  3. Examples, HOW-TOs
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #318959 Reply

    support-michael
    Keymaster

    MobiOne PHP Demo

    I created this simpleton MobiOne php demo. It consists of a single page UI design with a Text component who’s content is replaced with a php scriptlet that fetches and prints the current Unix time in seconds. The source for this example can be found at the bottom of this article.

    Here’s the URL to online demo: PhpTextDemo

    Here is the process I used to create this demo:

    1) Use the Visual Designer to layout my UI.
    a) Set the page File Extension property: “PHP”
    b) add a Panel component and resize to fill the UI form
    c) add a Text component centered on the panel
    – size the Text component width to always be full screen. See next screenshot
    See attachment phpdemotext-layout-70.png

    2) Generate PHP code that will be manually modified
    In the Visual Designer for you page, click the Run in Test Center button. This will generate PHP code for the UI layout

    3) Manually modify the generated PHP file by adding a custom text message and scriptlet.
    You can use any text editor. I used the Test Center’s embedded editor (see View Source action)
    See attachment phpdemotext-src.png

    4) Upload all of the generated code to server and set access permissions

    5) Enter URL in Test Center emulator to verify proper operation
    See attachment phpdemotext.png

    Source Code
    See attachment phpdemotext.zip

    Attachments:
    You must be logged in to view attached files.
    #319016 Reply

    kaza007
    Member

    Nice work Wayne.
    Keep the demos coming.

    I had to modify the php to make it work in my server. Why? Apache/2.2.14 (Win32) PHP/5.2.12

    Time = <xxxx print date("H:i:s", time())?>

    Replace the xxxx in the code with ?PHP.

    NOTE: you cannot post PHP code, even if it is within the

     display. Thanks for the tip Wayne.

    #319018 Reply

    kaza007
    Member

    Leaving the PHP off at the start of your code is recognised by the PHP preprocessor but is not generic across all platforms.

    The ‘=’ in your code is the shorthand for the ‘echo’ command.

    #323668 Reply

    Lansirana
    Member

    Wayne,

    this is incredible, I’ve tried it with my PHP code and it works great. This is exactly what I need. I would only like to know if this works great also when it is in native .ipa form? I cannot check that, because I still heaven’t get required Apple certificates, so please if you could help me and tell me if it works?

    Thank you very much,
    Lansirana

    #328011 Reply

    coskevin
    Member

    I downloaded your php example and replace with a simple echo command. Nothing shows up. Here is the URL:

    http://goo.gl/4L6vR

    Any idea?

    #328016 Reply

    support-michael
    Keymaster

    @coskevin

    Will investigate and follow up later today.

    #328108 Reply

    coskevin
    Member

    Any update?

    #328112 Reply

    Hi coskevin,

    AppCenter only permits static pages, that’s why your echo function doesn’t work. You should test your webapp in your own server (this can be a localserver) with php capabilities.

    #328113 Reply

    coskevin
    Member

    If it becomes a native app. Will the echo show?

    #328133 Reply

    Hi coskevin,

    The php echo function won’t work in native apps. Why do you need this function? maybe if you give us more details we could give you a work around.

    #349364 Reply

    mini.singh
    Member

    Hello,

    When I am running this demo it doesn’t work for me. Nothing shows in screen. Please help me to run this demo.

    Thanks & Regards
    Surbhi Singh

    #349365 Reply

    Hi Surbhi,

    Are you testing the demo in the Web Simulator? If yes please be aware that you need to upload the generated code to your server with PHP:

    4) Upload all of the generated code to server and set access permissions

    #349376 Reply

    mini.singh
    Member

    Hello,

    Thanks for answering me, but I don’t know the procedure of how to upload code to server with PHP.
    Can you tell me step by step how to upload code to server in mobione?

    Please help me in this.

    Thanks & Regards
    Surbhi Singh

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Simple MobiOne PHP webapp – PHP Text Demo

You must be logged in to post in the forum log in