dotCMS Showing All Pages using a Template

Posted by Umair Abbasi on March 29, 2014 in Technology


Code updated March 24, 2015

The following code will pull all pages in dotCMS for a given template identifier. Template idenitifer can be found by going to templates tab->opening a template->and copying the identifier on top of the page.

Tested on dotCMS 2.5.7.

<form>
  Template Identifier:
  <input type="text" value="" name="templateid">
  <input type="submit" value="submit" class="btn-primary btn-small">
</form>

#if ($request.getParameter("templateid"))
#set ($templId=$request.getParameter("templateid"))

#getSQLResults("SELECT title, friendly_name, parent_path, asset_name FROM htmlpage, identifier, htmlpage_version_info WHERE htmlpage.template_id='$templId' AND htmlpage.identifier=identifier.id AND htmlpage.inode=htmlpage_version_info.working_inode AND htmlpage_version_info.working_inode=htmlpage_version_info.live_inode ORDER BY parent_path")

  <table class="table">
    <tr>
      <td>Count</td>
      <td>Page Title</td>
      <td>Page Friendly Name</td>
      <td>Page URI</td>
    </tr>
    #foreach($a in $results)
      <tr>
        <td>$velocityCount</td>
        <td>$a.title</td>
        <td>$a.friendly_name</td>
        <td><a href="${a.parent_path}${a.asset_name}">${a.parent_path}${a.asset_name}</a></td>
      </tr>
    #end
  </table>
#end

dotcms, code

Other Good Reads

Audio tape recording reel
Why not Google Duplex it?

Nov. 27, 2018

The California morning on my walk to work.
Love on the Morning Walk

Nov. 7, 2018

Umair and Yulia in Istanbul
Umair and Yulia, the coincidence

Oct. 25, 2018

Horses by a jogging track in Utrecht, Netherlands
My fascination with horses

Sept. 26, 2018


Comments