logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Auth/ACL/Perms, Framework issues etc: msg#00071

Subject: Re: Auth/ACL/Perms, Framework issues etc
Hello,

Thanks about this, well, i did precisely that somewhile ago and i got an exception thrown that the controller was not an instanceof Zend_Controller_Action. Now either i was being really dumb (happens :) ) or this restriction was removed (sorry i don't have the time to dig this issue) the thing is i tried it now with latest svn (219 rev) and it's working, so thumbs up and completely ignore the part of my email where i mention it.

Thanks both, best regards,

Rui Barreiros

Stephane Crivisier wrote:

Hi all :)

On 4/18/06, Ralf Eggert <r.eggert-NdIitsehInIb1SvskN2V4Q@xxxxxxxxxxxxxxxx> 
wrote:
Hi Rui,

One of the things i hate the most is repetition, honestly i think that
the requirement of the controller to be extended from
Zend_Controller_Action should be removed, simply because imagine i have
the need to setup something at all my controllers constructor, or add a
method wich will be always the same for all my controllers, i will have
to write always the same piece of code into all my controllers, so i
would love to be able to do this:

class MyApplication_Controller_Action extends Zend_Controller_Action {
   function __construct()
   {
      // do my repeating code here
   }

   protected function myrepeatablefunction()
   {
   }
}

class IndexController extends MyApplication_Controller_Action
{
   public function indexAction()
   {
      echo "blah";
   }
}
If I understand you correctly, you already can do this with almost no
hassle. Just create a new subdirectory below your include_path to the
Zend Framework. There is a nice example in the Zend Framework manual [1].


I think you understand him correctly...

Have a look at this directory structure (Widget can be replaced by your
own company name or whatever).

/library
 /Zend
 /Widget
   /Controller
     Action.php
     README.txt

The Action.php could look like this:

class Widget_Controller_Action extends Zend_Controller_Action
{
   public function __construct()
   {
       // do your controller stuff
   }

   public function indexAction()
   {
   }

   protected function myrepeatablefunction()
   {
   }
}

The only problem is that you have to declare an empty indexAction()
function since the indexAction() in the abstract Zend_Controller_Action
class is also declared as abstract.


I can't agree that point.
You can declare your class as an abstract class like this:

abstract class Widget_Controller_Action extends Zend_Controller_Action
{
 public function __construct()
 {
   // do your controller stuff
 }

 protected function myrepeatablefunction()
 {
   // do your other stuff...
 }

}

Now you can't instanciate a Widget_Controller_Action but you cant extend it :

class IndexController extends Widget_Controller_Action
{
  public function indexAction()
  {
       myrepeatablefunction();

       // do whatever you like
  }
}

IndexController have to implements indexAction() because this method
is an abstract method from Zend_Controller_Action.

Hope that can help both of you ;)

Best regards

PS: sorry for my english
--
Stéphane Crivisier
Étudiant à l' {EPITECH.}




Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.firebase.por...    text.xml.xalan....    qnx.openqnx.dev...    user-groups.zar...    internationaliz...    kde.devel.konve...    finance.e-gold....    emacs.latex.pre...    gis.therion/200...    web.webmin.gene...    yellowdog.gener...    vserver/2003-08...    redhat.release....    sysutils.tivoli...    xfree86.expert/...    mail.becky.user...    hardware.netapp...    netbsd.ports.xe...    python.distutil...    boot-loaders.gr...    culture.interne...    java.springfram...    activedir/2006-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe