top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to use Twig Tags to print a variable's data?

0 votes
How to use Twig Tags to print a variable's data?
posted Aug 7, 2014 by Karamjeet Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You can set your variable using set tag in {%%} code blocks.
{% set x= 'hello' %}

After the set call, the x variable is available in the template . You can print that using {{ }}

{# displays hello #}

answer Aug 10, 2014 by Amritpal Singh
Similar Questions
0 votes

I have a question about using a php user class and session variables. Let's say that I have managed to create a user class that finds a particular person from the database query.

As I move about the site from page to page it would be nice to be able to use the current user inside the user class without needing to re – look them up in the database multiple times

Q: so is there a way to combine the current active user in the class with session variables so that they can be used multiple times? If so, how would this work?

0 votes

I want to use session to pass variables through pages using php.
Site structure is:
1. header.php
2. column.php
3. footer.php
4. index.php
Pages 1, 2 & 3 are included into the index.php.

In header.php page, there is a drop down, in which links(cities) are placed where users will select city.
Now, I want to do code to store selected values into a variable and pass to multiple pages.

Please help on this..

0 votes

I would like to make a timeout length to session variables, so that if a user didn't use the browser page for let's say 5 minutes - the session variables would expire and the user would need to login again.

Q: What's the best way to implement this functionality?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.