Log In    |    Knowledge Base    |    4D Home
Tech Tip: Why to not use 4D functions inside 4DVAR HTML tags
Published On: March 20, 2007
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When designing semi-dynamic web pages, it is possible to insert 4D functions within 4D VAR tags (ex: <!--4DVAR Current date--> ). However, this is not recommended if the application needs to be localized.

If you want to serve that page with a French version of 4D, for example, the expression will not be properly evaluated since the French version of 4D does not know what “Current date” is but knows what “Date courante” is.

Of course, this localization issue is not French specific. The following tag:

<!--4DVAR String(?01:15:59?)-->

...will not work if you are running your database under a Japanese system. Other countries may use English 4D commands but not all of them use the same meta-characters for dates and times.

Instead, you should wrap the 4D command or constant in a project method and call that project method from the 4DVAR tag.