getgrav / grav-plugin-file-content Goto Github PK
View Code? Open in Web Editor NEWGrav File Content Plugin
Home Page: https://getgrav.org
License: MIT License
Grav File Content Plugin
Home Page: https://getgrav.org
License: MIT License
Hi Devs,
As I understand, this plugin only allows importing file content into twigs?
Would it be possible somehow to import file content into markdown files under user/pages/
?
Something like modular files, I suppose ...
My specific requirement is for the Learn2 theme for documentation. I have some rather long and frequently changing API definitions. It would be great keep the skeleton of the documentation intact and import the modified files when updated.
Thanks.
Hello,
As we assume that pages are located in the folder /user/pages/
we could simply the syntax by adding few lines in the filecontent() function in FileContentTwigExtension.php
so we could get
{{ filecontent('/myincludes/myfile.txt') }}
instead of
{{ filecontent('/user/pages/myincludes/myfile.txt'') }}
just a suggestion, and very easy to implement?
thanks
senso+++++
public function filecontent($path)
...
if ($config['allow_in_grav'] && file_exists(GRAV_ROOT . $path))
{
return file_get_contents(GRAV_ROOT . $path);
}
elseif ($config['allow_in_filesystem'] && file_exists($path))
{
return file_get_contents($path);
}
// added by senso
elseif (file_exists(GRAV_ROOT.'/user/pages'. $path))
{
return file_get_contents(GRAV_ROOT.'/user/pages'. $path);
}
// end senso suggestion
```
Presume this plugin may just have a simple glitch .. but attempted to use it and not been able to load .txt , let alone a .html
Could someone possibly have a quick glance.. and maybe retire it , if its not really acceptable to use it / better ways.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.