In principle to get a layar you have to set up a database with the points of interest.Then put a php script on your server.Then make a layar on the developers site of layar.com and you can test it.
( you can find the layar tutorial at: http://layar.pbworks.com/First+Layar+Tutorial+-+Create+a+simple+layer but of course this leaves out the how to get your own server and ftp etc.)
- create a developpers account on http://publishing.layar.com/ this may take a day.
- when you are registered activate account etc.
- for your account you need a server, a free server can be obtained here: www.freebyte.com
- register an account here and activate.
- go to controlpanel and log in: http://panel.byethost.com
- go to databases and take the link MySQL databases

- make a database called LAYAR
-

- go admin (on this page too, to the right of the Backup button)
- go SQL you get a window to put in code

- insert a code to make a table:
CREATE TABLE IF NOT EXISTS `POI_Table` (
`id` int(50) NOT NULL auto_increment,
`attribution` varchar(50) default NULL,
`title` varchar(50) default NULL,
`lat` decimal(20,10) default NULL,
`lon` decimal(20,10) default NULL,
`imageURL` varchar(255) default NULL,
`line4` varchar(50) default NULL,
`line3` varchar(50) default NULL,
`line2` varchar(50) default NULL,
`type` int(11) NOT NULL default '0',
`actions` varchar(50) default NULL,
`dimension` int(1) NOT NULL default '1',
`alt` int(10) default NULL,
`relativeAlt` int(10) default NULL,
`transform` int(10) default NULL,
`object` int(10) default NULL,
`distance` decimal(20,10) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
- click start and the tabel will be made.
- now we add some data:

- go SQL again and to get a few entries fast insert (and press the start button):
(2, 'acadmie richting 2', 'acadmie richting 2', '51.9180000000', '4.4900000000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance%', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(3, 'acadmie richting 3', 'acadmie richting 3', '51.9170780000', '4.4890170000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance%', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(4, 'acadmie richting 3', 'acadmie richting 3', '51.9181360000', '4.4852400000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance%', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(5, 'acadmie richting 4', 'acadmie richting 4', '51.9204130000', '4.4860980000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance%', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5.0000000000'),
(18, 'street', 'blaak', '51.9170000000', '4.4955000000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance% ', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(20, 'boulevard', 'weena', '51.9175000000', '4.4954000000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance% ', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.5000000000'),
(17, 'marker', 'hello rotterdam', '51.9171800000', '4.4953000000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance% ', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(19, 'street', 'coolsingel', '51.9176000000', '4.4952000000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance% ', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(16, 'architecture', 'where do you want to be', '51.9169000000', '4.4951000000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance% ', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(15, 'architecture', 'where do you want to be', '51.9800000000', '4.6000000000', 'http://custom.layar.nl/layarimage.jpg', NULL, 'distance:%distance% ', NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.0000000000'),
(21, 'house', 'my home', '51.9140000000', '4.4280000000', 'http://custom.layar.nl/layarimage.jpg', NULL, NULL, NULL, 0, NULL, 1, NULL, NULL, NULL, NULL, '5000.5000000000');
- now first we need to put a script on the server you have created to find the POI's in the table you just made: go to your FTP program, I use firefox with FireFTP.
- make an account in your FTP program and log in, you find the login name and password in your bytehost documentation
- make folder called "layar"
- now copy the file called "FirstTutorial_POI.php" from the download you find on this pae: http://layar.pbworks.com/First+Layar+Tutorial+-+Create+a+simple+layer just above number 6 testing the layar
- rename this file: so FirstTutorial_POI.php becomes "layar_POI.php"
- open this file in textEdit (or alike)
- now you have to change the login and passwords in the file to the ones you got from bytehost:
$dbhost = "localhost";// local host must become "sqlxxx.byethostxx.com", where xx are your numbers
$dbdata = "database_name";//"bxx_xxxxxxx_LAYAR", where xx are your numbers
$dbuser = "database_username";//"bxx_xxxxxxx"
$dbpass = "database_password";// your password
save the file and upload in the "layar" folder.
- go to the developers site of layar: http://publishing.layar.com/publishing/layers/
- login etc
- create layar

- now you get the first screen with properties of the layar,
- give your layar a title
- now fill in the link to the file on your database: http://YOURNAME.byethost31.com/layar/layar_POI.php, where YOURNAME is the name of your bytehost account

- do a SAVE
- file in the tabs LISTING and DETAILS, indicated in red
- The last tab FILTERS, i use to set the range slider to 50000 (meters) which is easy for testing
- in principle this should work, that is you can test the page on the API Test Page of layar
- later on you can test on your cell phone

Aucun commentaire:
Enregistrer un commentaire