文件名称:Joomla! 1.5 Development Cookbook.pdf
文件大小:5.2MB
文件格式:PDF
更新时间:2022-09-03 08:52:29
Joomla Development Cookbook
Table of Contents Preface 1 Chapter 1: Development using JoomlaCode.org and SVN 7 Setting up a JoomlaCode.org project 11 Managing members of a JoomlaCode.org project 16 Setting up JoomlaCode.org Subversion 17 Understanding the Subversion skeleton 20 Understanding revisions in Subversion 22 Understanding the Subversion process 24 Checking out a Subversion repository using TortoiseSVN 28 Editing a working copy using TortoiseSVN 31 Inspecting changes using TortoiseSVN 32 Updating a working copy and resolving conflicts using TortoiseSVN 34 Committing changes using TortoiseSVN 36 Exporting a working copy using TortoiseSVN 38 Chapter 2: Keeping Extensions Secure 39 Writing SQL safe queries 41 Writing SQL-safe LIKE string comparison queries 46 Using the token 48 Making a filename safe 52 Making a directory path safe 54 Making a path safe 56 Safely retrieving request data 58 Getting a value from an array 65 Chapter 3: Working with the Database 67 Executing a query 70 Loading the first cell from the result of a query 72 Loading the first record from a query 74 This material is copyright and is licensed for the sole use by Vadim Kudria on 4th October 2009 6352 108th St, , Forest Hills, , 11375 Download at WoweBook.Com ii Table of Contents Loading more than one record from a query 77 Handling DBO errors 79 Creating a JTable 81 Creating a new record using a JTable 84 Updating a record using a JTable 87 Reading an existing record using a JTable 88 Deleting a record using a JTable 88 Checking a record in and out (record locking) using a JTable 89 Modifying record ordering using a JTable 91 Publishing and unpublishing a record using a JTable 93 Incrementing a record hit counter using a JTable 95 Chapter 4: The Session and the User 97 Getting the session handler 98 Adding data to the session 99 Getting session data 102 Checking for session data 104 Checking the session token 105 Getting the user 105 Determining if the current user is a guest 107 Getting the user's name and username 108 Getting the user's group ID and type 109 Restricting a user's access using Public, Registered, and Special 111 Getting the user's parameters 113 Setting the user's parameters 115 Extending and editing user parameters 116 Sending an email to the user 119 Chapter 5: Multilingual Recipes 123 Creating a translation 126 Translating some text 130 Determining the character length of a UTF-8 string 133 Removing leading and trailing UTF-8 whitespace 134 Comparing UTF-8 strings 136 Finding a UTF-8 string in a UTF-8 string 137 Executing a regular expression on a UTF-8 string 139 Reversing a UTF-8 string 141 Extracting a substring from a UTF-8 string 142 Replacing occurrences of a UTF-8 string in a UTF-8 string 143 Accessing characters in a UTF-8 string by position 145 This material is copyright and is licensed for the sole use by Vadim Kudria on 4th October 2009 6352 108th St, , Forest Hills, , 11375 Download at WoweBook.Com iii Table of Contents Converting a string from one encoding to another 146 Creating a UTF-8 aware database installation script 147 Chapter 6: Interaction and Styling 149 Getting page and component parameters 150 Adding CSS to a page 152 Overriding component templates 154 Adding JavaScript to a page 155 Creating a modal window 157 Generating modal content 160 Updating an element using Ajax and MooTools 161 Updating an element based on a form using Ajax and MooTools 164 Providing an Ajax response from a component 166 Enabling pagination in a list of items 169 Chapter 7: Customizing the Document 173 Setting the document title 175 Setting the document generator 176 Setting the document description 176 Adding metadata to the document 177 Changing the document character set 178 Changing the document MIME type 180 Controlling client caching of responses 181 Creating a PDF in a component 183 Creating an RSS or Atom feed in a component 185 Outputting a RAW document from a component 190 Using a custom JDocument in a component (PHP 5 only) 192 Chapter 8: Customizing the Backend 199 Disabling the menu bar 200 Setting the toolbar title and icon 201 Adding common item manipulation buttons to the toolbar 203 Adding common itemized manipulation buttons to the toolbar 205 Adding custom buttons to the toolbar 207 Adding spacers and dividers to the toolbar 210 Adding a help system to a component 211 Creating a filter header for tabular data in an MVC component 213 Filtering tabular data in an MVC component 217 Creating toggle-enabled order column headers for tabular data in an MVC component 222 Ordering tabular data in an MVC component 224 This material is copyright and is licensed for the sole use by Vadim Kudria on 4th October 2009 6352 108th St, , Forest Hills, , 11375 Download at WoweBook.Com iv Table of Contents Chapter 9: Keeping it Extensible and Modular 227 Loading plugins 229 Invoking a plugin 230 Creating a Joomla! search plugin 232 Creating your own library and import function 237 Installing a plugin programmatically during a component installation 240 Managing categories the easy way 243 Defining JParameters using XML 245 Creating a JParameter object 247 Rendering a JParameter object 248 Saving JParameter data 251 Getting and setting values in a JParameter object 252 Defining your own JParameter type 254 Chapter 10: JObjects and Arrays 259 Getting a JObject property 262 Getting all of the public JObject properties 263 Setting a JObject property 263 Setting a batch of JObject properties 265 Reporting an error in a JObject 265 Getting an error from a JObject 267 Getting all errors from a JObject 268 Converting an object to an array 269 Converting an array to an object 270 Getting a column from a multidimensional array 272 Getting a value from an array 273 Casting all elements of an array to integers 274 Sorting an array of objects 275 Imploding an array 277 Chapter 11: Error Handling and Reporting 279 Raising an error-level J!error 281 Raising a warning-level J!error 283 Raising a notice-level J!error 285 Enqueuing a message 287 Changing the default J!error handling 290 Handling and raising a bespoke J!error 292 Logging errors and events using JLog 295 Throwing exceptions with PHP 5 298 Catching exceptions with PHP 5 300 This material is copyright and is licensed for the sole use by Vadim Kudria on 4th October 2009 6352 108th St, , Forest Hills, , 11375 Download at WoweBook.Com v Table of Contents Chapter 12: Files and Folders 305 Checking whether a file or folder exists 307 Reading a file 309 Deleting a file or folder 310 Copying a file or folder 312 Moving and renaming files and folders 314 Creating a folder 315 Uploading files to Joomla! 317 Reading a directory structure 322 Changing file and folder permissions 324 Index 327