The Daily Click ::. Forums ::. General Chat ::. 2 misc PHP questions
 

Post Reply  Post Oekaki 
 

Posted By Message

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
23rd January, 2004 at 13:50:35 -

sorry for asking here but i've done a bit of searching on the php sites and it seems my questions are probably too simple to warrant an answer, so if any php buff would be kind enough to answer the following then i'd appreciate it:

1) how do i make it so that when a user enters a carriage return into a multiline text field, php knows to put a <"BR> in at some point?

2) how do i detect whether an image exists, therefore being able to point to a "no avatar" image like this site does?

i have the basics all fine and dandy but it's just these two little nuances. any help will do. thanks.

edit: and for future reference (i don't need to know now but i might as well ask) how can i make a script which parses character combinations like : + ) into smilies?

Image Edited by the Author.

 
www.thenatflap.co.uk

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
23rd January, 2004 at 14:03:22 -

1.
<?
$text="This is text
This is more text";
$text=nl2br($text);
echo $text;
?>
Dunno bout no. 2

and i've done a text to smiley thing on scorpion-e.tk, its not really that hard

file: http://www.smegsoft.exaltedhosting.com/~scorpion/smilies.php (right click/save as)

then in the file(s) that you want the text>smilie thing just do:
<?
$text=smilies($text);
?>

Image Edited by the Author.

 
My signature is never too big!!!

Clubsoft

Administrator
Weeeeeeee

Registered
  02/12/2001
Points
  254

Acoders MemberHas Donated, Thank You!May contain nutsVIP Member360 OwnerI'm an alien!Code Monkey
23rd January, 2004 at 14:19:25 -

The no avatar thing was done with javascript...

   Image

 
.: ImageApocalyptic Coders - www.acoders.com :.

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
23rd January, 2004 at 14:31:37 -

joe, you can't use 'save as' to download php files

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
23rd January, 2004 at 14:36:21 -

i knew that kris ¬_¬
anyway, textified: http://www.smegsoft.exaltedhosting.com/~scorpion/smilies.txt

 
My signature is never too big!!!

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
23rd January, 2004 at 14:42:37 -

thanks guys

 
www.thenatflap.co.uk

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
23rd January, 2004 at 14:46:04 -

does that text file appear as a html file to anyone else?
something wiered's going on there

 
My signature is never too big!!!

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
23rd January, 2004 at 15:05:27 -

no, i've stolen - err, i mean borrowed - it without any problems. thanks again.

 
www.thenatflap.co.uk

Galaxy613



Registered
  29/01/2003
Points
  1765
23rd January, 2004 at 21:36:14 -

why is the .txt file acting like a html file??? O.o

 
Image
My forum: http://subsoap.com/ck/forums/index.php

Deleted User
24th January, 2004 at 01:54:07 -

Lol! IE bugs or wrong Content-type.

 

Imp of Hazard Games



Registered
  27/08/2003
Points
  781
24th January, 2004 at 09:02:43 -

Part one can also be done so:

<?
//Getting text out of editbox
$text=$_POST['text'];
//Replacing itself
$text=ereg_replace("\n", "
", $text);
//Printing
echo "${text}";
?>

 
I need painters, musicians and animators!
   

Post Reply



 



Advertisement

Worth A Click