Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/23/2019 in all areas

  1. I recently mentioned that I was working (more like messing about quickly :-)) on a Visualisation module based on the awesome chart lib Vega. I haven't touched this module in a while. I only realised today as I was transferring my dev setup to WampServer and testing things out that I'd left this off at a stage where one could view a basic Viz. See the screenshots below. Word of warning: this does not even qualify as pre-alpha in my opinion. It is very early days. It is more of a playground to test ideas. It's also not high in my list of priorities so I don't know when it will be ready... Screenshots Create new viz from list of pre-built visualisations/charts Editing a single visualisation/chart
    6 points
  2. A recent GitHub request got me thinking about ways to get an overview of which fields are using which Textformatter modules. Here are a couple of approaches... 1. For all Textformatter modules that are in use, show the fields they are applied to Execute the following code in the Tracy Debugger console: // Loop over fields and get their Textformatters $textformatters = array(); foreach($fields as $field) { if(empty($field->textformatters)) continue; foreach($field->textformatters as $textformatter) { $textformatters[$textformatter][] = $field->name; } } d($textformatters); Any Textformatter modules that are not included in the dump output are not applied to any fields. 2. In the config screen for a Textformatter module, show the fields where the module is applied Add the following to /site/ready.php $wire->addHookBefore('ProcessModule::executeEdit', function(HookEvent $event) { // Get the module name $module_name = $this->wire('input')->get->name('name'); // Return if it's not a Textformatter module if(strpos($module_name, 'Textformatter') !== 0) return; // Add field to module edit form $event->wire()->addHookBefore('InputfieldForm(id=ModuleEditForm)::render', function(HookEvent $event) use ($module_name) { $value = ''; // Find any fields using this Textformatter and build markup value foreach($this->wire('fields') as $field) { if(empty($field->textformatters)) continue; foreach($field->textformatters as $textformatter) { if($textformatter === $module_name) { $value .= "<a href='{$this->wire('config')->urls->admin}setup/field/edit?id={$field->id}#fieldtypeConfig' target='_blank'>$field->name</a><br>"; } } } if(!$value) $value = 'No fields are using this Textformatter module'; // Add markup field to form $form = $event->object; $f = $this->wire('modules')->InputfieldMarkup; $f->label = 'Fields using this Textformatter module'; $f->value = $value; $form->insertAfter($f, $form->children->get('id=ModuleInfo')); }); });
    5 points
  3. You could instead try to define the default to match one of your image variations you are actually going to use in your srcset with $config->adminThumbOptions: https://github.com/processwire/processwire/blob/master/wire/config.php#L633
    3 points
  4. Success!!! And no, not with Laragon. Laragon I tried all tricks and trips, I shut down antivirus prog, etc, nothing. It was still slow for me and MySQL 5.1 only Devilbox Once I set up SSL, that was the end of being able to log in. For some reason, the TOKEN set on the login page was always different from the one stored server-side that sessionCSRF compared with. Maybe a PHP thing? And so, it was back to Google. I almost bought Mamp Pro but decided to check on an old friend, WAMP, now WampServer. WampServer Wow! A lot has changed since I last used WAMP! It looks sleek and packs a mean punch. It has lots of settings hidden away neatly in its menus. You can change PHP ini settings (stuff like memory, etc) right from within the menu. One is not restricted to one www folder. Each project can have its own folder anywhere on your system. The mysql/data directory can also point to whatever location you want (I know one can do this in Laragon as well). Installing ProcessWire was a breeze as usual. Back- and frontend page load speeds? Using the Blank Profile: 130 - 200ms!!! I haven't tried SSL yet and I am not in a hurry to do this Thanks all!
    3 points
  5. if you have $config->advanced = true in your site/config.php file, then you'll see some addtl. fields in template > advanced: Although I would also be careful with that.
    2 points
  6. You may rename the Save and Publish buttons... ? The first "save" only creates the page in page tree and assigns the template to it. You can not actually enter any content upon page creation, so keeping the page unpublished seems very reasonable to me. Maybe the Save button could be named "Create" to better reflect what happens. At this moment the page really should not be published automatically, since it may contain required fields, where your template code rely on. With the template assigned, you'll have fields to enter content and see the Publish button. After entering the data you press "Publish", which effectively is "Save+Publish" in this case. I don't see an extra step to publish a page after entering its content, since this already is the default. Only in case the selected template does not have additional fields you'll see additional Save+Publish buttons. Are we talking about this situation?
    2 points
  7. If you're not harnessing the backend from ProcessWire I'd personally tend to not use ProcessWire. While it's entirely possible to do so (maybe also search for prev. discussions on the topic) there are some parts, which in my opinion discourage that kind of usage: Lack of proper testing capabilities. There are topics on how to do TDD with processwire, but the options on managing db state or handling requests in tests are not there. If you need to manage a lot of diverse data the autoloading of every template/field on each request can become a bottleneck. Working around it by reusing more fields/templates can work, but isn't great either. The selector engine for pages is great for light to medium complex stuff, but complex selections and especially aggregations need custom SQL or third party solutions like RockFinder. Also if you're not careful it's tempting to fall into n+1 query problems with fields / relationships being lazy loaded by default. Transactions are hardly used by the core, so if you want/need to prevent partial updates from happening you need to ensure that on your own by wrapping stuff into transactions. Not to say ProcessWire isn't otherwise a nice system, but those are the things I'd urge anyone to evaluate before using ProcessWire in a web application project.
    2 points
  8. https://github.com/TomS-/processwire-fieldtype-assisted-url This will work like you want, it will let you select a page or use an external link.
    2 points
  9. A huge shout out thank you to all the PW developers who have, and continue to help me.
    1 point
  10. For not so complex ajaxified pages this is what I do. Something like: <?php if ($config->ajax) { echo wireRenderFile("./rendered-ajax-call-result.php", array('page' => $page)); return $this->halt(); } Page is the only variable passed to the template partial and if something else is needed I make sure it is already part of page so that I can access it in the partial. The halt method is the recommended way so that ProcessWire can tidy up before exiting the process.
    1 point
  11. Thank you heaps! Excellent idea! Also thank you for having mercy with a ProcessWire newcomer. ? If I add $config->adminThumbOptions = array( 'width' => 180, // max width of admin thumbnail or 0 for proportional to height (@deprecated, for legacy use) 'height' => 0, // max height of admin thumbnail or 0 for proportional to width ); to config.php and upload a new image to the page I get a variation of a) filename then a DOT and then 260x0 then a DOT and the file format. e.g. image-waterfall.260x0.jpg b) the variation of the image itself being 260px wide and a proportional height value. So regardless of what I put into $config->adminThumbOptions the 0x260 default variation is being created. I am now wondering if that has to do with the 'gridSize' => 130, // Squared grid size for images (replaces the 'width' and 'height' settings) setting? If so, what is the squared grid size for images? Do I need to calculate the square root of the value I want, that cannot be, as then how would I specify what value I want for width for example. Confused but willing to learn this, hehe. edit: I changed values for gridSize and that would make default variations of double the height of the value for gridSize with a proportional width. So if I have gridSize 200 then I would get a variation of 0x400 in the filename and a file of 400 px height with a proportional width. So this gridSize setting is kind of beyond my understanding. What does gridSize do?
    1 point
  12. Also check https://github.com/processwire/processwire-requests/issues/106#issuecomment-429644472
    1 point
  13. PW needs some thumbnail to show image previews in the admin, so I don't think there's a setting somewhere to avoid creating the default thumb. You could use file fields instead, but you would miss on all the image-specific API functions... see also:
    1 point
  14. Putting this in your ready.php or admin.php should do it. You may want to add additional checks for admin only (not via API). $this->addHookAfter('Pages::added', function($event) { $p = $event->arguments[0]; $p->removeStatus('unpublished'); $p->save(); }); But, @Autofahrn has some excellent points about publishing a page which doesn't have any content other than the title, so use this with caution!
    1 point
  15. Just install the "regular" PW site profile, it has various blog features (comments, categories, pagination etc.) built-in. https://processwire.com/blog/posts/introducing-a-new-processwire-site-profile/ There's also an (older) blog profile you could try: https://modules.processwire.com/modules/process-blog/
    1 point
  16. @Robin S - would you be willing to add support for User pages (ProcessUser) as well please?
    1 point
  17. Although I only do website coding as a hobby, I've always used wampserver. By far it's the easiest to set up and use in my opinion ?
    1 point
  18. @nbcommunication - just wanted to say a big thanks for this new version - what are your plans to get this into the modules directory?
    1 point
  19. So far I found that using if(!$config->ajax): in my _main.php around head and foot parts and having a div targetted by Javascript as is commonly used - but in the case of an Ajax call I use wireRenderFile() to load markup from a file containing just the markup I need seems to work.... but I'm still playing with this. Paul
    1 point
  20. Hi @felix, I don't want to enable plain text files with server & password settings, but going with the already needed and available site/config.php, as @adrian suggested, seems to be fine. (As it already stores the DB-credentials). I try to look into it and implement it this weekend. I think this can be useful for a lot of us.
    1 point
  21. The padding around quoted text is a bit much, as can be seen in the quote immediately above. Seems to be coming from Uikit styles, which I guess are being included in their entirety just for the header. Could we strip it back a bit so only the needed styles are included? Or iframe the header part to avoid the styling conflicts? Another issue I've noticed since the upgrade: in iOS Safari (older versions) links are triggered on release of long touch (to open the context menu). This makes it difficult to open links in a new tab - you have to slide your finger away from the link before you release in order to select an item in the context menu, or else you navigate away within the current tab. This only applies to Safari and only on older Safari/iOS versions so perhaps it doesn't affect too many people. It's a pretty big annoyance to me though because you cannot select an alternative default browser on iOS (thanks Apple) and I don't want to have to buy a new iPad.
    1 point
  22. Just in case it's helpful, this is what I do for Tracy - anything that is defined in the $config->tracy() array overwrites the settings stored in the DB. https://github.com/adrianbj/TracyDebugger/blob/3f1fb2cf0016b8b27cc1019f47e58bce8e2cbd3d/TracyDebugger.module.php#L322-L325
    1 point
  23. Hi Horst, would it be possible to implement a feature that overwrites the configuration variables (server, password...) from a config or .env File? We've got several sites that do auto-deployments to different servers based on the git branch that is used. Currently, when deploying the local development version to a staging system we're copying the dev database and need to adjust the settings by "hand" (we've written a script for that). Having a file based configuration would make it possible to just dump a file on the server and save the config variables in it.
    1 point
  24. Probably the easiest way to add existing images and variations to PW pages would be via the API – take a look at the PageImage class docs: <?php namespace ProcessWire; // Bootstrap ProcessWire: https://processwire.com/docs/front-end/include/ include './index.php'; $results = $pages->find('id=1'); // Your page query $myImage = '/myImage.jpg'; // The image foreach ($results as $result) { // Add initial image $result->of(false); $result->imageField->add($myImage); $result->save(); // Retrieve added image, add description $lastImage = $result->imageField->last(); $lastImage->description = "My description"; // Create variation of last image $variation = $lastImage->size(500, 500); $result->imageField->add($variation); // Add additional variations here, and format conversion $result->save(); } You'll need to augment this code to accommodate an existing list of images, or multiple images per page, to match against the PW pages. WebP (or any image format conversions, it seems) are not natively supported by PW, but it looks like some folks have figured out some solutions (inline, and more integrated) :
    1 point
  25. You are posting in the wrong section. We have a sub-forum just for that here https://processwire.com/talk/forum/22-jobs/ Make sure you follow the guidelines and good luck.
    1 point
  26. OK, due to the popular demand towards this feature it's been added to v2.0.14 ? Some changes: the new suffix contains the field type (eg. "Textarea"), and the inputfield class if it's different from it (eg. "CKEditor") the optional inputfieldClass is not added if it's the language variant (to avoid situations like "excerpt - TextareaLanguage (Textarea)" on the right side of the bars the original field type string is removed (before the percentage) not to display it twice
    1 point
  27. Hello, We've been using Mailgun for several years now on ProcessWire developments, using a cURL implementation within a custom site development module/template site. I'm currently rewriting that and trying to use much more of the PW API as there's been a lot of handy things added in the past while. Part of that process is to use WireMailMailgun, so I installed @Macrura's fork and then began to see what could be improved/finished off from the todos. What I've ended up doing is a partial rewrite of the module: to use more ProcessWire conventions and the coding style guide implemented a few extra features removed what I though was unnecessary code. It requires 3.0.123 and above, as it uses the htmlToText() method from WireMail, which in turn uses WireTextTools. The module is here: https://github.com/chriswthomson/WireMailMailgun Please let me know your thoughts! Cheers, Chris
    1 point
×
×
  • Create New...