This week I've been setting up a web site for an artist in the family. I started with static HTML that my brother-in-law wrote, and then plugged in ZP to replace the labor-intensive gallery page. While customizing a theme I made a navigation bar that links back to the remaining static pages. I based the code for this on the prev/next links on the image display page.
It works, though I had to hard-code each button to 25% of the nav bar width. Not sure how to make them just divide the space evenly. But anyway...
Here's an idea that occurred to me: Many people aren't technical enough to edit HTML directly and manage the files on disk. What if ZP's admin section had a user-defined page editor? I'm thinking something brutally simple. Possibly have it look and act like the "edit" page -- pages are like albums and content on a page is like the photos in the album. Have pages show up automatically in the nav bar when they're added. The goal isn't to turn this into a bloated content management system, but rather to simplify editing the front, about, and contact pages.
I might see if I can throw together a basic version today. Anyone know where I can find a simple GPLed HTML editor page? And is anyone else interested in this idea, or has someone already done it? Is there an easier way to go about it?
Thanks...
Comments
Last night I was playing with the admin section. I'm amazed that most of the action happens in one file! But I discovered that pages for new tabs can be housed (mostly) in separate files. First, I added a few lines to implement a new tab in admin-functions.php. Then I added this to admin.php:
` <?php } else if ($page == "userpages") { ?>
<?php include('user-pages.php'); ?>`
right before:
` <?php } else { $page = "home"; ?>`
All the other new stuff went into user-pages.php. At the moment it doesn't do much, but several experiments have showed that things copied from other tab handlers generally work okay in that file. Some of the existing logic about "it's this state *and* on that page" is redundant if the relevant code is separated out into its own file. What's really fun is, it still catches action events. Example from my file:
`<?php if ($action == "deletepage") { ?>
DELETE PAGE
<?php } else ... { ?>`Current experiments involve uploading non-gallery pics, based on code from the current image upload tab. It mostly works, except it gets an error message when actually uploading something. Ah well. I'm still not sure whether I really want to add generic user-defined pages, or (to keep it simple) if I should stick with adding support only for artist bio, artist picture, and contact info.
Okay, I don't want to step on any toes here, but I suspect that the admin section could be much easier to maintain if more of it could be broken out into sub-pages like this. Bonus points if you can figure out how to add new tabs without touching any other files just by adding a line in the database. Imagine the plug-in potential.
On another subject, the top-level index.php logic is brilliant. It wouldn't have occurred to me to use logical OR to encode the current state! Very elegant. I can imagine adding states for other page types by adding another power-of-two value to the flag list. Unfortunately the code for actually setting the state assumes that we want to gallop straight to an album list. Maybe we don't, maybe we'd rather start with a welcome screen. :-)
Anyway, I hope everyone reading this has a safe new years holiday...
About your "pages", I like the idea. It seems like it could be generalized quite a bit, with a "page manager" and such. I'm planning on adding custom groups and tags for Zenphoto 2.0, so in that light, a page could display any number or group of images outside the album scope, or a page could be static, pulling stored content from the database and mixing in images from wherever. And of course, it would need a theme file to define the look in accordance with the current theme, that shouldn't be too hard.
Very good idea, I like it.