Newbie question
-
- Posts: 4
- Joined: Wed Nov 16, 2016 9:54 am
Newbie question
Hi,
I'm a newbie to SpiderBasic and have used one of the sample codes to check how Spider Basic works
Procedure MenuEvents()
Debug "Menu item selected: " + EventMenu()
EndProcedure
If OpenWindow(0, 200, 200, 200, 100, "Menu Example")
If CreateMenu(0, WindowID(0)) ; menu creation starts....
MenuTitle("Project")
MenuItem(1, "Open" + #TAB$ + "Shift+O")
MenuItem(2, "Save" + #TAB$ + "Shift+S")
MenuItem(3, "Save as" + #TAB$ + "Shift+A")
MenuItem(4, "Close" + #TAB$ + "Shift+C")
EndIf
BindEvent(#PB_Event_Menu, @MenuEvents())
EndIf
This compiles well and I can look at it locally in my Safari browser.
Could someone please provide me with a working sample configuration for the Compiler options, so that I could build it for a website (kind of an index.hmtl page), so that I only copy the files to a online folder and then type www.whatever.com/index.hmtl and it is displayed exactly as it is locally right now?
Currently I haven't setup any default target options, so that I cannot build the project for use in web...
Thanks for you help (and I hope, this question is not too annoying).
Best
Raphael.
I'm a newbie to SpiderBasic and have used one of the sample codes to check how Spider Basic works
Procedure MenuEvents()
Debug "Menu item selected: " + EventMenu()
EndProcedure
If OpenWindow(0, 200, 200, 200, 100, "Menu Example")
If CreateMenu(0, WindowID(0)) ; menu creation starts....
MenuTitle("Project")
MenuItem(1, "Open" + #TAB$ + "Shift+O")
MenuItem(2, "Save" + #TAB$ + "Shift+S")
MenuItem(3, "Save as" + #TAB$ + "Shift+A")
MenuItem(4, "Close" + #TAB$ + "Shift+C")
EndIf
BindEvent(#PB_Event_Menu, @MenuEvents())
EndIf
This compiles well and I can look at it locally in my Safari browser.
Could someone please provide me with a working sample configuration for the Compiler options, so that I could build it for a website (kind of an index.hmtl page), so that I only copy the files to a online folder and then type www.whatever.com/index.hmtl and it is displayed exactly as it is locally right now?
Currently I haven't setup any default target options, so that I cannot build the project for use in web...
Thanks for you help (and I hope, this question is not too annoying).
Best
Raphael.
- SparrowhawkMMU
- Posts: 291
- Joined: Wed Aug 19, 2015 3:02 pm
- Location: United Kingdom
Re: Newbie question
Here are the values for one of my web apps, simply change the names to suit your app:
In Compiler Options I have:
My code has an _export folder in the main folder where I target builds. Here are the Create App settings I use:
UPDATE: Forgot to add that I then move the contents of _export into /data/fse_repos/fse-ui-exported and change the owner of that folder and its contents to be apache, i.e. _www
Then in my /etc/hosts file (On Windows I think it's C:\Windows\System32\Drivers\etc\hosts) I have:
replace fse-ui.local with the name of your site, eg http://www.mylocalsite.com
And if using apache, add a virtual host entry to the httpd-vhosts.conf file (/etc/apache2/extra, no idea on Windows):
If using IIS I'm afraid I can't recall how that is done - I last set up virtual hosts on IIS when sites still used VBScript instead of JavaScript!! 
Hope this helps.
Edit: typos
In Compiler Options I have:
Code: Select all
Input Source File: index.sb
Code: Select all
App Name: FSE Client
Icon: _assets/fse_logo_small.png
HTML Filename: _export/index.html
JavaScript filename: fseui2.js
SpiderBasic libraries Path: libs
Copy SpiderBasic Libraries: checked
Code: Select all
sudo chown -R _www:admin fse-ui-exported
Code: Select all
127.0.0.1 fse-ui.local
And if using apache, add a virtual host entry to the httpd-vhosts.conf file (/etc/apache2/extra, no idea on Windows):
Code: Select all
# FSE UI (SB)
<VirtualHost *:80>
ServerName fse-ui.local
DocumentRoot /data/fse_repos/fse-ui-exported
ErrorLog "/data/logs/fse-ui-error.log"
CustomLog "/data/logs/fse-ui-access.log" common
</VirtualHost>

Hope this helps.
Edit: typos
Last edited by SparrowhawkMMU on Wed Nov 16, 2016 12:48 pm, edited 1 time in total.
-
- Posts: 4
- Joined: Wed Nov 16, 2016 9:54 am
Re: Newbie question
Do you have a separate Create App button (or menu item)? I don't find one in the mac version.... perhaps I am missing something or misunderstand it. I use export in order to create the files.
I created the files and copied
app.hmtl
app.js
spiderbasic.js
and the Spiderbasic library folder to the server.
If I access now the page, only the content of the the file is displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>SpiderBasic</title>
<script type="text/javascript">var spider = {}; spider.nbModules = 1; spider.nbLoadedModules = 0;</script>
<script type="text/javascript" data-main="spiderbasic/main.js" src="spiderbasic/require.js"></script>
<script type="text/javascript" src="spiderbasic/library.js"></script>
<script type="text/javascript">var dojoConfig = { async: 1 }; </script>
<link rel="stylesheet" href="spiderbasic/dijit/themes/flat/flat.css" />
<link rel="stylesheet" href="spiderbasic/dgrid/css/dgrid.css" />
<link rel="stylesheet" href="spiderbasic/cbtree/icons/cbtreeIcons.css" />
<link rel="stylesheet" href="spiderbasic/cbtree/icons/fileIconsMS.css" />
<script type="text/javascript" src="spiderbasic/xdate.dev.js"></script>
<link rel="stylesheet" title="Default" href="spiderbasic/themes/flat/window.css" type="text/css"/>
<script type="text/javascript" src="app.js"></script>
<link rel="icon" type="image/png" href=""/>
</head>
<body class="flat" id="spiderbody" >
</body>
</html>
I created the files and copied
app.hmtl
app.js
spiderbasic.js
and the Spiderbasic library folder to the server.
If I access now the page, only the content of the the file is displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>SpiderBasic</title>
<script type="text/javascript">var spider = {}; spider.nbModules = 1; spider.nbLoadedModules = 0;</script>
<script type="text/javascript" data-main="spiderbasic/main.js" src="spiderbasic/require.js"></script>
<script type="text/javascript" src="spiderbasic/library.js"></script>
<script type="text/javascript">var dojoConfig = { async: 1 }; </script>
<link rel="stylesheet" href="spiderbasic/dijit/themes/flat/flat.css" />
<link rel="stylesheet" href="spiderbasic/dgrid/css/dgrid.css" />
<link rel="stylesheet" href="spiderbasic/cbtree/icons/cbtreeIcons.css" />
<link rel="stylesheet" href="spiderbasic/cbtree/icons/fileIconsMS.css" />
<script type="text/javascript" src="spiderbasic/xdate.dev.js"></script>
<link rel="stylesheet" title="Default" href="spiderbasic/themes/flat/window.css" type="text/css"/>
<script type="text/javascript" src="app.js"></script>
<link rel="icon" type="image/png" href=""/>
</head>
<body class="flat" id="spiderbody" >
</body>
</html>
- SparrowhawkMMU
- Posts: 291
- Joined: Wed Aug 19, 2015 3:02 pm
- Location: United Kingdom
Re: Newbie question
Ah. Are you using the Demo version? That is still on 1.40 and the Create App option is new in 2.0.0 betas
The options I have specified above will therefore be in the Compiler Options, possibly under different names (sorry I can't recall exactly where / how they are named)
The options I have specified above will therefore be in the Compiler Options, possibly under different names (sorry I can't recall exactly where / how they are named)
- SparrowhawkMMU
- Posts: 291
- Joined: Wed Aug 19, 2015 3:02 pm
- Location: United Kingdom
Re: Newbie question
With regards the file showing:
1) are you accessing it via a web address or via File->Open. You need to open via the web address
2) do you have a webserver (Apache by default on a Mac), running?
In a Terminal* window, type:
You should see some entries like this if it is running:
* Terminal is available in Applications -> Utilities in case you are not familiar with it
1) are you accessing it via a web address or via File->Open. You need to open via the web address
2) do you have a webserver (Apache by default on a Mac), running?
In a Terminal* window, type:
Code: Select all
ps aux | grep httpd
Code: Select all
11:34 $ ps aux | grep httpd
developer 3801 0.3 0.0 2444056 796 s005 S+ 12:37pm 0:00.00 grep httpd
_www 3726 0.0 0.0 2560104 6324 ?? S 12:24pm 0:00.01 /usr/sbin/httpd -D FOREGROUND
_www 3725 0.0 0.0 2560104 6352 ?? S 12:24pm 0:00.02 /usr/sbin/httpd -D FOREGROUND
_www 3724 0.0 0.0 2560104 6360 ?? S 12:24pm 0:00.02 /usr/sbin/httpd -D FOREGROUND
- SparrowhawkMMU
- Posts: 291
- Joined: Wed Aug 19, 2015 3:02 pm
- Location: United Kingdom
Re: Newbie question
I have updated my initial post with a missing step - it's important that the directory you target allows access by the webserver, i.e. on OS X by default that is Apache and the Apache user is _www
- SparrowhawkMMU
- Posts: 291
- Joined: Wed Aug 19, 2015 3:02 pm
- Location: United Kingdom
Re: Newbie question
Oh. I just tested File Open and that works too, so ignore point 1) above !
-
- Posts: 4
- Joined: Wed Nov 16, 2016 9:54 am
Re: Newbie question
It is now working. Thank you so much!
- SparrowhawkMMU
- Posts: 291
- Joined: Wed Aug 19, 2015 3:02 pm
- Location: United Kingdom
Re: Newbie question
Glad I could help. Rereading my posts I'm aware that they were perhaps not the clearest or most concise explanations! 
But good to hear it's working for you now
Edit: typos

But good to hear it's working for you now
Edit: typos