Jump to content

JoeyH3

New Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Earth

JoeyH3's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm trying to teach myself OOP PHP, and I've been looking up a number of tutorials on how to to make OOP MVC frameworks. I came across this one (cached version - their site is down at the moment of posting), and noticed something interesting about it that I've not seen in other tutorials. Basically, it creates a registry class as $registry (which just uses the __set and __get functions to populate an initially empty array), and then stores variables in there. After that, $registry is passed on to the other classes via their __construct functions, so that they can access site-wide variables. I think I understand how it's working, and see how it can be used, but this tutorial is the only time I've found such a thing. I was wondering, is using such a class good practice, or how should I store and access globally needed variables (like configuration, database connections, etc)?
  2. That works like a charm, thank you very much
  3. Hi all! I'm working on a simple script to manage a webcomic, which will have multiple pages in each chapter. I'm trying to create an archive page which will show thumbnails for every comic, organized by chapter, such as: Chapter 1 Title - Page 1 - Page 2 - Page 3 Chapter 2 Title - Page 1 - Page 2 - Page 3 Etc In MySQL, I have two tables: Chapter (ChapterID, Name) Page (PageID, Chapter, Image, Thumbnail) The only method I could find for achieving this on Google suggested using a query to obtain all of the chapters from the chapter table, and then while looping through the results, use a second statement with a WHERE clause to select the comics for that chapter. However, that just seems like poor practice and sounds horribly inefficient once too many chapters are added. I'm wondering if there's a more efficient way to approach this, so that I can organize my results into groups? If someone could simply give me the logic to use or nudge me in the right direction, I'd gladly appreciate it Thanks, Joey
  4. I like Idea A - it seems simply, easy to implement, and yet still organized. Thank you, your advice is much appreciated
  5. Hello all! I'm beginning to design a website which will be primarily focused on allowing users to upload and share drawings/artwork that they created. I also want to allow users to create profile pages on this site, and be able to post blog entries. Additionally, I want to allow users to be able to leave comments on uploaded images, user profiles, and blog entries. However, I'm having difficulty trying to envision the most efficient way to design the database in order to allow this to happen. At first, I thought of simply having three comment tables - one for image comments, one for profile comments, one for blog comments. However, that just seems inefficient maintenance wise, as if I want to make any changes to the commenting system, then I have to update and test three tables instead of one. Next, I thought of having a single comments table, and having two columns for referencing their parent object - one would be the PK of the blog/image/profile, and the second column would be the type. So then the query for selecting a comment for a journal would look like: select (columns) from comments where reference=(PK of journal) and type="blog". So far, that's been the best idea I could come up with, as that would (likely) guaranty that a comment meant for an image wouldn't accidentally get displayed on a blog entry that ended up having the same PK as the image (I plan on using auto_increment integers on most of the primary keys). However, I just wanted to ask if that is a good way to approach the design, if there were any potential flaws I could be overlooking, or if there is another way that would be better practice? Thanks! Joey
  6. Hi everyone! My name's Joey. I'm a network and systems technician from the Midwest United States. I do website design and development in my spare time as a hobby, and have used PHP and MySQL on and off for the past several years. Primarily I simply modify open source scripts in order to add/modify them to better suit my needs, but I have written both a blogging system and an invoice/billing system from scratch within the past year, as recently I've been pushing myself to better understand the language.
×
×
  • 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.