Giter Club home page Giter Club logo

phptalview's Introduction

Allows you to use PHPTAL seamlessly in Laravel

Installation

Add niterain\PhpTalView as a requirement to composer.json:

composer require niterain/php-tal-view:2.0.1.x-dev

Update your packages with composer update or install with composer install.

Once Composer has installed or updated your packages you need to register PhpTalView with Laravel. Open up app/config/app.php and find the providers key towards the bottom and add:

'Niterain\PhpTalView\PhpTalViewServiceProvider',

Configuration

Currently PhpTalView is set by default to HTML5, however, you can change this setting in its config.php file, XHTML, or XML.

Usage

You call the PhpTalView template like you would any other view:

View::make('hello', array(...))

Filters

PHPTAL also has a nice feature which you can use called filters, for example I have one that bust the cache for images, js, css, this is configurable via the config file.

'preFilters' => array(
    'bustCache',
    'minimizeJs',
    'adderJs'
)

phptalview's People

Contributors

niterain avatar peeto avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

phptalview's Issues

Enhancement request: i18n

Hi, I'd love to see GetText support for PhpTalEngine.

I made a simple implementation for this but am hesitant to issue a pull request because I'm new to Laravel4 and not sure about the config stuff.

/**
 * Enable GetText Translation
 * 
 * @param  mixed   $languages         language (string) or array of several languages
 * @param  string  $domain            GetText domain to use (basename for .mo+.po files)
 * @param  string  $translation_root  path where locales are located
 */
public function activateGetText($languages = null, $domain = "translations", $translation_root = null) 
{
    if($languages === null)
        $languages = [\Config::get('app.locale')];

    if(!is_array($languages))   
        $languages = [$languages];

    if($translation_root === null) 
        $translation_root = base_path() . "/locale/";

    $tr = new \PHPTAL_GetTextTranslator();

    call_user_func_array([$tr, "setLanguage"], $languages);
    $tr->addDomain($domain, $translation_root);
    $tr->useDomain($domain);

    $this->phptal->setTranslator($tr);

}

Could you maybe bake this properly into PhpTalView or inform me about needed changes for a possible pull request? Cheers!

Error during the installation

When i try to install this package, i get this error:
Your requirements could not be resolved to an installable set of packages.

I require only this package:

"require": {
    "laravel/framework": "4.2.*",
    "niterain/php-tal-view": "*"
},

(I'm sorry if my English is not so good)

Laravel 5 compatibility

PhpTalView currently cannot be used with Laravel 5, which would be very nice.

Problem 1
- Installation request for niterain/php-tal-view dev-master -> satisfiable by niterain/php-tal-view[dev-master].
- niterain/php-tal-view dev-master requires laravel/framework ~4.2.11 -> no matching package found.

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.