Question

Local Variable Definition in a View File

  • 1 October 2019
  • 0 replies
  • 53 views

Hi There!


Is it possible to define a local variable in a view file which can be referenced throughout the file?


eg, I want to define a list of strings:


“apple”, “banana”, “berry”


I need to reference this string several times throughout the view file. I’d like to avoid hardcoding this string multiple times in case it changes.


Can I do something like:


var fruit_list = “apple”, “banana”, “berry”


Any pointers greatly appreciated!


0 replies

Be the first to reply!

Reply