Javascript file directory path variable not executing to image paths

zepedac's Avatar

zepedac

10 Jul, 2015 06:44 PM

Hello,

I have a variable for a directory path where images are stored. The issue, the path for that variable which is in a .js file won't render. I've added the [system-asset] tags around that path but results blank within the quotes ' '. The only way I'm able to output the path is by wrapping it with the [system-view:internal] tags. But that of course isn't a solution, just a test of outputting the path.

Here is my javascript code I'm referring too:


    var iconURLPrefix = '[system-asset]/_files/assets/images/map/[/system-asset]';
    
    var icons = [
      iconURLPrefix + 'Rio-Grande.png',
      iconURLPrefix + 'Edinburg.png',
      iconURLPrefix + 'McAllen.png',
      iconURLPrefix + 'Harlingen.png',
      iconURLPrefix + 'South-Padre.png',
      iconURLPrefix + 'Brownsville.png'
    ]
    var iconsLength = icons.length;

Attached is the full JavaScript file for reference.

  1. 1 Posted by Ryan Griffith on 13 Jul, 2015 01:30 PM

    Ryan Griffith's Avatar

    Hi,

    Because it is not currently possible to link to folder, I suspect the issue you are running into is the folder path will not be tracked.

    Instead, you may need to ditch the prefix variable and use the full path for each of the icons in your JavaScript array:

    var icons = [
      '[system-asset]/_files/assets/images/map/Rio-Grande.png[/system-asset]',
      '[system-asset]/_files/assets/images/map/Edinburg.png[/system-asset]',
      '[system-asset]/_files/assets/images/map/McAllen.png[/system-asset]',
      '[system-asset]/_files/assets/images/map/Harlingen.png[/system-asset]',
      '[system-asset]/_files/assets/images/map/South-Padre.png[/system-asset]',
      '[system-asset]/_files/assets/images/map/Brownsville.pn[/system-asset]g'
    ];
    

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by zepedac on 13 Jul, 2015 01:57 PM

    zepedac's Avatar

    Good morning Ryan,

    I'll try that out and let you know the results.

    Thanks.

  3. 3 Posted by zepedac on 13 Jul, 2015 04:13 PM

    zepedac's Avatar

    Ryan,

    That did the fix. Thanks again.

  4. 4 Posted by Ryan Griffith on 13 Jul, 2015 06:13 PM

    Ryan Griffith's Avatar

    Not a problem at all, thank you for following up.

    I also wanted to mention there is a related suggestion on our Idea Exchange to allow for linking to Folders. I highly recommend voting this up if you would like to see this suggestion considered for a future release of Cascade.

    I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.

    Have a great day!

  5. Ryan Griffith closed this discussion on 13 Jul, 2015 06:13 PM.

  6. zepedac re-opened this discussion on 13 Jul, 2015 08:37 PM

  7. 5 Posted by zepedac on 13 Jul, 2015 08:37 PM

    zepedac's Avatar

    Ryan,

    I tried to review the related suggestion but was prompted with a message stating "Sorry, you don't have access to this forum.". What are the requirements to access that forum?

  8. Support Staff 6 Posted by Tim on 13 Jul, 2015 08:40 PM

    Tim's Avatar

    Hey there,

    Ryan is out for the remainder of the day so I figured I'd chime in here. I just sent you an invite to our Idea Exchange which should allow for you to access the link Ryan provided above.

    Just let me know if you still have problems!

    Thanks

  9. Tim closed this discussion on 13 Jul, 2015 08:40 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac