Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse txt file using Twig

I am using Symfony2 with twig in it and I have large files (>100MB), which I want to parse and write some information from it into the HTML page. If I use my own Twig extension I get a memory exhaustion error. So is there a way to parse txt file straight from the twig file?

small file example:

1
003.00 001.00 
000.00 005.00 

result in HTML:

3+x+5xy
like image 309
H.W. Avatar asked Apr 26 '26 01:04

H.W.


1 Answers

How about creating a custom extension and using a generator? (http://php.net/manual/en/language.generators.overview.php)

like image 115
eRIZ Avatar answered Apr 28 '26 15:04

eRIZ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!