Loading, please wait...

ARTDESIGN FRAMEWORK

VIEW

Description

ArtDesign FrameWork View - Template System, Layout System

View - Templates

$Data = array(
    "Name" => "Tim",
    "Family" => "Evens",
    "Age" => 21
);
$ArtDesign = \ArtDesign\ArtDesign::GetInstance();
$View = $ArtDesign->GetView();
$View->display("Templates.Demo.Default.Index", $Data, false);

/*
--ArtDesign
----PHP
------Views
--------Layouts
----------Demo
------------Default
--------------Index.php
--------Templates
----------Demo
------------Default
--------------Index.php
--------------Data1.php
--------------Data2.php
--------------Data3.php
*/

/* Templates.Demo.Default.Index.php
<table>
    <tr>
        <td><b>Name</b></td>
        <td><b>Family</b></td>
        <td><b>Age</b></td>
    </tr>
    <tr>
        <td><?=$this->Data["Name"];?></td>
        <td><?=$this->Data["Family"];?></td>
        <td><?=$this->Data["Age"];?></td>
    </tr>
</table>
*/

View - Layouts

$Data = array(
    "Name" => "Tim",
    "Family" => "Evens",
    "Age" => 21
);
$ArtDesign = \ArtDesign\ArtDesign::GetInstance();
$View = $ArtDesign->GetView();
$View->AppendToLayout("Data1", "Templates.Demo.Default.Data1");
$View->AppendToLayout("Data2", "Templates.Demo.Default.Data2");
$View->AppendToLayout("Data3", "Templates.Demo.Default.Data3");
$View->display("Layouts.Demo.Default.Index", $Data, false);

/*
--ArtDesign
----PHP
------Views
--------Layouts
----------Demo
------------Default
--------------Index.php
--------Templates
----------Demo
------------Default
--------------Index.php
--------------Data1.php
--------------Data2.php
--------------Data3.php
*/

/* Layouts.Demo.Default.Index.php
<table>
    <tr>
        <td><b>Name</b></td>
        <td><b>Family</b></td>
        <td><b>Age</b></td>
    </tr>
    <tr>
        <td><?=$this->GetLayoutData("Data1");?></td>
        <td><?=$this->GetLayoutData("Data2");?></td>
        <td><?=$this->GetLayoutData("Data3");?></td>
    </tr>
</table>
*/

/* Templates.Demo.Default.Data1.php
echo $this->Data["Name"];
*/

/* Templates.Demo.Default.Data2.php
echo $this->Data["Family"];
*/

/* Templates.Demo.Default.Data3.php
echo $this->Data["Age"];
*/