-
Posts
377 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Craig
-
The website for one of the prominent four-letter political parties in Northern Ireland has been powered by ProcessWire for almost two years now. It currently has about 15,000 pages, and serves in excess of 130,000 requests per day running on typical cloud hosting and minimal PW and CloudFlare caching. Not too bad I don't think (on several levels), but nowhere near some of the bigger sites powered by PW by far (going solely from the Showcase area of this forum). Without giving too much away, it's still happily and securely running the PW version that was installed during its development two years ago. There's also been zero maintenance issues to deal with since launch, a lot of which I believe is down to PW itself.
-
Hi naldrocks98, have you added a valid API key into the settings page of the module? The error and line number suggest that the Mandrill API library hasn't been initialised.
-
Once the theme has been installed, you can drop this line into your site/config.php file: $config->defaultAdminTheme = 'AdminThemeReno';
-
How to import table of data into ProcessWire
Craig replied to Tony Carnell's topic in General Support
When I'm importing data, I usually add a ProcessWire field called legacy_id. Any import script will set this value to the actual ID from the item in the old dataset. It helps the script easily and accurately find existing imported items, and you can keep this around for a little while after so you can trace it back if you need to. -
Hi! You mention that you set the config values to the IDs of existing templates for teachers and students. I think this is where the problem is - if your user templates don't have the necessary fields that the default users do, then that could be an issue. The instructions recommend cloning the user template to start these off, presumably so that your custom users have everything they need before you start customising. What I would try first, is to edit your teacher and student templates and import the fields used on the user template - this should pull in password, email and roles (I think). If that doesn't work, I would rename your existing teacher and member templates to something else (to use as a reference), follow the instructions exactly, and see if that works. If it does, go ahead and configure them the same as the ones you renamed - import fields, change access/family properties etc.
-
How to import table of data into ProcessWire
Craig replied to Tony Carnell's topic in General Support
Hi Tony! Welcome to the forum I think one of the fundamental things to consider with projects like these, is to actually look and analyse the existing data - the structure, the format, the quality, and any relationships there may be. It's almost going through the normalisation process but perhaps not as strict. It would be a good idea to take every column in the existing database to decide how that will be represented in the ProcessWire site. Probably, some of these will be simple translations - Varchars will become Text fields, and Ints will still be Integer fields. But what will be more important is the data in these fields - does it vary with just about every single dam? Is it a value representing Yes/No? Are there only a few values for that column that all dams can potentially use? If so, do the values all use the same spelling of words, or are some mixed case or have weird formatting or spacing issues? When you have a set list of values to choose from, this is where you can decide how to store the data in ProcessWire - Page fields, PageTables, Options field, etc. If your source data quality is good, your job will be easier. If it's not, there will be some work involved in preparing it so that it is clean to work with. You may already have a good idea of how your data looks or is structured, but I usually like to do some form of planning on paper or using a spreadsheet to map out the source data to the ProcessWire templates and fields. Doing the important work now will save you hassle later on down the line and will really help you to make the search feature more functional. As an example: In ProcessWire, I imagine there would be a template created called 'dam'. You might add the following fields to this template (just for starters): title description location (FieldtypeMapMarker) height (integer/float) length (integer/float) capacity/volume (integer/float) country (Page field/Options field?) built (date) opened (date) For each dam, a Page would exist somewhere in the page tree, using the 'dam' template. As you've already seen the Skyscraper profile, you can probably look at that for more ideas on how to structure things though -
Hi kazu! Like with most thing ProcessWire, there are a couple of approaches to this. One thing I do often is to make a content block template, so they can be stored and edited in the CMS. Use the ProcessWire roles to restrict access if you need to. I then use a little helper function to call these, like so: function getContentBlock($param = '') { if (strpos($param, '/') === FALSE) { // $block is name $param = wire('sanitizer')->selectorValue($param); $block = wire('pages')->get("template=content-block, name=$param"); } else { $param = str_replace("//", "/", "/{$param}/"); $block = wire('pages')->get("/settings/content-blocks{$param}"); } if ($block->id) { return $block->body; } } As long as that function is included, I can do echo getContentBlock('/contact/address/'); // using path to page echo getContentBlock('opening-times'); // using page name If static files are more suitable, then you can do something more like this: echo wireRenderFile('blocks/opening-times'); Where the path to that file is site/templates/blocks/opening-times.php.
-
Fantastic! Excellent finish all round, and thanks for highlighting a few of the PW methods used
-
Hi, WireMailMandrill author here! Sorry about that - I'll have a look at this to try and find the problem
-
If all you need is some SCSS/LESS (or JS) processing, there are some helpful GUI tools that take the command line and dependency management hassle away - Prepos as mentioned above, or my favourite, Koala. They can watch your files for changes for you, so no running commands every time you change project or change a single line in one file.
-
I think you should be asking, why do you want to use Gulp or Grunt? What are you doing (or want to do) in your projects that needs those tools or that workflow? If you don't need them, don't use them
-
Not a tutorial exactly - but you could perhaps look at the blog profile to see how certain things are achieved?
-
Thanks for bringing this up! I'll have a look at this shortly If you have changed it to singular: false in your own copy, does that change alone fix the problem you had?
-
This looks to be supported by WireMail itself, so it should work with WireMailMandrill. Using the example above, try adding this line: $mail->header('Reply-To', 'sender@example.com'); I haven't tested it but please give it a go
-
Very, very nice! And thanks for talking through your approach to some interesting points
-
Is there a specific reason you want this to be managed using a button on the field itself? If I was doing this, I'd look at creating a module that just added a hook method (like 'generateSprite()' or something), to the Pageimage class, maybe, which exposes a function to return the generated sprite image URL and CSS content for a given images field. There would be a cache table behind this which saves the generated status and metadata/CSS to prevent processing the images on every request (this would have to be invalidated whenever the images changed). Using this method, there is complete freedom to do all of this from the API. You can still have a configuration page, but the downside of this is that it would be less customisable per field instance in the templates. For example: $sprite = $page->images->generateSprite(); $sprite could be an array of generated CSS and/or path to the image for you to use in the template/code however you like. I think the main consideration in approaching this, is how (and why) you want the sprites to be made.
- 4 replies
-
- 1
-
- fieldtype
- inputfield
-
(and 2 more)
Tagged with:
-
Hi That's an interesting point! I haven't used that feature before but definitely can see how it's worth doing. In other systems my company has developed, we often keep a log of all messages sent purely for auditing and recording purposes, so there is merit in keeping those purely for that - but if that can also help with things like tracking stuff that's great. The WireMail ___send function is hookable - perhaps another module could be created which just hooks into this and logs all messages, either in its own custom table or as a page.
-
CKEditor will not read mystyles.js from site dir, only from wire
Craig replied to ndolph's topic in General Support
Easily done! -
Want to use Mandrill for sending emails using their HTTP API rather than SMTP? Read on! I've been working on a WireMailMandrill module for a site I'm currently adding some features to. So far, the module has been tested for simple mail sending, with basic options, and attachments. I haven't tested the full range of things that are possible with the official Mandrill PHP library, but I think I've implemented the ability to set most, if not all, of them. This should be considered beta and not entirely relied upon for sites in production. Testing and feedback welcome. I'm sorry about the lack of code comments at the moment as well, I was just throwing this together as I went along so I could move onto the next part of what I was building... This was originally mentioned in a discussion about SendGrid and Mandrill options in a thread in the Form Builder support area. Not everyone has access to that, which is why I'm putting this here WireMailMandrill on GitHub Quick example (taken directly from a site I'm working on): $mail = wireMail(); $mail->from('info@example.com', 'ExampleCOM Enterprises'); $mail->to($toMail, $toName); $mail->subject('Entry confirmation'); $mail->bodyHTML($bodyHTML); $mail->attachment($myPage->files->first()->filename); $count = $mail->send();
- 17 replies
-
- 13
-
CKEditor will not read mystyles.js from site dir, only from wire
Craig replied to ndolph's topic in General Support
I have this working as expected on a site I'm currently building, on 2.5.28 dev. Have you followed each step from the instructions? -
horst, have you done a full/hard/forced refresh on the admin? I've had some odd behaviour in the past, which has just turned out to be cached module javascript files.
-
It does use the wireMail() function call
-
Alternative to creating pages for temporary data storage
Craig replied to Vineet Sawant's topic in Getting Started
I'd perhaps use WireCache for something like this, depending on how you need to retrieve these items later on. The most obvious method would be to key it by the user who will receive the notifications - so you would create a simple array structure with the important information for the notifications, and store it using a cache name like "notifications-1142" for user ID 1142. This should make it quick to retrieve. You can then pull this out, show it, update it by modifying the notifications array, and putting it back in the cache. Other than that - a simple module as an interface to a custom simple database table would be more than suitable.