PDA

View Full Version : Me sharing....


darelf
08-21-2002, 10:52 AM
This is just me sharing some code again.
Don't know if it will help anyone.
It's something I'm still working on, but you can see the basic structure. And it works, for what it does.

(The development target is PHP 4.2.2/Apache 1.3.x)

Links to the code (and a live version) can be found at http://mythicrpg.com

It is a d20 stat block generator (for DnD geeks out there).
It uses sessions to maintain the object, and reads in xml for its basic data. I didn't want to require a database. Also, I'm going to have to generate additional pages in order for it to work right.

Custom items ( i.e. +5 unholy vorpal icy burst longsword ) will require their own page for customization and then be saved somehow. I haven't decided on that. Maybe save custom items with the character being generated and then write the whole thing to an xml file?

Anyway, if it ends up being useful, or making someone go "oh, that's how you do that!", then I'll be happy. Well, I'll be happy anyway, since I'm just that kind of person.....

darelf
08-23-2002, 04:30 PM
Ok, someone pointed out that the live version is where the links point to.

You can always "Save as..." the links to see the source code, but I'll also put up a link to a tarball this evening. (should be able to unzip it with WinZip... will that make everyone happy?)

darelf
08-29-2002, 10:00 AM
Ok...
in case anyone cares, it's a lot of trouble for me to gzip up all the files for this every time I make a change. (because I make changes often)...

If anyone knows of a little trick to get the links on the index.html page to download the actual PHP files, rather than translating them, let me know.

Cheers,

(also... no, you cannot have ftp to my web directory....)

Hawk
09-08-2002, 10:50 AM
Either put a couple lines of code at the top of your files which check for a variable like "display_source" and echo the file if it is set, and execute it normally otherwise (i.e. "http://www.hotmale.com/php_file.php?display_source=true" will display the file's source, while the file will execute without the '?display_source=true'), and then provide links to them with "?display_source=true", OOORRR make symlinks with an extention other than ".php" (".phps" should/will/might display colorized source if apache and whatnot are configured correctly) and link to that.

iDxMan
09-08-2002, 02:47 PM
Instead of echoing the file:

http://www.php.net/manual/en/function.show-source.php

-r

darelf
09-09-2002, 02:19 AM
Sweet! That show_source() thing works great!

Thanks guys