11

I have been fighting with zend framework for quite some time now. The issue is not PHP itself but these myriad of classes and the relationships between them. for example: i started reading this :http://framework.zend.com/manual/en/learning.layout.usage.html Well everything is fine until the author mentioned the following: To initialize Zend_Layout, add the following to your configuration file

 resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
    resources.layout.layout = "layout"

Now the question is why doing it this way?. I feel like i am just copying an pasting without any real explanation. Then he started using :

  $this->layout()->content

I am like wow!!! wait a minute where is this layout() method located and i kept chasing these methods and classes until i get dizzy and give up.

I have a feeling that i am approaching it (the zend framework ) the wrong way. can anybody give me an idea on the best way to approach Zend framework? Again it is not really about the PHP, it is more about the relationship between the objects.

I feel that i am delving into a spaghetti of classes PLEASE HELP???

4
  • Build your own then it should make sense(hopefully) I do agree that the file hunting does get annoying.. I decided to switch to node.js because it cuts down on boilerplate code, but that probably is subjective Commented Oct 12, 2011 at 21:49
  • I "have to learn Zend Framework, it's a personal challenge". I would like to be able to create code that other programmers can use and understand quickly. Creating my own framework is not quite the best solution. Commented Oct 12, 2011 at 22:04
  • 2
    Do not create your own php framework, oh please do not create another php framework Commented Oct 12, 2011 at 22:16
  • @Ben It helps to understand the organization by creating your own. By no means do I advise creating another unmaintained framework. We have enough of those already :P Commented Oct 12, 2011 at 22:38

1 Answer 1

3

My opinion is that the learning curve for a framework is steeper than normal php, especially for zend. If you have the time and will I suggest that you start with a very small mvc, you'd better go with a tutorial for a really small mvc that you can built on your own.

This should be easy to do, experiment with it a little bit, (even extend it more) and get used to the mvc philosophy and I am sure when you will go back to zend things will be very much easier.

=====================edited================================

I like this one very much, get it here . Understanding the theory is one thing and reaching the point when you say "I know what is needed for this small mvc to be great.." is an other thing. As for zend you could proceed mostly as a new needs appear, so you don't get tired, knowledge never ends and we have a life to live too!

Going straight into the classes code now, will make it difficult. There is a lot of documentation for Zend, you benefit from it as it takes you step by step.

Sign up to request clarification or add additional context in comments.

3 Comments

I do understand the concept of MVC itself, the problem is all these classes. When should i know to stop looking into the zend framework source code and focus more on the functionality that the latter (ZF) offers? Also do you have any good links on building a small MVC application from scratch? How to i keep track on the instances of the objects? sometimes an object is created and instantiated without my knowledge and that is what i am trying to grasp. Thanks again Melsi!
I am going to give it a shot this weekend. I will let you know what happens when i get back to zend. Thanks Melsi.
About keeping track of created objects.. I use a very detailed debugging info, every function/method should be: function(){if(__DEBUG){dbg(debug_backtrace());} ...}. I never never neglect this.. at the end of the execution my dbg() function will print a detailed report on screen. This way know what object was created, who created it, when, which function were called, where when.. everything. Under production I just set __DEBUG to false or comment it out everywhere using a line in the terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.