ethanbeyer

Members
  • Content count

    70
  • Joined

  • Last visited

Community Reputation

44 Excellent

About ethanbeyer

  • Rank
    Full Member

Recent Profile Visitors

357 profile views
  1. Interesting... I've been saying for a while that I'd love to help the docs get better. As they are now, I think they're pretty good - but things could always improve, and if there is one thing in development I am uber-passionate about, it's documentation!!
  2. Today I noticed the Fieldgroups class is missing from the reference, and I wasn't sure why! Does anyone know? Also, I feel like the docs would be easier to parse/navigate if the API Variables were shown alongside the class they were an instance of. Config ($config) Field Fields ($fields) Fieldgroup Fieldgroups ($fieldgroups) Fieldtype HookEvent Inputfield InputfieldWrapper MarkupPagerNav Module Modules ($modules) ... Page ($page) Pages ($pages) ... I'm also aware of the API Gen reference page (https://processwire.com/apigen/index.html), which is more robust, but a little harder to parse.
  3. I know this is old, but I think your error might be because you're trying to attach $content to the current instance of ProcessWire. I think it might work if you did this: return $content->wire('pages')->find("parent=/"); Since $content is a new instance of ProcessWire, you should be able to do things like this: $contentModules = $content->wire('modules'); $contentForms = $contentModules->get('FormBuilder');
  4. Had to report back and say that in a multi-site environment, where all the sites are using the same ProcessWire core, it is possible to "share" modules by the method listed above, with no need for symlinks! $config->paths->siteModules = $config->paths->root . 'shared/modules/'; $config->urls->siteModules = $config->urls->root . 'shared/modules/';
  5. You're right. require_once("creds.php"); // this works require_once("./creds.php"); // this doesn't No idea why.
  6. To me, saving database credentials to a Git repository, even if that repo is private, is a big no-no. So I've been tinkering with different ways to deploy sites to production environments without saving the database credentials to the repo. I know that there is a the config-dev.php option. But that hasn't worked for me, as I will explain later. I added this to my config.php: $config->env = "dev"; if($config->env == "dev") { $config->dbHost = 'localhost'; $config->dbName = 'processwire'; $config->dbUser = 'root'; $config->dbPass = 'root'; $config->dbPort = '3306'; } else { require("./{$config->env}.config.php"); } So if $config->env = "production", production.config.php should be loaded: $config->dbHost = 'localhost'; $config->dbName = 'processwire-production'; $config->dbUser = 'username'; $config->dbPass = 'productionPassWord'; $config->dbPort = '3306'; I can't see anything wrong with the syntax of this at all - but for some reason, if that file is added with require() or require_once(), ProcessWire never loads. If it's loaded with include(), I get an error about the page not being found, and there being no install.php present. So it seems like for some reason, there is no way to include a file in config.php, which confuses me immensely. How my brain works I'll try to explain my thought process behind this a little more. I think it's a good idea for dev environments (especially those that come with a Vagrant box and a defined database already installed) to include dev-level database creds. It should just work. If someone works on this site after me, they shouldn't have to spend a ton of time getting a config file set up. Secondly, having a config.php file and a config-dev.php file frustrates me because for the developer that comes after me, they could really use the config-dev file! But if it's in the repo, it gets deployed. If it gets deployed, it gets called on the staging/production server, and that is no good! Also, config.php and config-dev.php would in most cases pretty much completely mirror one another with the exception of database creds, and maybe debug or a few other things. That is why I want to have all the configs in the repo within config.php except for the tiny bits that are environment-specific. They should be able to be included, right?
  7. I have a question about Multiple Site implementation, and how to possible "share" modules between them. First, required reading: https://processwire.com/api/modules/multi-site-support/ I'm dealing with Option #1. The way this works is that in the root directory of a site, there is an index.config.php file that denotes what domain is mapped to which site-*/ directory. The project I am working on has three site-*/ directories, each with their own site-*/modules/ directory. What has happened is that a lot of the modules from site to site are the same. I was wondering if there was any way to "share" modules between sites in the Multiple Site setup, via symlink or alias, or potentially if there was some roadmapped feature that @ryan has planned to solve this issue. Either way, any help/pointers would be appreciated!
  8. Thanks for the help, @Robin S and @LostKobrakai! You guys rock.
  9. Oh my gosh - have I been reading these docs wrong all this time? http://processwire.com/api/ref/pagefiles/ hahahahaha I thought $page->files was an attribute that got set at some point and was a Pagefiles array of all files added to that page... Well that definitely solves one thing!! Thank you, @Robin S! I'm still very confused why some of the fields don't show up as a part of the $page->data array, though.
  10. @tpr I am not sure I know what you mean, but I changed the code within Tracy Debugger to $fg = $this->wire('fieldgroups')->get('document'); $t = $this->wire('templates')->get('document'); $example = $this->wire('pages')->get(1624); dump($fg, $t->fields, $example->fields, $example->files, $example->document_Files, $example->data); ...and all the dumps were the same as when the Page variable was named $page.
  11. This is a strange error I am totally unsure how to fix! It started when I was trying to get a file from $page->files. I know that there is a file in a field called document_Files. But $page->files returns null. So I popped into Tracy Debugger and wrote this code: $fg = $this->wire('fieldgroups')->get('document'); $t = $this->wire('templates')->get('document'); $page = $this->wire('pages')->get(1624); dump($fg, $t->fields, $page->fields, $page->files, $page->document_Files, $page->data); Resulting in 6 Dumps: $fg, $t->fields, $page->fields all result in the same object, which is to be expected. (fieldgroup): Fieldgroup {#173 +"count": 4 +"items": array:4 [ 1 => "title" 199 => "document_customizableCheckbox" 197 => "document_Files" 200 => "document_thumbnails" ] } But then it gets strange with $page->files null ...and $page->document_Files. Pagefile {#267 +"changes": array:1 [ 0 => "formatted" ] +data: array:6 [ "basename" => "example.pdf" "description" => "" "tags" => "" "formatted" => true "modified" => 1497976118 "created" => 1497976118 ] } I would expect those two to match. But obviously they don't. But then it gets weirder, still! $page->data should have four elements in the array - one for each field in the Fieldgroup - but two don't show up: array:2 [ "title" => "Introduction" "document_Files" => Pagefiles {#264 +"count": 1 +"items": array:1 [ "payroll_vault_brochure_markbeaton_2016_12_01p.pdf" => "payroll_vault_brochure_markbeaton_2016_12_01p.pdf" ] } ] Also, in the $page->data array, document_Files (the field) outputs as a Pagefiles class, whereas getting the field directly only returns a Pagefile. I don't even know where to start! Has anyone else had something like this happen? I have looked at the database starting with the template. I can confirm it has the correct fieldgroup_id, and that fieldgroup has all the correct fields. The page in question also is the correct template.
  12. I've built a couple PW sites now, and often I break my directories up like this: assets files cache logs sessions active.php index.php installed.php backups fonts js modules scss templates vendor But I kind of wish, in that schema, that I could change it to something like this: modules resources fonts js images scss storage backups cache files logs sessions active.php index.php installed.php templates vendor My reasoning is that JS/CSS/Theme Images/Fonts are site assets (or "resources"), while the caches/files/logs/sessions are more storage. And that is fine to set up manually - but in looking over the config.php file, I can't find a place where I can set that so that ProcessWire will respect it. Every part of this CMS is flexible, so I do assume there is a way to do this - I just don't know what it is. Has anyone else done something like this?
  13. If it's shared hosting and all of the sites on your IP are potentially sending emails, that is almost certainly your problem. Again, I'd look into an email delivery service like Sendgrid, Mandrill or even TurboSMTP - these will help with deliverability, and you won't be competing with other sites on the same IP to get emails out.
  14. Check this out: http://docs.mailpoet.com/article/49-lists-of-hosts-and-their-sending-limits For OVH: Most likely because of bounces, your site is unable to send emails. A couple of things you can do: 1. Contact OVH and ask them to give you some idea of what your email's standing is. 2. Use a service like Sendgrid (sendgrid.com) as an off-site SMTP delivery service. If I remember correctly, Sendgrid is free up to 12,000 emails a day. Hope this helps!
  15. Often times when things like this happen it's because you've gone over your limit for emails to send through a particular SMTP host. Who are you trying to send through?