So I’ve gotten a little bit further with Onitama, though I’ve kinda put it on the backburner for now. I’m at a point with it where I’ve got to start thinking about the 2-playerness of it. Basically, I have it so the player can play a card and then move a piece and capture an opponents piece. I don’t have any gameflow logic at this point to transfer to the next player. My main issue is figuring out how the server end of it would work as well as rendering to each separate player. Right now I’m only using a single view to render to player 1. But of course if you’re playing with a second player, they’re going to see it a bit differently (their pieces will be at the bottom), which requires rotation of the screen, basically.
In the meantime, I’ve been writing little snippets and thought that I’m kind of bored of my wiki page on my personal homepage. So I’ve decided to do something different. I thought at first it would be fun to have a gopher server and upload files, but gopher is rare and hard to deal with and I didn’t feel like learning a completely dead technology. So I figured I’d make a sort of file browser for my site.
Here’s a quick little mockup of it:
Basically the directory on the left. Click a folder and the file listing in the center, then click the file listing and it will display the contents on the right.
I’ve been lazily working on this project the past couple days. Learning a little PHP and figuring out bits and pieces of issues. So many little details that just make it hard to get working right, but I guess that’s programming and learning a new language. I’ve got it so I can load the current directory and display the directories and files in that directory.
I’m having a heack of a time, however, loading the files and directories of subdirectories. I’ve checked my .htaccess file, and I can see the subdirectories in the browser on my local machine so I know it’s not an htaccess issue. I’ve gotten it to work if I don’t test whether something is a file or directory. However, there’s some weird way PHP’s function that tests whether a filesystem object is a directory or file (supposedly it’s just for files, but I’m having a similar issue, I think, with directories, now that I’m testing it – even though, in theory, I wouldn’t need it, since I’d only be working with single hierarchy, not nested folders).
Supposedly, if a folder doesn’t have executable permission from the entity running the serve, then it won’t register as “is_file”. If I remove the conditional on whether an entry in the filesystem is a file, then I can load them up. But this means that directories will also get loaded into the array, and I don’t want/need that.
I found the function to test the permissions, and it appears the folder themselves have the correct executable permissions. Except the files, being image files, are rw only, which is correct, I shouldn’t have to set an executable flag on every single file in a folder, especially since it’s not an executable file.
So something’s going on and I have to narrow it down. I’ve got it partially working in that I can show the items in the subdirectories and load them into arrays, but I can’t figure out how to properly filter them. It seems as though the code/functions I’m using aren’t right, even though they’re the built-in functions and examples based on the documentation (tweaked for my purpose, but very lightly – not in any way that should make it break).
In some ways, it’s really cool. PHP is a little better than I remember, but there’s all these weird little quirks and bugs, too. Meh.