Jade Tippett wrote:
> New to php.
> 
> I  took over a web site where everything is written in javascript and 
> renders on the browser level.  One of the pages is a weekly announcements 
> page that takes an hour to update by hand, copying in the text, then 
> escaping all the "'s etc., then adding the <br> tags for carriage 
> return/line feeds.
> 
> Is there a php funtion or object that does this automatically??  If so, 
> which and where??

it'll take more than one function, and how you incorporate these
functions in to your site and/or workflow is another question.

some examples (assume that the variable $string contains the relevant text):

// escaping single quotes (I dont think you want to be doing this)
$string = str_replace("'", "\\'", $string);

        see: http://php.net/str_replace

// turning relevant characters into their html entity equivelants.
$string = htmlentities($string, ENT_QUOTES);

        see: http://php.net/htmlentities

// turning linebreaks in <br> tags,
$string = nl2br($string);

        see: http://php.net/nl2br

the description of your problem suggests that, in the first instance,
you need to find a text editor you like and learn to use it's
text replacement functionality - this is a skill that will make the
work you describe *much* faster and will stand you in good stead when
writing code as well.

if you have more specific questions about integrating php into
what seems to currently be static pages (in terms of what the
webserver is serving) send some actual code (not too much or people
will struggle to wade through it), that always helps people to
help you.

and remember the manual is your friend - most phper's will atest to
how good the php manual for learning php, even when starting from stratch.

> 
> Thank you.
> 
> --j 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to