Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-21-2008, 12:52 AM
Junior Member
 
Join Date: May 2008
Posts: 3
Default Createing my own functions files

Hello All,
I was wondering about how I would use my own functions in the zend framework environment, for example a function that generates random strings etc..

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-21-2008, 08:49 AM
Junior Member
 
Join Date: May 2008
Posts: 3
Default found it

Never mind I figured it out, just create a classes folder and add it to your pass, and create a class for exemple UserRegistrationTools, then instantiate it wherever you need it in any controllers.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-21-2008, 02:15 PM
sim sim is offline
Junior Member
 
Join Date: Apr 2008
Posts: 9
Default

Quote:
Originally Posted by salamfall View Post
Never mind I figured it out, just create a classes folder and add it to your pass, and create a class for exemple UserRegistrationTools, then instantiate it wherever you need it in any controllers.
You might want to create the folder as a new library and put the function there. You might also want it to be an Action Helper or a View Helper.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-09-2008, 04:33 PM
Senior Member
 
Join Date: Jan 2008
Location: chicago
Posts: 101
Default

If you only need a function for one specific page, you can define it as a member function within that page's class. for example:
PHP Code:
class indexController() {
        function 
indexAction() {
                
//code here

                
$this->myOwnFunction();
        }

        function 
myOwnFunction() {
                
//your code here
        
}

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:34 PM.