Jump to content

Classes : Content And Logic


djp1988
 Share

Recommended Posts

Hello, Is there a rule I should follow to make better classes? I am using echo in some of my methods in my class, I just wondered if I was going down the wrong road, I have a method for each page, and call it from a separate php script, in these methods i use echo and output the content while also using the classes other methods and info to keep it all in one place, But someone said to me that really classes shouldn't be used in that way, it should allow you to separate logic from content, or should I say separate output from non-output logic...Any suggestions ?I've started to rewrite my class removing the page specific methods and putting them on their actual page on their own, whil still including the class to access other methods.

Link to comment
Share on other sites

Your correspondent is probably referring to the MVC* / three-tier style of programming. It does make things less confusing.* don't worry about all the frameworks.

Edited by Synook
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...