PagePathHistory::getPathInfo() method

Get array of info about a path if it is in history

If path is found in history, the returned array id value will be populated with a positive integer of the found page ID. If not found, it will be populated with integer 0.

By default this method attempts to perform exact path matches only. To enable partial matches of paths that may be appended with additional URL segments, set the allowUrlSegments option to true. Note that it will only apply to matched pages that have templates allowing URL segments.

Return array includes:

  • id (int): ID of matched page or 0 if no match.
  • path (string): Path that was matched.
  • language_id (int): ID of language for path, if applicable.
  • templates_id (int): ID of template for page that was matched.
  • `parent_id (int): ID of parent for page that was matched.
  • status (int): Status of the page that was matched.
  • created (string): Date that this entry was created (ISO-8601 date/time string).
  • name (string): Name of page that was matched in default language.
  • urlSegmentStr (string): Portion of path that was identified as URL segments (for partial match).
  • matchType (string): Contains value “exact” when exact match, “partial” when partial/URL segments match, or blank string when no match.

Note that the urlSegmentStr and matchType properties may only be of interest if the given allowUrlSegments option is set to true.

Available since version 3.0.186.

Usage

// basic usage
$array = $pagePathHistory->getPathInfo(string $path);

// usage with all arguments
$array = $pagePathHistory->getPathInfo(string $path, array $options = []);

Arguments

NameType(s)Description
pathstring
options (optional)array
  • allowUrlSegments (bool): Allow matching paths with URL segments? (default=false) When used, the urlSegmentStr return value property will be populated with slash separated URL segments that were not part of the matched path, and the matchType property will contain the value “partial”.

Return value

array


PagePathHistory methods and properties

API reference based on ProcessWire core version 3.0.200

Twitter updates

  • Weekly update: Smooth rollout for ProcessWire 3.0.200 main/master, plus getting started on a new WP-to-PW site conversion and why they can be so rewarding— More
    20 May 2022
  • New main/master version of ProcessWire that has more than 220 commits, resolves more than 80 issues, adds numerous new features, performance improvements and optimizations, and consumes HALF the disk space of our previous release— More
    13 May 2022
  • Summary of weekly core updates for 22 April 2022 More
    22 April 2022

Latest news

  • ProcessWire Weekly #419
    In issue 419 of ProcessWire Weekly we'll check out this week's core updates, introduce a brand new recipe of the week, and more. Read on!
    Weekly.pw / 21 May 2022
  • ProcessWire 3.0.200 new master/main version
    This new main/master version has more than 220 commits, resolves more than 80 issues, adds numerous new features, performance improvements and optimizations, and consumes HALF the disk space of our previous release. This post covers all the details.
    Blog / 13 May 2022
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull