• MODX.com

    2,408 downloads

firstPageLink

firstPageLink is an extra by rainbowtiger, first released on 2015-01-18.

Package Description

Plugin to use with WayFinder to link menu items with first page that has content, making all menus clickable, even if they are just containers. The script starts with the resource WayFinder would normally link to, and if it is a container only (no content) it will look down the page tree to find the first page with content and link to that page.

The property value "checkContainers" determines whether the script will require that a resource is set as a container, as well as having empty content, to skip over it in the page tree. Setting checkContainers to "yes" is useful if you want to leave some pages intentionally blank during development, knowing that you are going to fill them in later. The default is "no", meaning a resource only needs a blank content field to trigger the search down the page tree for a page with content.

The script returns the URL of the page.

This plugin was developed in Revolution 2.2.2, but should work well in older versions. Let me know if it is incompatible with the version you are using.

Usage/Installation Instructions

Install via package management. Then install WayFinder (if it isn't already), and create chunks to format the output. See MODx: The Official Guide by Bob Ray, pages 560-561, or visit this page:  http://codingpad.maryspad.com/2011/02/21/modx-revolution-for-complete-beginners-part-8-using-wayfinder-to-create-menus/for ideas about how to do this. Then change the WayFinder placeholder  [[+wf.link]]   to   [[!firstPageLink? &pid=`[[+wf.docid]]`]]    in your code.

For example, change this:

a href="[[+wf.link]]"

to this:

a href="[[!firstPageLink? &pid=`[[+wf.docid]]`]]"

The script takes a single variable, "pid", which should be the ID of the page in your menu for which you want the right link.

Details

Developer(s)
rainbowtiger
Released
2015-01-19
First seen
2015-01-18
License
GPLv2
Supported databases
MySQL
Minimum MODX Requirement
2

firstPageLink Releases

Vendor Signature Released on
MODX.com 1.0.4-pl 2015-01-19 (9 years ago)

We've also seen 1 unverified versions of firstPageLink in use, but don't list those as we've been unable of confirming they are official releases from an official source.