dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
share rss forum feed
« Free HostSiteEZ? »
This is a sub-selection from Share code


limeygit
Everybody Wang-Chung Tonight

join:2001-02-17
Nearest Bar
reply to PingPong3

Re: Share code

Hardly groundbreaking but I am at work and this is the first thing that came to me, anything placed in backticks - thats the ` symbol on the same key as the tilde - within PHP (and other languages) will be executed as a command on the server. This can be used for several things, but I think it is cool with one line of php code you can have a different fortune displayed each time.
This assumes you are using a *nix server and Fortune is in the normal place. Insert brackets as appropriate.

?php
echo htmlentities (`/usr/games/fortune`);
?

The htmlentities command just makes sure the output is converted to valid html, it works without it, but it is a better idea to leave it there.
As I said hardly groundbreaking, but I figured it out while playing with something else, and always thought it was a nice simple way to spice up an otherwise static page, without having to do any real coding. You can see it in action at »www.indiemonkey.com/limeygit - which is just a testing page and probably shouldn't be viewed by those on Netscape 4.x
--
www.indiemonkey.com
Taking you to Funky Town since 1999!