Monday, 4 April 2011

Modx - Coding

At the moment im working on getting Modx to redirect pages to the first sub nagivation link. This is because when you set up a 'folder' or 'container' in Modx it uses it as a page also. This is causing me probles with having several blank pages thorughout the website. I have found a Modx addon called 'phiRedirect' which could do the job. Im going to try this and write the next part of my blog post to let you know if it works.

phiRedirect 1.1.0

Use this snippet to redirect users to the document you'd like to show.
This is often useful, for example, in the case of emulating the behavior of traditional Web sites' folders.

If no document is found, this snippet redirects users to error page.

Installation Instructions
e.g. Redirect to document(ID is 1)

[[phiRedirect? &id=`1`]]

e.g. Redirect to the parent of current document.

[[phiRedirect? &to=`parent`]]

e.g. Redirect to the first child of current folder document.

[[phiRedirect? &to=`child`]]

e.g. Redirect to the parent of document(ID is 5).

[[phiRedirect? &to=`parent` &id=`5`]]

e.g. Redirect to the first child of the folder document(ID is 6).

[[phiRedirect? &to=`child` &id=`6`]]




This works!!! I have used the ID attribute to redirect to page '12' in my documents.

No comments: