help needed.. reader of php for editing help

Status
Not open for further replies.

Lelesu

New Member
Messages
3
Reaction score
0
Points
0
Someone kind enough to help..

I am editing some php for a site, i have downloaded.. i am getting an error message that reads..

Warning: implode() [function.implode]: Bad arguments.



This is line with error.. does anyone see anything wrong with this line??

<br><TEXTAREA name="text" rows=20 cols=80>'.stripslashes(implode("",$text)).'</TEXTAREA>



If anyone understands what i am doing.. please help me..much thanks

frustrated..Lelesu
 

mitamata

New Member
Messages
81
Reaction score
0
Points
0
I've never used the implode function before, but the error would suggest there's something wrong with the arguments. I don't think you can go wrong with the first one, so it must be the second one.

What is the variable $text?
It should be an array. Print it with print_r($text) before the line that's giving you trouble to see what's in it.
 

Lelesu

New Member
Messages
3
Reaction score
0
Points
0
Thank You..

</FORM>';
if($template>"") {
$text = @file("../includes/articles/$template","r");
echo '<FORM action="index.php?q=articles" method="POST">
<INPUT type="hidden" name="template" value="'.$template.'">
<br><B>EDIT TEMPLATE</B> : '.$template.'
<br><TEXTAREA name="text" rows=20 cols=80>'.stripslashes(implode("",$text)).'</TEXTAREA>
<br><INPUT type="submit" name="submit" value="Save article"></FORM>';

Maybe.This will show you more..
I am assuming, it's the rotating text pages. It is an admin page. I will try that as i am not sure what i am doing. I just want to get the errors out this page. So, i am looking at all similarities and differences. It might work, i am noticing that $text clause is showing up in other errors. Well, i am going to go give it a try.. thanks again for your time..i will let you know, how it goes. You a have nice evening..Lelesu
 

mitamata

New Member
Messages
81
Reaction score
0
Points
0
Off the top of my head, I think I can guess where your problem lies.
In this line:
PHP:
$text = @file("../includes/articles/$template","r");

I'm assuming $template is a variable with some value in it, like "templatefile.txt" or something? Unless you have a file named "$template", that line is wrong. The proper way to do it would be more like this:

PHP:
$text = @file("../includes/articles/".$template,"r");

That's assuming you have the path of the file correct.
 

flinx

New Member
Messages
68
Reaction score
0
Points
0
The variable inside the double quotes should be correctly interpreted by PHP.

There is nothing 'wrong' with your code, so the problem must be the content of '$text' when you do the implode. And most probably the problem lies in the '@get' statement. But using the '@' before the 'file' function, any error that might occur while reading the file is ignored. Take away the '@' and see what error appears.
Another thing that you could do, and mitamata already told you, is doing a print_r($text) after the @file statement, to see what the result is.
 

Lelesu

New Member
Messages
3
Reaction score
0
Points
0
Good Morning..

Thank you both so much.. I think we might be getting somewhere. I hope

I did the, print_r it does give me an error..

the print_r in front of the text gave a location of the form box on the site.The print_r error before the @..gives me a syntax error

It reads this way:
Parse error: syntax error, unexpected '@' in path on line 261



This is what i am getting, when i remove the @..line 265 i did not correct the @ there..but got a new error for correcting the @ on line 231.

Errors read this way:
Warning: file() expects parameter 2 to be long, string given in path on line 261

Warning: implode() [function.implode]: Bad arguments. in path on line 265


The pages do look fine to the web..
ok if the @ is ignored and pages look fine with the exception of the admin area.Its got to be in my path,to text files. right? It's not reaching my text files.Cause taking the @ completely out..my errors are parameters now..sighs..I am not sure what to do at this point.. mess with my permissions?or would it even help? I am going to try to take both @ out..I lost the admin page with one. will keep ya'll updated..

Thank you both for helping me with this. Ya'll want a copy..its a headache...hehe...but, if you do..email me

please bare with me, i need help....and I got some Questions..

I am thinking it may be my path.but, maybe not in the code.Is this possible..Since, the code appears fine. but i want to ask.. what about the permissions to this folder containing my text files. Can permissions cause a bad path or bad arguments? or is it just how it is presented? or does this new error tell you anything.I did have to change the permission in my cgi bin. I am willing to try..Let me know what ya'll think.. and thank you both again for your help....Lelesu..
 

Slothie

New Member
Messages
1,429
Reaction score
0
Points
0
PHP:
</FORM>';
if($template>"") {
$text = @file("../includes/articles/".$template);
echo '<FORM action="index.php?q=articles" method="POST">
<INPUT type="hidden" name="template" value="'.$template.'">
<br><B>EDIT TEMPLATE</B> : '.$template.'
<br><TEXTAREA name="text" rows=20 cols=80>'.stripslashes(implode("",$text)).'</TEXTAREA>
<br><INPUT type="submit" name="submit" value="Save article"></FORM>';

You don't need an 'r', you're using file() not fopen().
 
Status
Not open for further replies.
Top