|
|||
|
Can anyone tell me please what is the best method in Zend of attaching JS on a per page basis?
Also, where in the application folder hierarchy would people say is teh best place to store JS files? Thanks Last edited by edward.lynn : 04-28-2008 at 12:21 PM. Reason: Missed a bit |
|
|||
|
I store Javascript files in a folder called /javascript inside the public directory where your bootstrap file is. Your javascript files must be in this directory because they must be readable by the web browser.
If I only want to use Javascipt code for a specific page, I include it inline inside my template file (ex: index.phtml) at the top. |
|
|||
|
Indeed, your javascript should be in a public directory, or people won't be able to access it.
There's a useful view helper for including scripts on demand called HeadScript. You can add scripts in your view (or controller, of course) and then your layout or view script calls the helper to display them. |
|
|||
|
I'm not aware of any good books available yet - haven't really looked though.
Rob Allen (akrabat) is writing Zend Framework in Action (Manning: Zend Framework in Action). If its half as good as the tutorials on his blog (Akra’s DevNotes Zend Framework) I'm sure it'll be great. I've learnt from practical experience. Don't be afraid to play with the components, and use the API to see what methods they have. |
|
||||
|
Here's a post for the books I've found.
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth |
![]() |
| Thread Tools | |
| Display Modes | |
|
|