Location: PHPKode > scripts > Tina MVC > tina-mvc/tina_mvc/admin_pages/admin_pages_using_views_view.php
* Template File: Tina MVC Wordpress admin pages - using view files.
* @package  Tina-MVC
* @subpackage Docs
 * Security check - make sure we were included by the main plugin file
if( ! defined('TINA_MVC_LOAD_VIEW') ) exit();
<div class="wrap"><br />

<h2>Using view files</h2>

<p><em><strong>NB:</strong> All paths are relative to the Tina MVC plugin folder: <code><?= TINA_MVC\plugin_folder() ?></code>.</em></p>

<h3>Create a view file</h3>

<p>View files are placed in the same folders as controller files, and the same search algorithm is used to locate them. They are standard PHP files.</p>

<p>Create <code>using_views_view.php</code> in <code>user_apps/default/pages/tina_mvc_for_wordpress</code> as follows.
(See <code>samples/02_using_views</code> for listings used in this tutorial.</p>

<div style="line-height: 1.1em; background: #eaeaea;"><?= $code03 ?></div>

<h3>Create a controller file</h3>

<p>Create <code>using_views_controller.php</code> in <code>user_apps/default/pages/tina_mvc_for_wordpress</code> as follows.</p>

<div style="line-height: 1.1em; background: #eaeaea;"><?= $code04 ?></div>

<p>Any variables that you assign using <code>add_var()</code> and <code>add_var_e()</code> are extracted into the global scope
of the view file. For example, a variable <code>$firstname</code> added using <code>add_var_e( 'firstname', $firstname )</code> can be referenced in your view file
as <code>$firstname</code>. Note the difference between the two functions.</p>

<p>By default Tina MVC disables the wpautop() function to prevent it from inserting unwanted HTML into the Tina MVC page. (See
<a href="http://codex.wordpress.org/Function_Reference/wpautop">http://codex.wordpress.org/Function_Reference/wpautop</a>.)</p>
Return current item: Tina MVC