Giter Site home page Giter Site logo

Comments (5)

kenjis avatar kenjis commented on May 20, 2024

This is not a bug in Twig or codeigniter-ss-twig. It is specification.

redirect() makes your browser request another page (in your case, dashboard).
HTTP is stateless protocol. And PHP also shares nothing basically.
So if you access another page, PHP don't know all variables in the previous page at all.

Twig's global also means global in a single request.

But i need to use it in every controller.

Yes.

from codeigniter-ss-twig.

nzhtrtlc avatar nzhtrtlc commented on May 20, 2024

Thank you for your answer.
Is there any way that i can define global variable for twig which is works in every request ?

from codeigniter-ss-twig.

kenjis avatar kenjis commented on May 20, 2024

If you need one variable in all pages, for example, you can set it in your MY_Controller constructor.
See https://codeigniter.com/user_guide/general/core_classes.html#extending-core-class.

from codeigniter-ss-twig.

nzhtrtlc avatar nzhtrtlc commented on May 20, 2024

Thanks this one can solve my problem. But i think you can add this feature to project then we can reach the session with session key in twig. So we do not need to add any variable or make our own controllers.

from codeigniter-ss-twig.

kenjis avatar kenjis commented on May 20, 2024

I intend to keep this library simple wrapper for Twig.
I don't add functionality which original Twig does not have.
Twig doesn't care about session.

You can extend my Twig class to add your own needs.
See #23 (comment).

from codeigniter-ss-twig.

Related Issues (20)

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.