Jump to content

wilco

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.bedrockframework.com/

Profile Information

  • Gender
    Not Telling

wilco's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You don't necessarily need to store this information in a database, you could just write the information to a file as well. It really depends on whether or not you have access to a database, and what database. If you do, and it is the most common companion to PHP (MySQL), then I would look at the PHP PDO reference to learn how to read/write data to a database. Otherwise, look at the filesystem functions to see how to write information to a file. I would recommend looking at the fopen(), fread(), and fwrite() functions in particular.
  2. So I just got dinged for announcing my open source project in the frameworks forum (read: not viagra ads or pyramid schemes, but a relevant not-for-profit/open-source PHP project), but it gave me an idea. If there isn't currently a forum appropriate for members to announce open source and other PHP-related projects , why not create one? That way people that don't want to see those types of post can avoid them, and those that want to find out about new projects and the like could have a place to do so? What do you think?
  3. Thanks for all the feedback! And thanks nrg_alpha for the optimization tips - that was something I really overlooked in a rush to get everything put together and ready to launch. That extra menu in the upper right has really been bothering me too, just can't figure out what to do up there. Maybe it doesn't make sense to have a menu up there at all, I could use that space for something else perhaps...
  4. Just posted up a quick announcement about the project I launched today over here, but wanted to post up a link here to get feedback on the site itself. www.bedrockframework.com So what do you think? Any recommendations on what to change/improve?
  5. It's generated with code when it's first inserted (or updated). I figured paying for the CPU/memory ahead of time would save me later when I needed to display the info.
  6. I finally sat down and worked my way through it yesterday, and came up with something very similar to what you suggested. In case it helps anyone else, here's what I came up with (and thanks for the help on this!): <?php /** * Builds a string containing an unordered list of groups. * @param integer $parentId the parent ID to start building the list from * @param array $groupVOs an array of group Value Objects from which to build the list * @return string the unordered list */ function buildGroupList($parentId, $groupVOs) { $result = ""; foreach($groupVOs as $groupVO) { if($groupVO->getParent_id() == $parentId) { $result.="<li>".$groupVO->getName()."</li>"; if(strlen($children = buildGroupList($groupVO->getId(), $groupVOs))) { $result.= $children; } } } if(strlen($result) > 0) { $result = "<ul>".$result."</ul>"; } return $result; } ?>
  7. Actually, I just used that as a simplified example. The way it is actually used is for a heirarchical group structure (so pretend Tom, Dick, and Harry are sub-groups that could be parents for additional children).
  8. How would I approach this problem? I want to build an unordered list from some database entries, but rebuilding the heirarchical information stored with each row. So here's some example rows: ID PARENT_ID NODE_PATH NAME 1 0 0000:0001 Administrators 2 0 0000:0002 Users 3 0 0000:0003 Guests 4 2 0000:0002:00004 Tom 5 2 0000:0002:00005 Dick 6 2 0000:0002:00006 Harry How might I go from the above to this: Administrators Users Tom Dick Harry [*]Guests I'm guessing some recursion will be in order, but I haven't had to think recursively since college and I'm a bit rusty. Any help appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.