hellomoto Posted August 19, 2017 Share Posted August 19, 2017 I am working on a module that runs/previews (for pub/unpub) imports on importer page view. The template has to be in site/templates, so far as I know, so one is created there on install which includes a file to run from within the module, but then when it's run and tries to read the importer csv file it cannot, since it's in the admin, I guess... Is it possible to set the template page to a file in the module directory? Will that work? 1 Link to comment Share on other sites More sharing options...
hellomoto Posted August 26, 2017 Author Share Posted August 26, 2017 I have this happening in the template file: if(file_exists($filepath)) echo $filepath; echo "<a href='$filepath'>csv</a>"; $file = fopen($filepath, 'r'); print_r(fgetcsv($file, 0, ',', '"')); fclose($file); where $filepath = $this->source->url (in a class method). So it's the page's attached CSV file's URL. The link works and downloads the file, which supposedly doesn't exist, according to the preceding line. Why?? Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 26, 2017 Share Posted August 26, 2017 On 19.8.2017 at 7:31 PM, hellomoto said: Is it possible to set the template page to a file in the module directory? There's $template->altFilename which I think is relative to the templates folder. Link to comment Share on other sites More sharing options...
hellomoto Posted August 26, 2017 Author Share Posted August 26, 2017 I tried using that with ../'s in the value to grab from the module's directory to no avail. Here is the module in progress: The file in question is import/csv.class.php. I appreciate any and all feedback regarding the makeup of this module. Link to comment Share on other sites More sharing options...
gmclelland Posted August 28, 2017 Share Posted August 28, 2017 I like the direction you are going with that module. It looks like it could be really useful. Link to comment Share on other sites More sharing options...
hellomoto Posted September 3, 2017 Author Share Posted September 3, 2017 Idk 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now