Instead of accessing superglobals in your view, it would probably be
better to pass to the View a Model object which has methods to do these
kinds of actions.  

In general I think it is a good practice for a View to treat data as
read-only and not alter values or invoke side-effects.  But there's
nothing preventing you from writing a Model class with methods that have
side-effects, and calling those methods from within a View script.  

Application variables solution:

<?php 
  echo $_APP['visitor_count']++;
?>

MVC solution:

<?php
  echo $this->model->getVisitorCount();
  $this->model->incrementVisitorCount();
?>

Regards,
Bill Karwin

> -----Original Message-----
> From: Jack Sleight [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, June 28, 2007 1:00 PM
> To: fw-general@lists.zend.com
> Subject: [fw-general] ZF Application Variables?
> 
> 
> Hi,
> Are there any plans to introduce an application variable type 
> system in ZF?
> Something like this:
> 
> http://www.leosingleton.com/projects/code/phpapp/
> 
> As far as I'm aware this is something PHP cant do. If this is 
> something you would be interested in adding I would be happy 
> to help with a proposal/coding/development.
> 
> Thanks,
> Jack
> --
> View this message in context: 
> http://www.nabble.com/ZF-Application-Variables--tf3996469s1615
> 4.html#a11349949
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 

Reply via email to