Questions tagged [twig]

Twig is a modern, fast, flexible, and secure templating engine for PHP.

Filter by
Sorted by
Tagged with
3
votes
2answers
162 views

A contact form with CodeIgniter and Twig

I am working on an online newspaper/blogging application with CodeIgniter 3.1.8 and Twig. I use the Twig template engine for the front-end views. I have put together this simple contact form which ...
1
vote
2answers
143 views

Implementing Pagination with Twig in Codeigniter 3

I am working on a online newspaper/blogging application with CodeIgniter 3.1.8 and Bootstrap 4. I have decided to add themes to it. The application is not HMVC, only MVC. I thought it was a good idea ...
1
vote
1answer
64 views

Improving upon basic MVC in PHP

I've put together a simple CRUD application to keep track of my library of books in an effort to learn the model-view-controller pattern, as well as better myself at PHP. Everything I have works so ...
0
votes
0answers
37 views

Report writing, do the formatting work on database or non-database language?

When report writing, sometimes getting the data you need can be quite straightforward in SQL, but getting the data in the exact format you'll need it in for the specific report can be quite tricky. It'...
3
votes
1answer
642 views

Simple CSS minifier for twig, with basic caching

On part of a project, I have some CSS being read using twig's source() function. But sending a huge chunk of CSS is not optimal. To reduce the size of the HTML, I'...
4
votes
1answer
204 views

Javascript contact form validation code

I'm a UI / UX Designer trying to sharpen my JS skills. I wanted someone else to check this code snippet and maybe have a Pro tip to improve or shorten it. Javascript: ...
3
votes
1answer
674 views

Raw filter with ternary operator for html class attribute

I've been trying to figure out how to stop Twig escape using the following code, which I feel is a little nicer with the succinct ternary operator. I hope someone can confirm I'm using the correct ...
1
vote
1answer
40 views

Should I include a view for each message?

For now, I have two views using Twig: messages.html.twig item.html.twig The first one is the view which displays all of the users' posts in my forum. When a user post a new message, it's done via ...
2
votes
1answer
314 views

Receiving data from a database

I am learning OOP using PHP5 and I wrote two simple classes for receiving data from a database using the dependency injection pattern and rendering a grid with Twig. Does this code have sense for OOP ...
4
votes
1answer
1k views

Optimizing a table - Twig, CSS

I have a table with forms in two colors - the first row is one color, the second is the other. Can you please tell me if there is a way to optimize my code (such as with this)? I have two CSS classes:...