SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Zend view quick question

    What is the difference between:

    PHP Code:
    $view Zend_Layout::getMvcInstance()->getView(); 
    and:

    PHP Code:
    $view = new Zend_View(); 
    Both seem to work the same. Which one should I use?

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2005
    Location
    Winnipeg
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The former is ugly and a indication the implementor was eager to use patterns? :P

    Use the latter.
    The only constant in software is change itself

  3. #3
    SitePoint Zealot Amenthes's Avatar
    Join Date
    Oct 2006
    Location
    Bucharest, Romania
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually it does matter a lot. The first call is returning you an already
    configured Zend_View instance. It'd be configured by the ViewRenderer
    helper of the Front Controller. It already has default values for scripts and
    helpers directories, etc. The second choice is basically a blank View object,
    you have to configure it manually.
    I'm under construction | http://igstan.ro/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •