mrdaliri
mrdaliri

Reputation: 7338

How to use Utilities in static pages

I want to use File and Folder Utilities to list files in a folder (which is located in webroot directory)

It's so easy to do it in a controller action, but how can I use them a static page? (which there's no action in PagesController for it)

Upvotes: 0

Views: 138

Answers (1)

nappo
nappo

Reputation: 594

You can do that just like in a controller. Load the Classes with App::uses() and create an instance. It works everywhere inside of CakePHP (model, controller, helper, component, view, ...).

See http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html for details.

Upvotes: 1

Related Questions