Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 12    Views: 43

FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
12/14/13 06:33 AM (11 years ago)

snippet code probs

hi guys, can someone help, its to do with snippet jason plugin, i keep getting this error when i test the jason file Parse error on line 9: ...itionType": "flip"},{ "itemId": "9 ----------------------^ Expecting 'EOF' and the bit thats highlighted in the code is }, cheers
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/14/13 07:45 AM (11 years ago)
You're not providing a lot of code, but from what I 'can see' you're missing: "} for the other side of the nine. Json comes in key/value pairs, like: {"myKey":"myValue"} or {"myKey":"myValue", "myOtherKey":"myOtherValue"} and when you have multiple key/value pairs in groups, they are separated by commas, and brackets ([]) depending on what/where. but for now, it looks like it should be '...itionType": "flip"},{ "itemId": "9"}' of course, without the whole thing, I'm just guessing. Cheers! -- Smug
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
12/14/13 07:50 AM (11 years ago)
hi smug, the whole code is below im trying to use jason snippet, but get the above error when i insert it into the tester, { "itemId": "ED40AB99E4FA6637F37D6D3", "itemType": "BT_menuItem", "loadScreenWithItemId": "4DA8204CC6ADB9FE86A797E", "titleText": "GettingMarriedinCumbria", "iconName": "gettingmarried.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "997D1E45B1182A181889DEC", "itemType": "BT_menuItem", "loadScreenWithItemId": "A58F3905A12AD68368B6360", "titleText": "CivilPartnershipsinCumbria", "iconName": "civil.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "299187C7974504FF4F6747E", "itemType": "BT_menuItem", "loadScreenWithItemId": "603AD118026FAA63808C836", "titleText": "RenewalofVows", "iconName": "renewal.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "F9E9223C977FABD4A4AFC0F", "itemType": "BT_menuItem", "loadScreenWithItemId": "3AD19ED5F0794FCD4C5DAB3", "titleText": "RegistrarOffices", "iconName": "cumbriacouncil.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "A7B3E7D447ED387A501C985", "itemType": "BT_menuItem", "loadScreenWithItemId": "0A0FE9986036BC79EC04D7F", "titleText": "MapofRegistrarOffices", "iconName": "cumbriacouncil.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "EFC74536E0E0F04C01E2E49", "itemType": "BT_menuItem", "loadScreenWithItemId": "0F8D71A2EB7D0FD0CCCCD75", "titleText": "ApprovedVenues", "iconName": "weddingvenues.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "BB3EB5EF6AF5832F722E3D9", "itemType": "BT_menuItem", "loadScreenWithItemId": "6895E4A151903E1C2B304D9", "titleText": "Charges&Fees", "iconName": "charge.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "762E5A4BCBCF2DF51DED0CF", "itemType": "BT_menuItem", "loadScreenWithItemId": "4E3F20F549D38A3D1379424", "titleText": "WeddingSuppliers", "iconName": "weddings.png", "rowAccessoryType": "details", "transitionType": "flip" } cheers dude
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
12/14/13 08:06 AM (11 years ago)
Well, it's valid json, but it's not in a completely valid json format. I just did a little tweek to convert it into childItems, and it passes fine: { "childItems": [ { "itemId": "ED40AB99E4FA6637F37D6D3", "itemType": "BT_menuItem", "loadScreenWithItemId": "4DA8204CC6ADB9FE86A797E", "titleText": "GettingMarriedinCumbria", "iconName": "gettingmarried.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "997D1E45B1182A181889DEC", "itemType": "BT_menuItem", "loadScreenWithItemId": "A58F3905A12AD68368B6360", "titleText": "CivilPartnershipsinCumbria", "iconName": "civil.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "299187C7974504FF4F6747E", "itemType": "BT_menuItem", "loadScreenWithItemId": "603AD118026FAA63808C836", "titleText": "RenewalofVows", "iconName": "renewal.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "F9E9223C977FABD4A4AFC0F", "itemType": "BT_menuItem", "loadScreenWithItemId": "3AD19ED5F0794FCD4C5DAB3", "titleText": "RegistrarOffices", "iconName": "cumbriacouncil.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "A7B3E7D447ED387A501C985", "itemType": "BT_menuItem", "loadScreenWithItemId": "0A0FE9986036BC79EC04D7F", "titleText": "MapofRegistrarOffices", "iconName": "cumbriacouncil.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "EFC74536E0E0F04C01E2E49", "itemType": "BT_menuItem", "loadScreenWithItemId": "0F8D71A2EB7D0FD0CCCCD75", "titleText": "ApprovedVenues", "iconName": "weddingvenues.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "BB3EB5EF6AF5832F722E3D9", "itemType": "BT_menuItem", "loadScreenWithItemId": "6895E4A151903E1C2B304D9", "titleText": "Charges&Fees", "iconName": "charge.png", "rowAccessoryType": "details", "transitionType": "flip" }, { "itemId": "762E5A4BCBCF2DF51DED0CF", "itemType": "BT_menuItem", "loadScreenWithItemId": "4E3F20F549D38A3D1379424", "titleText": "WeddingSuppliers", "iconName": "weddings.png", "rowAccessoryType": "details", "transitionType": "flip" } ] } What is the data going to be used for? Cheers! -- Smug
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
12/14/13 08:22 AM (11 years ago)
im using some of my old code fron project in buzz in a new project im doing, and to save time im using the jason snippet plugin, the irony is its taking me forever to figure it out lol still cant get it to work, even with your code smug cheers
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
12/14/13 06:56 PM (11 years ago)
Menu items should be used in a text file and hosted as a dataURL. (or included as a text file in the compiled app, as some of my tutorials at idevdepot suggest). If you want to use the JSON snippet keeper, you'd have to have the whole menu and menuitems (childitems) in the same snippet.
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
12/15/13 02:00 AM (11 years ago)
thanks stobe, got it working last night, ie list of menu items, that then listed to other menu items, with your plugin, works great,i changed the id within in item to link to new menu in new snippet and it worked, managed to change the header image within the code as well, the icon row images arnt showing up though, even though the header is, any idea what im doing wrong. thanks sean
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
12/15/13 06:54 AM (11 years ago)
Not sure why the icon row images won't show up. I'd throw together a quick test menu using the control panel (no snippet) and see if they're working that way first, just to see if its the plugin or not.
 
FunkyMonkey
Aspiring developer
Profile
Posts: 1177
Reg: Aug 07, 2013
blackpool
14,570
like
12/15/13 09:46 AM (11 years ago)
ok stobe thanks
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/15/13 08:20 PM (11 years ago)
Wait a minute! Stobe said the JSON for a specific screen can be located a a local file within the compiled app?! Gadzooks, tell me it's true please. What are the easy steps? -- Niraj
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
12/15/13 08:34 PM (11 years ago)
Niraj, For any screen that uses a "dataURL" (menu's, quiz, photogallery) you can make a few quick logic modifications to the code and allow it to look for a compiled text file for the childItems. I have instructions here for a v2.0 quiz: http://idevdepot.com/update-load-local-data-in-a-quiz-for-bt2-0/ The modification is to the loadData function in the quiz plugin, but can be used in other similar plugins that use the same loadData logic. Have fun! -Chris
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/15/13 09:15 PM (11 years ago)
Nice tip, Chris! With the new BT V3, we can make a new variable named dataFileName so that the dataURL can still be used in case one wants to shift the data source from local to remote. The challenge will be in getting each Plugin developer to implement the dataFileName code. Perhaps I shall tackle it plugin by plugin while working with each author. -- Niraj
 
Stobe
buzztouch Evangelist
Profile
Posts: 1528
Reg: Mar 04, 2011
Fredericksburg,...
24,680
like
12/15/13 09:55 PM (11 years ago)
Sounds like a good idea!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.