Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Tools/PHP/PHPTest multiple
Required plugins for this example: MBS Tools Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Tools/PHP/PHPTest multiple
This example is the version from Thu, 6th Apr 2016.
Project "PHPTest multiple.rbp"
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() dim f as FolderItem if TargetWin32 then f=FindFile("php5ts.dll") elseif TargetMachO then f=FindFile("libphp5.mac.dylib") elseif TargetLinux then f=FindFile("libphp5.so") else MsgBox "Unsupported Platform." quit end if if not PHPMBS.LoadLibrary(f) then MsgBox "Failed to load php library." end if dim p1 as new PHPMBS dim p2 as new PHPMBS if p1.Inited and p2.inited then p1.setVariable "test","XojoTest" MsgBox p1.getVariable("test") p1.setVariable "test","XojoTest 2" MsgBox p1.getVariable("test") MsgBox p2.getVariable("test") // same global variables! MsgBox p1.Execute("echo ""Hello World $test"";") MsgBox p1.Execute("echo ""PHP Version: "".phpversion();") else msgBox "Failed to initialize two PHP runtime environments." end if quit End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
End Class
End Project

See also:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Tools Plugin.

MBS Xojo blog