Jump to content

Recommended Posts

Posted

Hello,

i am trying to integrate a manfiest file into my PW page.

But it seems like file_get_contents is disabled somehow.

<?php 
$manifest_path = 'path/to/manifest.json';
$hashes = json_decode(file_get_contents($manifest_path), TRUE);
$css_hash = $hashes['main.css'];
var_dump($css_hashe); // works only outside of of processwire. 
?>  

whats the correct way to include a file like this into PW?

Thanks for your help.

Posted

Are you sure the path is correct? What if you omit true (i.e. don't just search in include-path) and use an absolute path?

PW doesn't disable this function.

If you're in devmode and/or have Tracy Debugger installed, you should see some hint why it's failing.

  • Like 1
  • Thanks 1
Posted

Have you tried to use an absolute path like this?

<?php

$manifest_path = $config->paths->templates . 'path/to/manifest.json';
// ...

 

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...