Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2011-09-06 02:25:11

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: Inserting php into code

There’s nothing to repost as it’s still the same error. See here; http://txpshadow.apatalk.com/services/welcome-to-your-site#

I simply just copied and pasted Jakob’s code along with installing the suggested plugin . Thanks!

Last edited by dreamer (2011-09-06 02:25:24)

Offline

#14 2011-09-06 19:52:26

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Inserting php into code

I don’t see how Jakob’s code could cause that error, so I suspect it’s something else… unless you put the entire block of Jakob’s code inside <txp:php> tags (don’t do that).

Offline

#15 2011-09-07 05:16:01

dreamer
Member
Registered: 2007-06-08
Posts: 242

Re: Inserting php into code

Thanks for pointing that out. I deleted the <txp:php> tags and am closer.

I slightly modified Jakob’s code here
<label for=file_upload>Have Files?</label><input id=“file_upload” name=“file_upload” type=“file” />

and turned it into this;
“<label for=file_upload>Have Files?</label><input id=”\file_upload\” name=”\file_upload\” type=”\file\” />”;

so that the “Have Files’ field would appear. However

a) it won’t allow me to upload any files
b)the submit button won’t work

Last edited by dreamer (2011-09-07 05:16:14)

Offline

#16 2011-09-07 05:55:37

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Inserting php into code

Please post all of the code you are using. We can not help without knowing the code are using, including the PHP script doing the uploading.

Offline

#17 2011-09-07 13:23:53

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Inserting php into code

I slightly modified Jakob’s code here
<label for=file_upload>Have Files?</label><input id=“file_upload” name=“file_upload” type=“file” />

and turned it into this;
“<label for=file_upload>Have Files?</label><input id=”\file_upload\” name=”\file_upload\” type=”\file\” />”;

This will most likely have the effect of breaking your file input tag and maybe the label.

The quotes were only there in your originally code because php was being used to echo (output) that line of text. In that case, php needs to know where the line of text starts and ends and these are defined by quotes. But as there are further quote marks within the line of text, the php echo statement needs to know that it should skip any interim quotes by putting a slash in front of them. That is only necessary if you are echo-ing the line of text with php. In my code block above we’re outputting the tag normally so none of that is necessary.

Using my original code:

  • Can you see <label for="file_upload">Have Files?</label> in your source code. If it is there in the source code, you have some css in there hiding the label.
  • Is the variable uploadify set to yes at the top of the code (if you didn’t include that or you set it to something other than yes that whole section of code will not be output)

TXP Builders – finely-crafted code, design and txp

Offline

#18 2011-09-07 19:31:22

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Inserting php into code

^^ yes, change this:

"<label for=file_upload>Have Files?</label><input id="\file_upload\" name="\file_upload\" type="\file\" />";

into this:

<label for=file_upload>Have Files?</label><input id="file_upload" name="file_upload" type="file" />

And you’ll at least have an input field that allows you to select a file (though you may have to style it a bit to make it look better). That also makes the submit button work (work = it responds, not necessarily performing any action server-side).

Offline

Board footer

Powered by FluxBB