Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Include NotePaper Config #7

Closed
mayamcdougall opened this issue Feb 26, 2016 · 7 comments
Closed

PHP Include NotePaper Config #7

mayamcdougall opened this issue Feb 26, 2016 · 7 comments

Comments

@mayamcdougall
Copy link
Owner

So, NotePaper has a lot of configuration options. They're in an array to make it easier to reference them in Twig, and also to make them a little neater. In preview versions, the sample config was part of the readme. In 1.5, it's going to be a separate sample file.

When writing the readme, I felt it sounded really messy to say "Copy the config snippet from the sample file and paste it into your Pico config".

So then I had an idea: Why not use PHP's include to import a second config file, keeping all the NotePaper stuff separate? Instead of copying a large array of options, you could simply add something like this to your Pico Config:

include 'NotePaper-Config.php';

@PhrozenByte Would this be acceptable / in line with your idea* of how Pico should work? (*couldn't think of a better way to phrase that). If so, are there any downsides or catches I should be aware of? Thanks in advance. 😉

@mayamcdougall
Copy link
Owner Author

Pico's sample config is 58 lines...
NotePaper's is 98 lines! 😆

@PhrozenByte
Copy link

No specific plans for that at the moment, but maybe we'll replace the config.php in a future release with a config.ini or config.yml. A more generic/better solution for Pico's core may be to include all files in the config/ directory with a specific file extension (i.e. Pico loads a config/NotePaper.config.php automatically). Do you want to create a new Issue for that?

@mayamcdougall
Copy link
Owner Author

Well, I'm glad you like the idea, but I actually meant just for NotePaper. I just wanted to check if it was okay to use something like include 'NotePaper-Config.php'; for my upcoming release or if you saw / knew of any problem with that. It should be fine then?

If it's something you'd like to create an issue about, I'll do that. One thing to keep in mind though, users may keep a backup of config-sample.php in their config folder and you wouldn't want to load that accidentally. (It could be renamed something like config.sample though).

Also, if something like this were implemented, plugins could also have their own config files, since they often seem to have some variables that need adding. This could be handy for upgrading individual components as well, since you wouldn't need to touch your Pico config if you're only updating a plugin or theme.

Also, perhaps a more user-friendly scheme like you suggested... as long as I can still make arrays. config.NotePaper.feature.option is very easy to remember when coding. 😉

I'll make a Pico issue of it sometime tomorrow when I can write something more coherent (it's late for me). On a side note, I just realized your timezone is 6 hours ahead of mine. I knew there was a difference, but I'd never thought about how big it was. Definitely explains why I only see you on here at certain times of day. 😅

Just a final check though. You have no problems with me suggesting include 'NotePaper-Config.php'; in my readme? 👍 ❓

@PhrozenByte
Copy link

Well, I'm glad you like the idea, but I actually meant just for NotePaper.

Sure, I had understood that 😉 That's why feedback is so important. Feedback stimulates a discussion and brings up new ideas (even for completely different things) and alternative solutions 😃

I just realized your timezone is 6 hours ahead of mine

Yeah. 😄 In practice the difference usually is no big problem, I often work very late at night, so it's evening for you.

Just a final check though. You have no problems with me suggesting include 'NotePaper-Config.php'; in my readme?

In the meantime that's just fine, yes 👍

@mayamcdougall
Copy link
Owner Author

Yeah, but it could be confusing when I say "tomorrow" but you're already at 4am. 😆 Thanks for clarifying that. I think I'm going to put both the "includes" and the "copy and paste" method in the readme and leave it up to the user.

I'll write up the Modular Config idea as an Issue in a little bit.

@mayamcdougall
Copy link
Owner Author

Okay, I created picocms/Pico#330. 👍

@PhrozenByte
Copy link

Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants