/ Published in: PHP
                    
                                        A small snippet on how to create a dynamic model in CakePHP (useful for global functions that need a model to function. IE functions defined in the AppController
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 <?php // THE DYNAMIC MODEL App::Import('Model', $model); $this->DynamicModel = new $model; // USAGE EXAMPLE function getModelColumns($model){ App::Import('Model', $model); $this->DynamicModel = new $model; } ?>
Comments
                    Subscribe to comments
                
                