Code Monkey home page Code Monkey logo

joomla-twig's Introduction

Twig integration for Joomla!

Build Status

Twig 2.0 & Twig extensions integration for Joomla!

Index

Description

After integrating Twig with some projects I found the need to create some kind of standard package that can be used & extended by anbody at any project.

This Twig integration includes common global variables & functions required when using Twig in Joomla!

Some highlights:

  • Integrates Twig 2.0
  • Integrates official Twig extensions
  • Global variables to access active application, active document, session, active user, etc.
  • Functions to use JLayout, JProfiler, JRoute, JUri, JLanguage, JHtml, etc.
  • Integrated cache.
  • Integrated debug mode.
  • All the extensions are integrated through plugins so you can extend/replace any plugin you need.
  • 100% covered by unit tests.
  • SonarCloud is used for QA. Check the project in SonarCloud.

Example usage:

JLoader::import('twig.library');

// This will render a twig layout in: templates/{ACTIVE_TEMPLATE}/html/view.html.twig
echo Twig::render('@template/view.html.twig');  

You can find more examples/usages in the documentation;

Installation

  • Ensure that your site meets the requirements
  • Download latest version from the releases section
  • Install zip file in your site through Extension Manager

For a fast test you can now use the integrated examples.html.twig inside the library. Enable debug mode in your Joomla configuration and add this code to wherever you want to display examples (for example in your template index.php):

JLoader::import('twig.library');

echo Twig::render('@library/twig/examples.html.twig');

Documentation

See https://phproberto.github.io/joomla-twig/ for detailed documentation.

Requirements

  • PHP 7.0+ or higher
  • Joomla! 3.8.1 or higher

Copyright & License

This library is licensed under GNU LESSER GENERAL PUBLIC LICENSE.

Copyright (C) 2017 Roberto Segura López - All rights reserved.

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.