title: Parsing HTML tags with Smarty
body: <p>Is there I simple way to get contents of a <code>&lt;h1&gt;</code> tag from a html file, using PHP (or Smarty), on the server side?</p>
  
  <p>Background is that I need to do some SEO on a legacy Smarty based PHP site, with bunch of content pages with <strong>no head section defined</strong>.</p>
  
  <p>I.e., the main <code>index.php</code> page loads a shared <code>index.tpl</code> template which contains the <code>&lt;head&gt;</code> section along with <code>&lt;title&gt;</code> and meta description tags <strong>for all pages</strong>, and then just grabs the content from individual <code>pXXX.html</code>, based on an <code>id</code> parameter in the url. Each "content" page has an <code>&lt;h1&gt;</code> tag where the relevant title is stored, but the page title remains fixed all the time.</p>
  
  <p>Since there is too many of them to edit each of them individually, I wanted to see if I could get their each by parsing the page on request. I guess I could make a script which would do some batch processing, but I am looking for a quick solution which wouldn't modify these content pages.</p>
  
  <p>I am open to other suggestions, also. To be honest, I never used Smarty before, so I might be missing something here.</p>