.. SlaxWeb Framework homepage file, created by Tomaz Lovrec .. highlight:: html .. _guide homepage: Home Page ========= Our home page will be a simple text page with a welcome text, and we will load it in the root route that we already created in the :ref:`add route` section of this guide. Template file ------------- Our home page will be a simple static page, and thus will not require a controller, or a model for operation. Lets go ahead and create our template file in **app/Template/** directory. We are going to call it **Home.php**:: My first SlaxWeb App

Welcome to my first SlaxWeb App

Click on the link bellow for some news.
News
Breaking up the template ```````````````````````` Our template file is now a completely static file which includes the header and footer are included into the same template. You will probably not want that, so we will break it up a bit into three separate files, **Head.php**, **Home.php**, and **Foot.php**. First the **Head.php**:: My first SlaxWeb App
The **Home.php**::

Welcome to my first SlaxWeb App

Click on the link bellow for some news.
News And the **Foot.php**::
If you are wondering why we are doing this, consider a case where you have tens of templates, and all of them include both the header and the footer, and now you have to change something in the header and/or the footer. You will have to go through each page, and change the same thing in all those pages. But if you have broken them up, then you can simply do the change in the **Head.php** and the **Foot.php** file files. Preparing the view classes -------------------------- Each Template needs an associated View class located in the **app/Views/** directory. A View class can be considered as a *presenter*, as it can be used to prepare all the data and sub-views that will be presented in the template. Lets go ahead and create a View class for our Home page template and name it **Home.php**: .. code-block:: php addSubView("head", $app["loadView.service"]("Head")) ->addSubView("foot", $app["loadView.service"]("Foot")) ->render(); Now you are ready to visit you first SlaxWeb App for the first time by visiting *http://myslaxwebapp.com*. To explain a bit what is happening here, we are using the *loadView* service and passing it the name of the View class as the input parameter which returns an object to it, in our case, the *Home* object. We then call *addSubView* twice on that object, to add the *Head* and *Foot* View objects as Sub-Views to our main *Home* View object. The first parameter is a custom name of the Sub-View, which is then prepended with **subview_** and injected into the main view as a view variable. So in our case we have two view variables, **subview_head** and **subview_foot**, which we are already printing out in the **Home.php** Template file. Our home page is now complete. Lets create a *News page* now!