Giter VIP home page Giter VIP logo

yii2-smarty's Introduction

Smarty Extension for Yii 2


This extension provides a ViewRender that would allow you to use Smarty view template engine with Yii framework 2.0.

For license information check the LICENSE-file.

Documentation is at docs/guide/README.md.

Latest Stable Version Total Downloads Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiisoft/yii2-smarty

or add

"yiisoft/yii2-smarty": "~2.0.0"

to the require section of your composer.json.

Note that the smarty composer package is distributed using subversion so you may need to install subversion.

Usage

To use this extension, simply add the following code in your application configuration:

return [
    //....
    'components' => [
        'view' => [
            'renderers' => [
                'tpl' => [
                    'class' => 'yii\smarty\ViewRenderer',
                    //'cachePath' => '@runtime/Smarty/cache',
                ],
            ],
        ],
    ],
];

yii2-smarty's People

Contributors

arhell avatar bwoester avatar cebe avatar creocoder avatar crtlib avatar egorpromo avatar ext4yii avatar gevik avatar gonimar avatar kartik-v avatar klimov-paul avatar lancecoder avatar larryullman avatar lucianobaraglia avatar mohorev avatar pmoust avatar qiangxue avatar qiansen1386 avatar ragazzo avatar resurtm avatar rinatio avatar samdark avatar schmunk42 avatar sensorario avatar simialbi avatar slavcodev avatar softark avatar suralc avatar tarasio avatar tonydspaniard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-smarty's Issues

Smarty Yii2 Syantax Problem

I want this code on smarty;

$dataProvider, 'columns' => [ 'id', [ 'label' => 'Galeri Adı', 'value' => function ($data) { return $data->title; }, ], [ 'label' => 'Galeri Tipi', 'value' => function ($data) use ($types) { return $types[$data->type_id]; }, ], [ 'label'=>'Status', 'value'=>function ($data) { return $data->status==1?'Aktif':'Pasif'; }, ], [ 'class' => 'yii\grid\ActionColumn', 'header' => 'Kontrol', 'template' => '{view} {update} {delete}', ], ], ]); ?>

But i don't use. Because this is a syantax problem 'function ($data) { .. }'

I tried everything but I could not find the solution. Help please.

My English is bad. Sorry.

update src folder link

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Smarty version
Smarty version
PHP version
Operating system

Not compatible with Smarty 2

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

No setCompileDir method

Q A
Yii vesion
PHP version
Operating system

GridView problem

Hi i'try example with GridView, but
An Error occurred while handling another error:
exception 'ReflectionException' with message 'Method yii\smarty\ViewRenderer::_widget_function__GridView() does not exist' in E:\web_dev\xampp\htdocs\escom_protected\vendor\yiisoft\yii2\web\ErrorHandler.php:195
Stack trace:

update root folder links

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version 2.0.?
Yii Smarty version
Smarty version
PHP version
Operating system

update tests folder links

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version 2.0.?
Yii Smarty version
Smarty version
PHP version
Operating system

Cannot Access Methods of $this-object

I set up Yii2 with smarty extension.

Now I am trying to simply convert the layouts/main.php file to a smarty template. For that I need access to the current yii\web\View object which is given from the extension as $this-smarty-variable.

I've validated that the smarty $this variable was the same as the view-object through var_dump()-ing and comparing both.

Problem

According to the smarty3 docs I should be able to call a method on the $this-object from smarty templates like this: {var_dump($this->head())}.

Applying the above script in a template just always returns NULL which let me guess that no method call had happen.

Question

How can I call a method from an object which is given to smarty from PHP ?

  1. Define variable for use in smarty: $template->assign('app', \Yii::$app);
  2. Call method on variable in smarty template: {$app->getSession();}

What am I doing wrong ?
(my current smarty layout: pastebin)

If this is no issue to Yii2-Smarty

I'm sorry if this doesn't affect Yii2-Smarty at all but I cant figure out what/why it is not working since this code should work according to Yii2-Smarty and Smarty itself.

I've also asked this question on stackoverflow though nobody has yet answered.

update github folder link

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Smarty version
Smarty version
PHP version
Operating system

A lean fork

I have forked this repo for research purposes and cleaned up the history quite a bit. All committer and tag information has been preserved.

At the time of writing this repo has 4606 commits (9.61 MiB), my fork — 76 (54.60 KiB). I would recommend doing a master and tags reset here.

fix issue template table

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Smarty version
Smarty version
PHP version
Operating system

视图层太不友好了

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Smarty version
Smarty version
PHP version
Operating system

为什么没有像TP5那样的视图层 你这个视图层还有PHP标签
应该没有这些标签阿 希望视图层改成TP5那样的
前后端工程师如何配合,难度也太大了,设计这个框架的工程师估计没有考虑到这一块吧
希望改进,否则从YII转TP和Laravel的很多人

Issue with block not callable or registered

What steps will reproduce the problem?

We have a template with several widgets and PJAX inside some of them where it's defined inside templates.
When we land on home as guest, then proceede to login and go back to the user area (the one with these widgets) here we have and exception raised.

What's expected?

Templates shown as expected, without an exception raised.

What do you get instead?

Exception about a block not being registered or callable.

Additional info

We have found this to be a suitable fix:
master...sercanto:master

Q A
Yii vesion 2.0.12
PHP version 7.0.12
Operating system Ubuntu 16.10

update irc link

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Smarty version
Smarty version
PHP version
Operating system

update docs folder link

What steps will reproduce the problem?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii Smarty version
Smarty version
PHP version
Operating system

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.