in reply to Re^6: Mojolicious with Template Toolkit
in thread Mojolicious with Template Toolkit

Can you show the directory hierarchy you have setup? The output of tree perhaps. Also, see Mojo::Home:

use Mojo::Home; my $home = Mojo::Home->new; print $home;

Replies are listed 'Best First'.
Re^8: Mojolicious with Template Toolkit
by hippo (Archbishop) on Mar 08, 2023 at 17:14 UTC

    Originally I had this (abridged):

    .
    ├── html
    │   ├── pix
    │   │   ├── cc2.png
    │   │   ├── dilad.png
    │   │   ├── favicon.png
    │   │   └── wallpaper_1080x2400.png
    │   ├── app
    │   │   └── mojo2.fcgi
    │   └── robots.txt
    ├── lib
    │   └── MyApp.pm
    ├── t
    └── templates
        ├── MyApp
        │   ├── home.html.tt -> home.tt2
        │   ├── home.tt2
        └── lib
            ├── footer.tt2
            ├── form.tt2
            └── header.tt2
    

    but now I've moved the application mojo2.fcgi up so that it's like this:

    .
    ├── fcgi
    │   └── mojo2.fcgi
    ├── html
    │   ├── pix
    │   │   ├── cc2.png
    │   │   ├── dilad.png
    │   │   ├── favicon.png
    │   │   └── wallpaper_1080x2400.png
    │   └── robots.txt
    ├── lib
    │   └── MyApp.pm
    ├── t
    └── templates
        ├── MyApp
        │   ├── home.html.tt -> home.tt2
        │   ├── home.tt2
        └── lib
            ├── footer.tt2
            ├── form.tt2
            └── header.tt2
    

    and this allows me to use the relative paths ../templates/lib etc in the plugin.

    Mojo::Home looks like it might be useful for other things, however, so thanks for the pointer. There's clearly a lot of domain knowledge here which I don't have - and that isn't unique to this framework by a long way.


    🦛

      mojo generate app hippo

      generates:

      .
      ├── hippo.yml
      ├── lib
      │   ├── hippo
      │   │   └── Controller
      │   │       └── Example.pm
      │   └── hippo.pm
      ├── public
      │   └── index.html
      ├── script
      │   └── hippo
      ├── t
      │   └── basic.t
      └── templates
          ├── example
          │   └── welcome.html.ep
          └── layouts
              └── default.html.ep
      
      9 directories, 8 files
      
      

      Tutorial explains defaults for static files, external templates and Home among others.