mranchovy / kohana_smarty3 Goto Github PK
View Code? Open in Web Editor NEWIntegration of Smarty v3 with the Kohana PHP Framework
Integration of Smarty v3 with the Kohana PHP Framework
while using {extends} tags on tpl file I am getting an exception error
The smarty version you are using on your module is Smarty 3.0.8 and when trying to replace the library to the latest one it does not work and produce errors. Isn't it possible to update the ore library?
Because now it's stupid to hold files with two names convention in one branch.
Name this branches
3.3/master
3.2/master
like kohana framework style and separate file versions
The README.md file needs a bit of tidying - some backticks missing, and the link to the Wiki is wrong!
On my localhost (Windows), I have this module working fine. On my server (Debian), Kohana can't find my template files. (Both server and local have the same file versions, and server has correct permissions on all files.) This applies to all of my controllers which display a view (with the appropriate template file substituted, of course).
Kohana is dying at SYSPATH/classes/Kohana/View.php
when Kohana::find_file('views', $file)
fails to find the template. A cursory look over find_file
suggested to me that it may be trying to look for index.tpl.php instead of index.tpl. I added echo $path.'<br>';
to find_file
to confirm my suspicions, and I was correct: on my localhost, one of the lines output is views\index.tpl
, while on my server, I see views/index.tpl.php
.
However, I discovered another oddity. Here is the full list of paths Kohana is looking for on each of my server and my local machine:
LOCAL: SERVER:
classes\I18n.php classes/I18n.php
classes\Kohana\I18n.php classes/Kohana/I18n.php
classes\HTTP.php classes/HTTP.php
classes\Kohana\HTTP.php classes/Kohana/HTTP.php
classes\Kohana\Exception.php classes/Kohana/Exception.php
classes\Kohana\Kohana\Exception.php classes/Kohana/Kohana/Exception.php
classes\Log.php classes/Log.php
classes\Kohana\Log.php classes/Kohana/Log.php
classes\Config.php classes/Config.php
classes\Kohana\Config.php classes/Kohana/Config.php
classes\Log\File.php classes/Log/File.php
classes\Kohana\Log\File.php classes/Kohana/Log/File.php
classes\Log\Writer.php classes/Log/Writer.php
classes\Kohana\Log\Writer.php classes/Kohana/Log/Writer.php
classes\Config\File.php classes/Config/File.php
classes\Kohana\Config\File.php classes/Kohana/Config/File.php
classes\Kohana\Config\File\Reader.php classes/Kohana/Config/File/Reader.php
classes\Kohana\Config\Reader.php classes/Kohana/Config/Reader.php
classes\Kohana\Config\Source.php classes/Kohana/Config/Source.php
classes\Route.php classes/Route.php
classes\Kohana\Route.php classes/Kohana/Route.php
classes\Cookie.php classes/Cookie.php
classes\Kohana\Cookie.php classes/Kohana/Cookie.php
classes\Session.php classes/Session.php
classes\Kohana\Session.php classes/Kohana/Session.php
classes\Request.php classes/Request.php
classes\Kohana\Request.php classes/Kohana/Request.php
classes\HTTP\Request.php classes/HTTP/Request.php
classes\Kohana\HTTP\Request.php classes/Kohana/HTTP/Request.php
classes\HTTP\Message.php classes/HTTP/Message.php
classes\Kohana\HTTP\Message.php classes/Kohana/HTTP/Message.php
classes\HTTP\Header.php classes/HTTP/Header.php
classes\Kohana\HTTP\Header.php classes/Kohana/HTTP\Header.php
classes\Request\Client\Internal.php classes/Request/Client/Internal.php
classes\Kohana\Request\Client\Internal.php classes/Kohana/Request/Client/Internal.php
classes\Request\Client.php classes/Request/Client.php
classes\Kohana\Request\Client.php classes/Kohana/Request/Client.php
classes\Arr.php classes/Arr.php
classes\Kohana\Arr.php classes/Kohana/Arr.php
classes\Response.php classes/Response.php
classes\Kohana\Response.php classes/Kohana/Response.php
classes\HTTP\Response.php classes/HTTP/Response.php
classes\Kohana\HTTP\Response.php classes/Kohana/HTTP/Response.php
classes\Profiler.php classes/Profiler.php
classes\Kohana\Profiler.php classes/Kohana/Profiler.php
classes\Controller\Home.php classes/Controller/Home.php
classes\Controller\HFTemplate.php classes/Controller/HFTemplate.php
classes\Controller\Template.php classes/Controller/Template.php
classes\Kohana\Controller\Template.php classes/Kohana/Controller/Template.php
classes\Controller.php classes/Controller.php
classes\Kohana\Controller.php classes/Kohana/Controller.php
classes\View.php classes/View.php
classes\Kohana\View.php classes/Kohana/View.php
classes\Smarty\View.php
config\smarty.php
classes\Config\Group.php
classes\Kohana\Config\Group.php
vendor\smarty/libs/Smarty.class.php
classes\URL.php
classes\Kohana\URL.php
classes\Smarty\Helper.php
classes\Kohana\Smarty\Helper.php
views\index.tpl views/index.tpl.php
classes\Auth.php
classes\Kohana\Auth.php
config\auth.php
classes\Auth\ORM.php
classes\Kohana\Auth\ORM.php
config\session.php
classes\Session\Database.php
classes\Kohana\Session\Database.php
classes\Database.php
classes\Kohana\Database.php
config\database.php
classes\Database\PDO.php
classes\Kohana\Database\PDO.php
classes\DB.php
classes\Kohana\DB.php
classes\Database\Query\Builder\Select.php
classes\Kohana\Database\Query\Builder\Select.php
classes\Database\Query\Builder\Where.php
classes\Kohana\Database\Query\Builder\Where.php
classes\Database\Query\Builder.php
classes\Kohana\Database\Query\Builder.php
classes\Database\Query.php
classes\Kohana\Database\Query.php
classes\Database\Result\Cached.php
classes\Kohana\Database\Result\Cached.php
classes\Database\Result.php
classes\Kohana\Database\Result.php
classes\ORM.php
classes\Kohana\ORM.php
classes\Model.php
classes\Kohana\Model.php
classes\Model\User.php
classes\Model\Auth\User.php
classes\Inflector.php
classes\Kohana\Inflector.php
config\inflector.php
classes\UTF8.php
classes\Kohana\UTF8.php
classes\Model\Role.php
classes\Model\Auth\Role.php
classes/View/Exception.php
classes/Kohana/View/Exception.php
classes/Debug.php
classes/Kohana/Debug.php
classes/Date.php
classes/Kohana/Date.php
views/kohana/error.php
classes/Text.php
classes/Kohana/Text.php
(page content) (exception page content)
classes\Database\Query\Builder\Update.php
classes\Kohana\Database\Query\Builder\Update.php
Notice the large gap where Kohana should be looking for Smarty module classes. Any ideas?
See example in my repos. Add type as kohana-module.
Please, do it, or i will fork and do it by myself.
Just the start page would be a start ;)
Hi! I have a problem trying to switch on debugging mode in smarty using your module.
I'm putting 'debugging' => true, in config file, but nothing happens. Can you help me? :)
This module seems not available access to kohana route engine.
What i mean?
in-template access to make route paths
bootstrap.php
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'main',
'action' => 'index',
));
somewhere in .tpl
{route name='default' controller='somecontroller' action='notindex'}
can you add this? it will be very usefull.
I'm trying to integrate Smarty into Dreamweaver (CC 2014) but the .tpl extension is already being used by DW so I need to be able to use a different extension for smarty templates.
If I use a different extension for my smarty templates, the smarty module is unable to find the file.
It would be great if a configuration option could be added to allow different extensions to be used.
Hello!
I found issues in classes\Smarty\View.php file:
if ( $var instanceof Smarty_Undefined_Variable ) {
instead of
if ( $var instanceof Undefined_Smarty_Variable ) {
return $this->_smarty->getVariable($key)->value!==NULL;
instead of
return $this->_smarty->getVariable($key)->value===NULL;
There is no reason to do this, it should be possible to do this as a global variable in the controller's before method - this might need some other way of invoking Smarty without a template for which the legacy 'smarty:' syntax will be ideal.
Find or write a custom function to make sub-templates efficient in tight loops - no <?php include ?>
.
It looks like 'View' has not been overwritten.
Trying load a view $view = View::factory('template_name.tpl'); I'm getting an error 'The requested view template_name.tpl could not be found'. I found out that system is trying to find 'template_name.tpl.php' file.
the demo doesn't seems to be working at /smarty/smartydemo
127 throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
also how can I include css/images/js ?
below is my structure and I want to include my assets (css or js or images) on index.tpl or core.tpl
I also want to know how can I attach images in my style.css
| default
| assets
| js
script.js
| css
- style.css
| images
- logo.png
| elements
| layouts
- core.tl
- index.tpl
I tried with different combinations but it doesn't seems to be working at all.
The change to Initial_Capitals in the new class auto-loader is a pain. Not sure what else is broken.
how can I set the template directory outside of /application/views or may be on /themes
With this simple code:
public function before ()
{
parent::before();
$v = 'test';
View::bind_global('V', $v);
}
I got the following error in Kohana 3.2:
2011-08-10 07:54:45 --- ERROR: ErrorException [ 1 ]: Class 'Smarty' not found ~ MODPATH/smarty/classes/view.php [ 45 ]
2011-08-10 07:54:45 --- STRACE: ErrorException [ 1 ]: Class 'Smarty' not found ~ MODPATH/smarty/classes/view.php [ 45 ]
--
#0 [internal function]: Kohana_Core::shutdown_handler()
#1 {main
With the following output:
MODPATH/smarty/classes/view.php [ 45 ]
40 * @param mixed referenced variable
41 * @return void
42 */
43 public static function bind_global($key, & $value) {
44 View::$_global_data[$key] = &$value;
45 Smarty::$global_tpl_vars[$key] = new Smarty_variable($value, $nocache);
46 Smarty::$global_tpl_vars[$key]->value = &$value;
47 return $this;
48 }
49
50 /**
Using View::set_global seems to work well. I notice that View::bing_global want to use a Smarty_variable object; maybe this class is not loaded ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.