Package Data | |
---|---|
Maintainer Username: | gulios |
Maintainer Contact: | gulios@gulios.pl (Artur Gulios Milkowski) |
Package Create Date: | 2016-02-04 |
Package Last Update: | 2020-12-29 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-12 15:03:58 |
Package Statistics | |
---|---|
Total Downloads: | 124 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This is modified version of https://github.com/krowinski/laravel-xslt
"gulios/xsl-laravel-template-engine": "dev-master"
"barryvdh/laravel-debugbar": "2.1.1",
'Gulios\LaravelXSLT\XSLTServiceProvider',
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [
<!ENTITY nbsp " " ><!-- space -->
<!ENTITY copy "©" ><!-- copyright -->
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" xmlns:str="http://exslt.org/strings" xmlns:php="http://php.net/xsl" exclude-result-prefixes="exslt str php">
<xsl:output encoding="UTF-8" method="html" omit-xml-declaration="yes" indent="yes"
doctype-system="about:legacy-compat" cdata-section-elements="script"/>
<xsl:variable name="curretLanguage"><xsl:value-of select="/App/Preferences/language/@current"/></xsl:variable>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$curretLanguage}" lang="{$curretLanguage}">
<head>
</head>
<body>
<xsl:apply-templates select="/App/Controller"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" xmlns:str="http://exslt.org/strings" xmlns:php="http://php.net/xsl" exclude-result-prefixes="exslt str php">
<xsl:import href="main.xsl" />
<xsl:template match="*">
<h2><xsl:value-of select="{$curretLanguage}"/></h2>
</xsl:template>
</xsl:stylesheet>
Route::get('/', ['as' => 'index', 'uses' => 'SomeController@index']);
class AlwaysProcessController extends Controller
{
protected $xml;
public function __construct()
{
$this->xml = \View::addChild('Controller');
$this->xml->addAttribute('class', Route::currentRouteAction());
$this->xml->addAttribute('function', Route::currentRouteName());
}
}
after that create SomeController in app/Http/Controllers:
namespace App\Http\Controllers;
use App\Http\Requests;
class SomeController extends AlwaysProcessController
{
public function index()
{
//$this->xml->addChild('SomeTagName', 'SomeValue');
//$this->xml->addData($ibanezImages, $someArrayData);
return view('index');
}
}
You can add to config/app.php 'available_languages' => array('en','pl'), 'default_language' => 'en', then you will get these data to XML by default.
<?xml version="1.0"?>
<App>
<Controller class="App\Http\Controllers\SomeController@index" function="index">
<SomeTagName>SomeValue</SomeTagName>
</Controller>
<Preferences>
<url isHttps="" currentUrl="http://www.domain/" baseUrl="http://www.domain" previousUrl="http://www.domain/"/>
<server curretnYear="2016" curretnMonth="02" curretnDay="04" currentDateTime="2016-02-04 14:21:56"/>
<language current="en" default="en">
<item>en</item>
<item>pl</item>
</language>
</Preferences>
</App>