You are here: Re: Anything faster than this come to mind? « All PHP « IT news, forums, messages
Re: Anything faster than this come to mind?

Posted by Steve on 12/18/05 12:30

In article <do05co02qv6@news2.newsguy.com>, nospam@nohow.not (Curtis)
wrote:

> *Subject:* Anything faster than this come to mind?
> *From:* "Curtis" <nospam@nohow.not>
> *Date:* Fri, 16 Dec 2005 20:49:29 -0800
>
> We're writing a markup language, which naturally entails a
> lot of text substitution. We use / to do italics, for
> example, /like so./ The basics are not unlike Textile.
>
> That means, of course, that links would get clobbered and
> wind up looking like www.mysite.com<it>subdir</it>subdir.
> You get the picture. Percent signs are another common one in
> URL's.
>
> We're using double brackets to signify links, with displayed
> text after a bar, like this: [[www.mysite.com/here/there |
> my site]]
>
> Unless someone has a better suggestion, we were thinking of
> simply pulling all the text out of the brackets and placing
> it in an array, processing the paragraphs without the link
> text, the links in the array to the appropriate HTML, then
> replacing each [[]] sequentially with a HTMLified array
> item.
>
>
> if (strstr($parags[$i], "[["))
>
>
> preg_match_all("/
>
> [
> ([^\[]{1,200})
> \]\]/x",
> $parags[$i], &$brackets);
> foreach ($brackets[1] as $link)
> {
> $linkarray[] = $link; # $linkarray global.
> $parags[$i] = str_replace($link, "", $parags[$i]);
> }
> }
>
> We wind up with [[]] in the text as as marker, and the contents of
> each in the array. Is pulling the text out, then serially restoring
> it after we've created the HTML link in the array the fastest
> approach, do you think?
>
> Too, we've maxed out the link at 200 characters to write the code.
> Any thoughts on a more appropriate figure?
>
> --
>
> Curtis
>
> Visit We the Thinking
> www.wethethinking.com
> An online magazine/forum
> devoted to philosophical
> thought.
>
>
>
>
/Italics/ or _underline_ or *bold* in a mail client/newsreader, work in
pairs when surrounded by spaces. Since a '/' in a URL is not part of a
pair surrounded by space it shouldn't get parsed that way.


- Steve

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация