Support » Fixing WordPress » What would you do?

  • I essentially am stuck on making the loop Object oriented for my framework, that is putting it in a loop. I have the core idea down, How ever as you will know, you should always separate your “view” from your logic. with that type of MVC logic in mind, how can you take the loop and make it OOP? I find I am echoing things inside my functions with in the class – which is the part I am saying is wrong.

    I have a sample of my work on gist with an example of how to use it. I would like the communities feed back.

    The lines I am most concerned about is 75 and 78 – This is not best OOP logic.

    Gist Example of OOP loop

    Keep in mind this is a work in progress.

Viewing 2 replies - 1 through 2 (of 2 total)
  • To keep content and code separated, set up a template file in your theme. Then in your object, you can set up whatever variables are needed. Once youv’e done that, use include() to read the template file into the objects function and it will be output as you’re expecting. That way you have the code in one place, the template in another place (which lets it be changed a lot easier), and you get to keep your OO code.

    Thanks I’ll keep that in mind. I am building an entire framework (think of zend – less ambitious) for theme designers and theme framework developers to easily get a project off the ground.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What would you do?’ is closed to new replies.