Parent Pagetitle

How do you get a parents pagetitle and display it? I have a chunk that displays results of games. I have template variables team name, team score, team crest, date and venue. I can display these easily but I need to display the parent pagetitle as I have the layout like this below for the competition.

  • Competition Name (parent folder)
    ** Quarter Final
    *** Game 1
    *** Game 2
    *** Game 3
    *** Game 4
    ** Semi Final
    *** Game 5
    *** Game 6
    ** Final
    *** Game 7

So you’d see Game 1, both the teams names, the score, the date and the venue and underneath you’d see Quarter Final.

<div class="widget-list">
  <div class="widget-title">
    <div class="widget-title-left">
      <span class="team-logo"><img width="30" height="30" src="[[+tv.Foireann_1_Crest]]" alt=""></span>
      <span class="team-name">[[+tv.Foireann_1_Name]]</span>
    <span class="result"><a href="[[~[[+id]]]]">[[+tv.Foireann_1_Score]]<span class="result-sep"> * </span>[[+tv.Foireann_2_Score]]</a></span>
    <div class="widget-title-right">
    <span class="team-logo"><img width="30" height="30" src="[[+tv.Foireann_2_Crest]]" alt=""></span>
    <span class="team-name">[[+tv.Foireann_2_Name]]</span></div>
  <div class="widget-info">
    <span class="date">[[+tv.Cluiche_Date]]</span>
    <span class="venue"><a href="[[~[[+id]]]]" rel="tag">[[+tv.Cluiche_Venue]]</a></span>
    <span class="competition"><a href="[[~[[+id]]]]" rel="tag">[[+parentPagetitle]]</a></span>

Do you have the pdoTools extra installed?

If so you can use the pdoField snippet to grab any info about any resource:


This [[pdoField? &id=[[+parent]] &field=pagetitle]] worked perfectly. Thanks a million dejaya :slight_smile:

1 Like

You could use Fenom parser, that makes this task really easy

{$_modx->resource.parent | resource: ‘pagetitle’}

And there is this.

1 Like