brendanmetzger / diatom

A template framework
1 stars 0 forks source link

Consider glob on Template insert paths #49

Closed brendanmetzger closed 3 years ago

brendanmetzger commented 3 years ago

The premise is to allow a complicated insert, or creating a gallery or index pages... ie

<!-- insert people/profiles* //img -->

Looking at where this could be resolved in the Template, first thinking would be to wait for php 8 and the match so something like the following can be implemented (which would require the getSlug() loop being refactored into a function I think)


      $DOM = match($path) {
        is_file($path)           => Document::open($path),
        str_contains('*', $path) => glob($path),
        Route::exists($path)     => Request::GET($path, $data)->document
      };

     // could catch (UnhandledMatch) or something, or add a default => Request::GET... perhaps