obmon;11021053 wrote:Does my OOP suck?
Hard to say, you haven't posted much.
obmon;11021053 wrote:is running multiple methods on a value {ie: strip_tags($copy->truncateString($articles[$i]['body'], 250, " "))} a terrible way to manage resources?
I wouldn't say calling a function on your method is necessarily bad -- you might want to do it in your method if you find yourself doing it every single time -- or perhaps defining an optional parameter that does the strip_tags bit. Not sure how it relates to "managing resources." If you have to strip tags, that's a pretty decent way to do it and fairly efficient. If you don't have to strip tags, then yes, it's a waste.
obmon;11021053 wrote:Should I create seperate methods to use for the following line: {echo '' . $articles[$i]['title'] . ' (' . $articles[$i]['date'] . ')' .strip_tags($copy->truncateString($articles[$i]['body'], 250, " ")) . '
Read more
';}?
Not sure what you're asking...should you define a method that does what all that code does? If you do it a lot, sure.
I can't really comment on the notes you posted about your code, but I would suggest that it's not a pain in the ass to maintain echo statements with all kinds of HTML like you have. I find that whenever I end up doing this, I later wish that the HTML could have been separated from the logic that retrieves the data to be displayed. This is typically because HTML has evolved, smart phones have become popular (and they require a totally different layout) and also because HTML is not the only way I might want to display my content -- I might want RSS or XML or something else entirely.
I hope this is helpful input. You obviously have a reasonably good command of classes and such. I don't know much about how your code works overall. You might want to check out CodeIgniter or Zend Framework -- they have some pretty clever code organization which you may find interesting.