Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Twig Autoloader not found
  • New Issue

    I just updated to 1.8.0.4 and I keep getting Unable to register extension "Twig_Fuel_Extension" as it is already registered. I was able to override Twig_Fuel_Extension in the previous version but now I can't and my app is broken.
  • I updated Twig to version 2.1 also since this new update supports it.
  • I updated Twig to version 2.1 also since this new update supports it.
  • Please how can I fix this? or if it can't be fixed very soon, how can I rollback?
  • Okay I already fixed issue 2 by removing 'View_Twig' from parser.php. Everything works fine and it still uses my Twig_Fuel_Extension.


    BTW Twig 2 now works fine. Thanks a lot.
  • Just to confirm: it works fine due to my fixes, or due to your workaround?
  • The ajax own isn't still working.

    It's the second error that I posted about not being able to override .Twig_Fuel_Extension like I used to do before, that has been fixed.


    Please I need to make that ajax error work as I need ajax functionalities a lot.
  • What does ajax have to do with Twig?

    Could you open a new topic for the "ajax problem", and explain exactly what you do, what the expected result is, and what the actual result is? Because I don't have a clue.
  • I have been able to fix. I have other issues though. I'll create difference discussions for them.
  • How can I append something to $data from after function of a controller? I want the data to be available on all methods of the controller.
  • Sweet. Thanks a lot. I can't believe I didn't see it when I checked the documentation.
  • Lol, these things happen.
  • I'm back again lol. I have a very weird error that cannot be explained. It's a PHP error so I don't want to create a new issue for that.

    $a = $value['details'];
    $b = $a['discount'];
    $dp = $b['price'];
    $da = $a['amount'];

    if ($dp) {
    $amount = $dp;
    }
    else {
    $amount = $da;
    }

    die(var_dump($dp)) gives me the appropriate result which means $amount should also have an appropriate value. When I remove the die statement and I try to insert $amount inside my db query I keep getting the error index 'discount' does not exist. This is a weird issue because index 'discount' f***ing exists but PHP is just too dumb to see it lol.

    Pardon my language, I've been battling with this weird error since and I'm now pissed off 'cos I have other things to do.
  • FInally. I have been able to fix it. I guess I still need to learn how some things work in PHP.

    My initial code was this before I splitting it. The code is inside a foreach loop on products array.

    $amount = $value['details']['discount']['price'] ? $value['details']['discount']['price'] : $value['details']['amount'];

    The problem was that one of the product inside the array had no discount node (I didn't add discount node for products without discount). In Python $value['details']['discount']['price'] ? would have returned false (instead of throwing an error) for the product without a discount, which was what I was expecting, but unfortunately things don't work like that in PHP that's why it keeps telling me that no index discount. I just needed to add the discount node but set price to 0 for product with no discount.
  • HarroHarro
    Accepted Answer
    Lol, yup, Python is very different from PHP.

    Note that as of PHP 7, you can use the coalesce operator:

    $amount = $value['details']['discount']['price'] ?? $value['details']['amount'];

    which doesn't throw the error.
  • Oh! Thanks. I never knew of that.

    A quick question, how can I remove fuelphp's favicon even when I don't have my own favicon?
  • HarroHarro
    Accepted Answer
    If you removed it from /public, it's probably in your browser cache.
  • Thanks. I didn't even notice the file was still inside /public

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion