Downloads » Resources » FirstChildRedirect

FirstChildRedirect

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Votes: 4

FirstChildRedirect 1.1

Makes the docid parameter optional and defaults to the current page.

Works with MODx Version(s): All
Submitted: Jul 21st 2006 | License: Public Domain | Downloads: 1651

This snippet was created to have MODx folders emulate the behavior of traditional folders in a web site by redirecting to the first child page it contains.

Description

Use FirstChildRedirect to redirect users to the first document in a folder (based on menuindex sort order) when they access a folder document within MODx.

If no children are found for the specified document, FirstChildRedirect will redirect users to the site start page, though this behavior can easily be modified in the snippet code: just look for $modx->config['site_start'] and replace it with another config value ( e.g. $modx->config['error_page'] ) or a specific document id.

Instructions

Create a new snippet called FirstChildRedirect and copy and paste the contents of the snippet.FirstChildRedirect.tpl file into it. Save the snippet and you are ready to use it.

You can place the snippet in any content of a MODx document specified as a folder (i.e. has children) to redirect to the first child:


[[FirstChildRedirect]]

or for cached folders, use...

[!FirstChildRedirect!]


You can optionally have it redirect to the first child of another document by specifying the parameter docid...

[[FirstChildRedirect &docid=`12`]]

Previous Releases

FirstChildRedirect 1.0

Initial Release

Works with MODx Version(s): All
Submitted: Jul 20th 2006 | License: Public Domain | Downloads: 405
This resource has been deprecated.


Extras

No results found.


( back to top )