• Please allow 5 mins between posts.
  • Although email's are required they are hidden.
  • You can create an avatar that will appear everytime you post on a Gravatar enabled blog.
  • You can use the following tags in your post.
    [code][/code] [url][/url] [img][/img] [quote][/quote] [b][/b] [i][/i] [u][/u]

Smarty cakephp 1.3 Dev

Although the alpha release of cakephp 1.3 is not very stable if you get the developer source of 1.3 its remarkably stable. Although there have been a few alterations. If you are migrating from 1.2.5 using smarty as your templating option then you will need to make a slight alteration to the smarty.php file contained within your views folder. Around line 133 you will find the following:

        $paths = Configure::getInstance(); 

        foreach($paths->viewPaths as $path) { 
            if (file_exists($path . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext)) { 
                $layoutFileName = $path . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext; 
                return $layoutFileName; 
            } 
        } 

        // added for .ctp viewPath fallback 
        foreach($paths->viewPaths as $path) { 
            if (file_exists($path . 'layouts' . DS  . $type . $this->layout . '.ctp')) { 
                $layoutFileName = $path . 'layouts' . DS . $type . $this->layout . '.ctp';
                return $layoutFileName; 
            } 
        } 
You need to replace so it is the same as the following:

        $paths = App::path('views'); 

        foreach($paths as $path) { 
            if (file_exists($path . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext)) { 
                $layoutFileName = $path . 'layouts' . DS . $this->subDir . $type . $this->layout . $this->ext; 
                return $layoutFileName; 
            } 
        } 

        // added for .ctp viewPath fallback 
        foreach($paths as $path) { 
            if (file_exists($path . 'layouts' . DS  . $type . $this->layout . '.ctp')) { 
                $layoutFileName = $path . 'layouts' . DS . $type . $this->layout . '.ctp';
                return $layoutFileName; 
            } 
        }  
Then everything should work. Reading through the feature list of 1.3 there has been additions to how forms and as such the form handler for smarty may need tweaking, I'll be looking at this over the next few days and let you know of any other alterations needed for the 1.3 migration.

No Comments