-
-
Notifications
You must be signed in to change notification settings - Fork 10
File reader
Alexanderius edited this page Jul 3, 2025
·
3 revisions
FileReader
is the class for loading localizable text files from the data folder specified in Simplify.Web configuration.
- File names should contain a language prefix. For example, if you are loading the file
Menu.xml
, it should be namedMenu.{language}.xml
in the data folder. - The file will be loaded for the current language. If the current language file does not exist, then the file for the default language will be loaded.
public class MyController : Controller
{
public override ControllerResponse Invoke()
{
// Loads Menu.en.xml file
var myData = FileReader.LoadXDocument("Menu.xml");
...
}
}
public class MyController : Controller
{
public override ControllerResponse Invoke()
{
// Loads Menu.en.xml file
var myData = FileReader.LoadXDocument("Menu");
...
}
}
public class MyController : Controller
{
public override ControllerResponse Invoke()
{
// Loads SomeFile.html
var myData = FileReader.LoadTextDocument("SomeFile.html");
...
}
}
...
FileReader.LoadTextDocument("SomeFile.html", true);
FileReader.LoadXDocument("Menu", true);
...
File cache can be globally disabled via Simplify.Web configuration.
- Getting Started
- Main Simplify.Web principles
- Simplify.Web controllers
- Simplify.Web views
- Simplify.Web templates
- Simplify.Web configuration
- Templates variables
- Static content
- Template factory
- Data collector
- String table
- File reader
- Web context
- Environment
- Dynamic environment
- Language manager
- Redirector
- HTML