Designing a PHP class. The right way
<p>I am making a simple blog and I want to use a class for this. I am wondering what the best way of doing this may be. There are 3 methods so far that I can see. I made a class that got links, posts and comments. The problem with returning all of this data in a single array was that the data that only should have been echoed a single time was echoing as many times as the rows I was returning. Some people would say that this was correct and that I should have everything in a single array. I'm still not convinced this is the right way to go.</p>

<p>I'd really appreciate some input as to how some of you guys might design a class to handle these 3 things. The only thing I know I need for the class so far is a link to the database. What other members I should use are unclear to me. Again, I'd like to gain a perspective here on how it should be done.</p>

<p>Thanks,
John</p>

<p><hr /></p>

<p>OK, so if I had say 3 methods like this:</p>

<pre><code>var $db;

function GetPosts() {
//posts
}

function GetComments() {
// blog comments
}

function GetLinks() {
// links for the blog
}
</code></pre>

<p>What might be some of the members you guys would use?</p>

<p>Also, I'm wondering if I should have a method that calls other methods. Just one public method and then make all of these other methods private. The public method would call the private methods and return their values. Is this advisable?</p>
