Tutorial 4: Dynamic Content

Follow

Comments

27 comments

  • Avatar
    tom

    Hi David,

     You are very close indeed. Please try replacing the broken line with this one: 

    artistAudio = new af.Audio(info.sounds); //setting the audio object

    And see if that helps. 

    All the best

    Tom

  • Avatar
    davidsmith

    Many thanks, Tom. That works perfectly.

  • Avatar
    PowerShocker
    Can you please say what the code is without the description of what it does? I can't tell what is code and what isn't! Please help! -PowerShocker
  • Avatar
    kieron

    Hi PowerShocker,

    All the code in the tutorial is in the big grey boxes - descriptions that are inside here are commented out (using the // characters) so you can safely add them into you app.

    Thanks

  • Avatar
    wiltshirevehicle

    Hi, I have an array which holds information for a data page. On the data page I have a rich text widget. In the rich text widget I want to add photos.

    My code looks similar to this at the moment (with the info changed as my information would be too long to be easily understandable):

    var data = [
     {
      title: "A checkbox",

      description: "Checkboxes are great for checking things<br><img src="content/PATH_TO_IMAGE_FILE" /><br> more text here",

      image: "check32.png"
      }
    ];

    The array worked perfectly until I added the HTML image code. Now I keep getting the errror "Missing }" on the 'description' line.

    I found the HTML image code here https://appfurnace.zendesk.com/entries/20562126-RichText-widget

    Please can you advise me on what I've done wrong and how I can correct it.

    Thanks

     

  • Avatar
    kieron

    Hi wiltshirevehicle,

    It's probably because you're using double-quotes in both the data object content (e.g. description: "... ), and in the image src - which the code is reading as the end of the data. You should be able to replace the inner double quotes with single quotes though (i.e. ' )

    Hope that helps

  • Avatar
    wiltshirevehicle

    Thank you! The error message has gone! However, the image isn't showing when I preview the app, it only shows a small square box where the image should be. Any suggestions?

  • Avatar
    kieron

    No problem.

    Is the image in the root of the File manager system? If you're using "content/IMAGE.jpg", then the image needs to be at the top level. Use "content/images/IMAGE.jpg" if it's in the images folder, for example. It's also worth making sure the image name and file extension is typed exactly as it appears in the code, and the file has been uploaded successfully.

    Just to note, we don't officially support the use of HTML and CSS within AppFurnace, because although they do work in most cases, we can't guarantee they'll work across all devices and platform versions now, or in the future.

  • Avatar
    wiltshirevehicle

    Yep, I have the correct image path. Okay, I understand. Is there any other way to add images within rich text? I have a data page/array for my information pages but there will be different text and a different amounts of images on each page. I want to avoid using a separate page for each topic, if possible.

     

    Thanks

  • Avatar
    kieron

    Can you try adding your image HTML directly into a RichText widget (just the <img ... /> with the relevant file path), and Preview Online? If you can see the image using direct HTML, then there's a problem with the way it's getting inserted. If not, then there's a problem with the image itself.

    Unfortunately, there's not another way to insert into a RichText widget. You can use a VScrollArea and the ".add()" function, but I'm guessing that will bring up a different set of considerations.

    Let me know how you get on

  • Avatar
    wiltshirevehicle

    I put the image HTML directing into the rich text widget and am still getting the same problem. It's not working for any of my images, even the ones that work in an image widget...

    I haven't use the ".add()" function before but might have to give it a try if I still can't get the HTML image code to work.

  • Avatar
    kieron

    OK, that suggests a problem with the images instead then. If you give me the app ID (number at the end of the URL when editing), I can make a copy of your app and see what could be causing this.

  • Avatar
    wiltshirevehicle

    This is the app ID: 24287

    Thanks

  • Avatar
    wiltshirevehicle

    Hi again,

    I've previewed my app on a variety of phones, and it seems Andriod phones using kitkat 4.4.2 have problems using the buttons. I'm not sure if this is a problem with AppFurnance Player or the app itself?

  • Avatar
    kieron

    Unfortunately, we do currently have a few bugs in Android KitKat, which we're working to fix. Once we have the fixes tested and ready to launch, we'll let you know here: https://appfurnace.zendesk.com/entries/43829138-Android-KitKat-4-4-2-bug.

    Sorry for any inconvenience that this is causing.

  • Avatar
    Mr. E Mann

    i don't know weather my app is working at all, i didn't understand how to preview

    will it work on tablets?

  • Avatar
    Mr. E Mann

    damn, dont tell me there are no more tutorials after this!

  • Avatar
    Mr. E Mann

    k i learnt how to preview, but it keeps saying that some javascript error is coming up

     

  • Avatar
    kieron

    Hi Mr. E Mann,

    If you're seeing a JavaScript error, there may be an error in your Code tab. Are there any errors or warnings in the Code tab (next to the Find/Replace button)?

    Also, there are currently 7 tutorials, which you can find listed here: https://appfurnace.zendesk.com/forums/20202402-Tutorials

  • Avatar
    nr0106

    hello everyone i just started using this and i want to know how to make a save button for my users so they can save their inputed text or does it already save?

  • Avatar
    kieron

    Hi nr0106,

    There's a thread on the subject here: https://appfurnace.zendesk.com/entries/22574337-Storing-user-input-via-text-input-widget-on-phone

    Hope that helps

  • Avatar
    Marleen

    Hi,

    My dynamic content worked for a while. While i was adding code for custom markers for the map and for a quiz, somewhere in the process, i think something went wrong because my dynamic content doesn't work anymore.

    I would really appreciate it if you could check this out, Where can i find my app number? 

    Thanks!

  • Avatar
    kieron

    Hi Marleen,

    The app number is the number at the end of the address bar (URL) when editing your app.

    Let me know and I'll take a look.

  • Avatar
    Marleen

    Okay, the app number is 40607. Thanks!

  • Avatar
    kieron

    Hi Marleen,

    Thanks for that, could you let me know what specific pages / content areas aren't working and how (e.g. errors, wrong content, missing content) - and what you expect to see instead, and where I could find the expected content (e.g. where in Code or Files)?

    Thanks

  • Avatar
    kieron

    Hi Marleen,

    I took a look, and it seems like your "showDataPage(i)" function is trying to pull in properties from the "data" variable - which there are now two of, and the last one in the code is actually a quiz, which overwrites the first one.

    If you rename the quiz data to something like "quizData" in the code, and then in the relevant places in the Layout for the quiz - that should solve the issue.

    Thanks

  • Avatar
    Marleen

    Of course, didn't think of that! It's solved now, thanks very much!

Please sign in to leave a comment.

Powered by Zendesk