
zfred09
Members-
Posts
68 -
Joined
-
Last visited
Never
Everything posted by zfred09
-
How does php determine where the \n's go?
-
Ok, so say I have a text area, like this box I am typing in, how does it determine when to insert a \n because I never press enter at the end of the line and I could always resize the text area.
-
I agree with Ober. Consider buying the book, The Principles of Beautiful Web Design, by Jason Beaird. It is a great book to learn some basic web design.
-
How does php determine when to put a \n into a string when it is submitted by a form? The reason I ask is because I'm trying to determine a way to count the number of lines in a string submitted via a text field. Currently I'm exploding the string at \n to get the number of lines, but when I echo the text the number I get from exploding matches neither the shown \n's nor the number of lines.
-
Insert string into String based on number of chars
zfred09 replied to zfred09's topic in PHP Coding Help
Ok, that seems to work. Thanks. -
Say I had $string = "I swear I have seen this before."; I want to add $addme = "**"; into the original string after 10 characters. How would I do this?
-
No, I was looking for directory structure stuff, but I've got that now. Thanks for your time.
-
Thanks, Worked Perfectly, Any Ideas on where a tutorial would be located on this, I have tried searching google, but didnt know the name of what this kind of stuff is called so didnt really get any relevant results.
-
Hi all, Ok first of all I dont know all the lingo for directory structure, so lets just say for now we are in the directory named firstdir. I then change directories to secdir without any problems. How would I change directories back to firstdir? I tried the code below but it doesnt seem to work. Thanks. chdir("../firstdir");
-
Worked perfectly thankyou.
-
How would I replace a string despite capitalization? Say I have this code. $searchterm = "cool"; $text = "Hi, my names Cool."; $newtext = str_replace("$searchterm", "<FONT style=\"BACKGROUND-COLOR: yellow\">$searchterm</FONT>", "$text"); echo $newtext;
-
That works for selecting directories, now how would I put both the images and directory in the same array?
-
Not sure if Regex work with the glob function or not, but I put it in and nothing got selected.
-
I am using this bit of code to get all the images from a directory into an array, how would I add the name of a folder/directory into the array also? $list = glob("*.jpeg");
-
I appreciate your help, but this did not solve the problem. When I input outputString into a set of gd commands, the gd library does not read \n properly and thus still displays the image of outputString as one long line of text on the image. I'm looking for a way to have line breaks in the image that the gd library outputs or a way to have line breaks in a string of text before it is compiled/run.
-
Alright what I am trying to do is take that string of text at the top and break it up into separate lines instead of one long string(ex 1) and store it like that in a php variable(see ex 2). \n after each 20 char section does not work and I don't merely want <br> after each line because this will only separate them in html. I actually need the 20 char sections stored like ex 2 in a php variable. I don't know if I am going about this entirely wrong or not, so suggestions & help would be nice. The ultimate goal of this script is to break a paragraph of text up into separate lines and then output these with gd library to an image as I couldn't find a way to break lines in gd. wrong ex 1) If length is given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of string). ex 2)If length is given and is positive, the string returned will contain a t most length characters beginni ng from start (depending on the length of string). <?php $text = "If length is given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of string)."; $newtext = wordwrap($text, 20, "**"); $arr = explode('**', $newtext); $arrcount = count($arr); $count = 0; while($count <= $arrcount){ $blah = "$arr[$count]"; $count++; } ?>
-
That is at the very top of the page and isn't defined later on. And what is the benefit of register globals being off? Security?
-
My goal of this is to say if $var isnt set then set it, but when I goto the page nothing shows up, but then if I refresh the page the string will show up. It's as if when I first load the page it just doesn't read the isset part or something. [code]if(!isset($var)){$_SESSION['var']="23213123";} echo "$var";[/code]
-
Ah yes that works, I didn't understand/know what escaping the quotes was so thanks for the explanation. Problem Solved.
-
I get string errors in the new file in places such as this because the quote after the echo should be a ' but I had to change it or the write file would error out[code] echo("<form method="post" action="auth.php"><p>Username: <input type="text" name="userid" id="myform" maxlength="20" size="12"/></p> <p>Password : <input type="password" name="userp" id="myform" maxlength="20" size="12"/></p> <input type="submit" value="Login" class="gobutton"/></font> </form>");[/code]
-
Yes I know fwrite writes to a file, maybe my question wasn't clear, how do I write php code to that new file, because this method below doesn't work with php, you get unexpected string errors.[code] $text = "<?php echo("hi dude"); $_SESSION['hello']="Hi"; ?>"; $file = "aaa.php"; if (!$my_file = fopen($file,"a")) { echo "Unable to open $file"; } if (!fwrite($my_file, $text)) { echo "Unable to write to $file"; } echo "Text entered into $file"; fclose($my_file); [/code]
-
Alright say that when a condition is met, an entirely new php file is created with fwrite() and there is no code in it. How do you automatically write php code into that file using a script?
-
Nevermind I was able to write php to a file using scotmcc's method on this thread [url=http://www.phpfreaks.com/forums/index.php/topic,122055.0.html]http://www.phpfreaks.com/forums/index.php/topic,122055.0.html[/url] Unless there is a better/and or easier way to do it
-
try this ob_start();?><---make sure you close your php here <html> </html> <?php chdir("directory"); $fp = fopen("$filename.php", "w") ; fwrite($fp, ob_get_contents()); fclose($fp); ob_end_flush();
-
I'm writing html/php to a new file once it is created using the output buffering function, but if I put any php code inside the part that is being buffered it won't show up on the rewritten page. Could this possible have to do with php being executed server side? Or is there an easier way to write code to a new file that is being automatically created besides the ob function?