cakephp-2.0 > Router :: connectNamed()
A AbstractTransport AclBehavior AclComponent AclInterface AclNode AclShell Aco AcoAction ActionsAuthorize ApcEngine ApiShell App AppController AppController AppHelper AppHelper AppModel AppModel AppShell Aro AuthComponent B BadRequestException BakeShell BakeTask BaseAuthenticate BaseAuthorize BasicAuthenticate BasicAuthentication BehaviorCollection C Cache CacheEngine CacheException CacheHelper CacheSession CakeEmail CakeErrorController CakeException CakeLog CakeLogException CakeLogInterface CakePlugin CakeRequest CakeResponse CakeRoute CakeSchema CakeSession CakeSessionException CakeSessionHandlerInterface CakeSocket ClassRegistry CommandListShell Component ComponentCollection ConfigReaderInterface Configure ConfigureException ConnectionManager ConsoleErrorHandler ConsoleException ConsoleInput ConsoleInputArgument ConsoleInputOption ConsoleInputSubcommand ConsoleOptionParser ConsoleOutput ConsoleShell ContainableBehavior Controller ControllerAuthorize ControllerTask CookieComponent CrudAuthorize D DatabaseSession DataSource DbAcl DbAclSchema DbConfigTask DboSource Debugger DebugTransport DigestAuthenticate DigestAuthentication Dispatcher E EmailComponent ErrorHandler ExceptionRenderer ExtractTask F File FileEngine FileLog FixtureTask Folder ForbiddenException FormAuthenticate FormHelper H Helper HelperCollection HelpFormatter HtmlHelper HttpException HttpResponse HttpSocket I I18n I18nModel i18nSchema I18nShell Inflector IniReader InternalErrorException J JqueryEngineHelper JsBaseEngineHelper JsHelper L L10n M MailTransport MediaView MemcacheEngine MethodNotAllowedException MissingActionException MissingBehaviorException MissingComponentException MissingConnectionException MissingControllerException MissingDatabaseException MissingDatasourceConfigException MissingDatasourceException MissingHelperException MissingLayoutException MissingModelException MissingPluginException MissingShellException MissingShellMethodException MissingTableException MissingTaskException MissingTestLoaderException MissingViewException Model ModelBehavior ModelTask MootoolsEngineHelper Multibyte Mysql N NotFoundException NumberHelper O Object ObjectCollection P PagesController PagesController PaginatorComponent PaginatorHelper Permission PhpReader PluginShortRoute PluginTask Postgres PrivateActionException ProjectTask PrototypeEngineHelper R RedirectRoute RequestHandlerComponent Router RouterException RssHelper S Sanitize Scaffold ScaffoldView SchemaShell Security SecurityComponent SessionComponent SessionHelper SessionsSchema Set Shell ShellDispatcher SmtpTransport SocketException Sqlite Sqlserver String T TaskCollection TemplateTask TestsuiteShell TestTask TextHelper ThemeView TimeHelper TranslateBehavior TreeBehavior U UnauthorizedException UpgradeShell V Validation View ViewTask W WincacheEngine X XcacheEngine Xml XmlException

connectNamed

line:356 at /lib/Cake/Routing/Router.php
Specifies what named parameters CakePHP should be parsing out of incoming urls. By default CakePHP will parse every named parameter out of incoming URLs. However, if you want to take more control over how named parameters are parsed you can use one of the following setups:

Method

(array) public connectNamed ($named, $options = array())

Parameters

ParameterTypeCommentDefault
$named array required A list of named parameters. Key value pairs are accepted where values are either regex strings to match, or arrays as seen above.
$options array optional Allows to control all settings: separator, greedy, reset, default array()

Return

array

Comment

Specifies what named parameters CakePHP should be parsing out of incoming urls. By default
CakePHP will parse every named parameter out of incoming URLs. However, if you want to take more
control over how named parameters are parsed you can use one of the following setups:

Do not parse any named parameters:

{{{ Router::connectNamed(false); }}}

Parse only default parameters used for CakePHP's pagination:

{{{ Router::connectNamed(false, array('default' => true)); }}}

Parse only the page parameter if its value is a number:

{{{ Router::connectNamed(array('page' => '[\d]+'), array('default' => false, 'greedy' => false)); }}}

Parse only the page parameter no matter what.

{{{ Router::connectNamed(array('page'), array('default' => false, 'greedy' => false)); }}}

Parse only the page parameter if the current action is 'index'.

{{{
Router::connectNamed(
array('page' => array('action' => 'index')),
array('default' => false, 'greedy' => false)
);
}}}

Parse only the page parameter if the current action is 'index' and the controller is 'pages'.

{{{
Router::connectNamed(
array('page' => array('action' => 'index', 'controller' => 'pages')),
array('default' => false, 'greedy' => false)
);
}}}

### Options

- `greedy` Setting this to true will make Router parse all named params. Setting it to false will
parse only the connected named params.
- `default` Set this to true to merge in the default set of named parameters.
- `reset` Set to true to clear existing rules and start fresh.
- `separator` Change the string used to separate the key & value in a named parameter. Defaults to `:`

@param array $named A list of named parameters. Key value pairs are accepted where values are
either regex strings to match, or arrays as seen above.
@param array $options Allows to control all settings: separator, greedy, reset, default
@return array