'; ?> DomCore Demos, a WebAbility® Network Project
« Back to the index

templateSource example

"; echo "DomCore version ".\core\WADebug::VERSION."
"; echo "HTML API ? ".(\core\WADebug::getHTMLAPI()?'Yes':'No')."
"; echo "OS Type ? ".(\core\WADebug::getOSType()==\core\WADebug::WINDOWS?'Windows':(\core\WADebug::getOSType()==\core\WADebug::UNIX?'Unix':'Mac'))."
"; echo "
"; $t1 = microtime(); // Start the SHM with 20Mb default size and default ID $SHM = new \core\WASHM(); // Lets create a LanguageSource based on the french messages $tempsource = new \datasources\TemplateSource(new \datasources\FileSource('./', '', 'projects.template'), new \datasources\FastObjectSource(new \datasources\FileSource('./', '', 'projectstemplate.afo'), new \datasources\SHMSource('projectstemplate', $SHM) ) ); $temp = $tempsource->read(); $data = array( '{title}' => 'Hotels projects:', 'data' => array( array('{id}' => 1, '{name}' => 'Paris', '{status}' => 1, '{statusname}' => 'In project', '{flag}' => 'fr.gif'), array('{id}' => 2, '{name}' => 'London', '{status}' => 1, '{statusname}' => 'In project', '{flag}' => 'uk.gif'), array('{id}' => 3, '{name}' => 'Madrid', '{status}' => 2, '{statusname}' => 'In construction'), array('{id}' => 4, '{name}' => 'New York', '{status}' => 3, '{statusname}' => 'Finished', '{flag}' => 'us.gif'), array('{id}' => 5, '{name}' => 'Los Angeles', '{status}' => 1, '{statusname}' => 'In project', '{flag}' => 'us.gif'), array('{id}' => 6, '{name}' => 'Mexico City', '{status}' => 1, '{statusname}' => 'In project', '{flag}' => 'mx.gif'), array('{id}' => 7, '{name}' => 'Moscu', '{status}' => 1, '{statusname}' => 'In project'), array('{id}' => 8, '{name}' => 'Roma', '{status}' => 1, '{statusname}' => 'In project'), array('{id}' => 9, '{name}' => 'Berlin', '{status}' => 3, '{statusname}' => 'Finished'), ) ); $temp->metaElements($data, false, false); print $temp->resolve(); ?>



« Back to the index