Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11949
| From | "James Harris" <james.harris.1@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: PHP functions to convert markup efficiently |
| Date | 2013-11-23 22:07 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <l6r8va$1k2$1@dont-email.me> (permalink) |
| References | (1 earlier) <528F32EE.5030800@arnowelzel.de> <l6njsf$rat$1@dont-email.me> <528F7B7D.4030701@arnowelzel.de> <l6qlml$dvj$1@dont-email.me> <co6299tplsjmmmr0uovsldejl3431363l5@4ax.com> |
"Richard Yates" <richard@yatesguitar.com> wrote in message news:co6299tplsjmmmr0uovsldejl3431363l5@4ax.com... ... > >I am not trying to avoid complexity. Using PHP to convert markup to HTML > >allows me to do things like these: > >* restrict the elements that can be used (for security) > >* add features such as a server-side TOC > >* pull in data from various sources > >* choose where to place elements such as footnotes > >* make each page of the site a consistent structure > > > >Basically, the combination of HTML, CSS, PHP and my own markup codes > >seems > >ideal. Aside from having to devise the coding the rest is completely > >standard and incredibly lightweight. As such, there will be no packages > >and > >associated bugfixes to install and it should be very fast. > > > >I'll keep in mind that there are prebuilt options, though, in case I run > >into difficulties as I work on this. > > Can you use HTML codes, plus any markup you invent, but sanitize the > input by stripping any HTML or other tags that you do not want or that > could be a risk? Theoretically yes but that would be hard to do and much slower. Consider that if you see <p> on a page you don't know whether it is an HTML paragraph tag or not unless you know its context. It might be part of a Java program, for example, as in f<p>(); or it could be just an insignificant piece of text that should appear as written. The only way to tell for sure is to parse the file from the top and recognise every element that precedes it. That would be a lot of work. > I have a page where users can enter raw MySQL queries to generate > reports. The first thng that happens to input is to check that only > SELECT queries are processed (plus a lot of other safeguards). I also > devised a 'COPY from table where index=x' command that allows copying > one record easily. So, the page uses a limited form of a standard > markup, supplemented with extras, and is completely safe. > > Seems you could do the same with HTML. It is possible but would require lots of parsing code. By contrast, converting markup to HTML can be made much easier. FWIW, I found I could do something that works much more simply and wrote it up in a post made just a few hours ago. James
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-21 18:30 +0000
Re: PHP functions to convert markup efficiently The Natural Philosopher <tnp@invalid.invalid> - 2013-11-21 18:39 +0000
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-21 18:57 +0000
Re: PHP functions to convert markup efficiently Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-21 20:10 +0100
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-21 19:29 +0000
Re: PHP functions to convert markup efficiently Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-21 21:18 +0100
Re: PHP functions to convert markup efficiently Salvatore <sal@yojimbo.hack.invalid> - 2013-11-21 19:03 +0000
Re: PHP functions to convert markup efficiently Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-21 21:27 +0100
Re: PHP functions to convert markup efficiently Arno Welzel <usenet@arnowelzel.de> - 2013-11-22 11:33 +0100
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-22 12:48 +0000
Re: PHP functions to convert markup efficiently Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-22 08:53 -0500
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-23 06:21 +0000
Re: PHP functions to convert markup efficiently Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-23 06:59 -0500
Re: PHP functions to convert markup efficiently Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-23 13:12 +0100
Re: PHP functions to convert markup efficiently Arno Welzel <usenet@arnowelzel.de> - 2013-11-22 16:42 +0100
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-23 16:38 +0000
Re: PHP functions to convert markup efficiently Richard Yates <richard@yatesguitar.com> - 2013-11-23 13:24 -0800
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-23 22:07 +0000
Re: PHP functions to convert markup efficiently Arno Welzel <usenet@arnowelzel.de> - 2013-11-24 17:09 +0100
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-24 18:11 +0000
Re: PHP functions to convert markup efficiently Arno Welzel <usenet@arnowelzel.de> - 2013-11-24 23:18 +0100
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-24 23:44 +0000
Re: PHP functions to convert markup efficiently Arno Welzel <usenet@arnowelzel.de> - 2013-11-25 08:11 +0100
Re: PHP functions to convert markup efficiently "James Harris" <james.harris.1@gmail.com> - 2013-11-23 19:21 +0000
csiph-web