PHP include for extra php code

Permalink
I am trying to achieve the form found here:

https://www.allphptricks.com/create-a-zip-file-using-php-and-downloa...

but I can't get the php code to stay on the page - C5 seems to strip it out.
I have tried:
- the free PHP block (on the page and on the page type) - strips it out
- before the C5 include in the header file - strips it out
- as an include at the top of the downloads page after the header include - strips it out

Any suggestions please?

trixiemay
 
linuxoid replied on at Permalink Reply
linuxoid
Why don't you create a block with your custom form, you can write anything you like there in php, js, html, css etc. and add the block where you want it on the page?

https://documentation.concrete5.org/developers/working-with-blocks/c...
trixiemay replied on at Permalink Reply
trixiemay
Sounds like a great idea but I don't have the programming skills being only a lowly front-end developer.

Any tips on how to do this for a simpleton like me?
linuxoid replied on at Permalink Reply
linuxoid
How do you find it's stripped out?

If you simply right-click in the browser and check the source code, PHP will never be shown as it only works on the server, not on the user.
Gondwana replied on at Permalink Reply
Gondwana
I've never had any problems with the php block. Put something simple in there to get the hang of it. Off the top of my head, this might do something:
<?php
  phpinfo();
?>
linuxoid replied on at Permalink Reply
linuxoid
Just to clarify: no php code will be shown in the browser, only the result of php processing. In that case, the result of the php function should be shown, the php code itself won't.
Gondwana replied on at Permalink Reply
Gondwana
@linuxoid: just to clarify, I totally agree with you!
trixiemay replied on at Permalink Reply
trixiemay
Ah! That makes sense.
Yes the php script from the source code straight from Chrome is not showing.
I have the php code sitting just above the order form (as per the tutorial file).
When I test the form the javascript kicks in withe the button interactivity but then the php gather/zip/send process dies with no file/s being downloaded.
linuxoid replied on at Permalink Reply
linuxoid
If you use the php code in a php block, the php will try to pick the files relative to the block location (correct me someone if I'm wrong). I guess you don't know the block path and simply upload the files in some folder. That may be why they're not found by php.

And I don't think sending the header is possible within C5.