Post by chongshengdz » Sun Jul 08, 2018 7:32 pm

<?php
$handle = fopen('https://www.opencart.com', 'r');
$content = '';
while(!feof($handle)){
$content .= fread($handle, 8080);
}
echo $content;
fclose($handle);
?>
Last edited by chongshengdz on Sun Jul 08, 2018 10:39 pm, edited 1 time in total.

Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet


Active Member

Posts

Joined
Sat Apr 12, 2014 10:18 pm


Post by synapseindia » Mon Jul 09, 2018 1:31 pm

You can use below online tool to convert PHP to TWIG .

https://php2twig.com/index.php

Thanks

User avatar
Active Member

Posts

Joined
Thu Apr 05, 2018 2:27 pm

Post by chongshengdz » Mon Jul 09, 2018 3:01 pm

synapseindia wrote:
Mon Jul 09, 2018 1:31 pm
You can use below online tool to convert PHP to TWIG .

https://php2twig.com/index.php

Thanks
already tried,but it didn't work.

Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet


Active Member

Posts

Joined
Sat Apr 12, 2014 10:18 pm


Post by synapseindia » Mon Jul 09, 2018 3:09 pm

TWIG is only use for the template (View) files. All programming related part can be done by PHP only.
Also, you can not use PHP programming function into the twig file.
It is template engine you can read about all the syntax of twig on below URL -
https://twig.symfony.com/doc/2.x/

User avatar
Active Member

Posts

Joined
Thu Apr 05, 2018 2:27 pm

Post by chongshengdz » Mon Jul 09, 2018 6:15 pm

synapseindia wrote:
Mon Jul 09, 2018 3:09 pm
TWIG is only use for the template (View) files. All programming related part can be done by PHP only.
Also, you can not use PHP programming function into the twig file.
It is template engine you can read about all the syntax of twig on below URL -
https://twig.symfony.com/doc/2.x/
thanks for you help.
i saw the resolution.
{{ random(['apple', 'orange', 'citrus']) }}
but it only returns one result.
how to return 2 or more results?
please help.

Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet


Active Member

Posts

Joined
Sat Apr 12, 2014 10:18 pm


Post by kestas » Mon Jul 09, 2018 6:50 pm

Hi,
I do not tried, but you can try this

Code: Select all

{{ random(""~apple~", "~orange~", "~citrus~"") }}

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by chongshengdz » Mon Jul 09, 2018 7:03 pm

kestas wrote:
Mon Jul 09, 2018 6:50 pm
Hi,
I do not tried, but you can try this

Code: Select all

{{ random(""~apple~", "~orange~", "~citrus~"") }}
it does not work and your site is down.

Electronic Components: integrated circuits, ic, semiconductors, transistors, thyristors, fuses, resistors, diodes, capacitors & more.
buy & sell transistors & mosfet


Active Member

Posts

Joined
Sat Apr 12, 2014 10:18 pm


Post by kestas » Mon Jul 09, 2018 7:35 pm

maybe here you will find something useful... https://stackoverflow.com/questions/383 ... st-in-twig

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by kestas » Mon Jul 09, 2018 7:50 pm

chongshengdz wrote:
Mon Jul 09, 2018 6:15 pm
synapseindia wrote:
Mon Jul 09, 2018 3:09 pm
TWIG is only use for the template (View) files. All programming related part can be done by PHP only.
Also, you can not use PHP programming function into the twig file.
It is template engine you can read about all the syntax of twig on below URL -
https://twig.symfony.com/doc/2.x/
thanks for you help.
i saw the resolution.
{{ random(['apple', 'orange', 'citrus']) }}
but it only returns one result.
how to return 2 or more results?
please help.
I not correctly understand your question.. So sorry, of course my first suggestion does not work.
random function returns only one value. please red this: https://twig.symfony.com/doc/2.x/functions/random.html

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: Adminas99999 and 148 guests