All Activity

This stream auto-updates     

  1. Past hour
  2. Yes !! I guess I managed to pick it up my self around 70% but got stuck with the partials, helpers and bags . Downloaded your zip ghost-master and had a look in your templates folder. Especially your _init and _main.php finally made it all clear now. Thanks
  3. Seems to be working fine now. Thanks
  4. I am currently cloning core text language field into float field as I want to use the multi-language function as a multinational solution. I am using the float field as price field, since the price is different for different country(language). Below is my trial, unfortunately a failed one. Any value will be saved as zero or null in database. I would like some advises on this. Thanks. <?php namespace ProcessWire; require_once(wire('config')->paths->root . 'wire/modules/LanguageSupport/FieldtypeLanguageInterface.php'); /** * Multi-language capable float field * * ProcessWire 3.x, Copyright 2016 by Ryan Cramer * https://processwire.com * * */ class FieldtypeFloatLanguage extends FieldtypeFloat implements FieldtypeLanguageInterface { public static function getModuleInfo() { return array( 'title' => 'Float (Multi-language)', 'version' => 0, 'summary' => 'Field that stores a floating point (decimal) number in multiple languages', 'permanent' => false, 'requires' => array('LanguageSupportFields'), ); } /** * Sanitize value for storage * * @param Page $page * @param Field $field * @param LanguagesValueInterface|float $value * @return LanguagesPageFieldValue * */ public function sanitizeValue(Page $page, Field $field, $value) { if(is_object($value) && $value instanceof LanguagesPageFieldValue) { // great, already what we wanted } else { // convert it to a LanguagesPageFieldValue $pageValue = $page->getUnformatted($field->name); if(!$pageValue instanceof LanguagesPageFieldValue) { $pageValue = new LanguagesPageFieldValue($page, $field, $pageValue); // #98 } if(is_array($value)) { $pageValue->importArray($value); } else { $pageValue->setLanguageValue($this->wire('user')->language->id, (float) $value); } $value = $pageValue; } return $value; } /** * Return the database schema in specified format * * @param Field $field * @return array * */ public function getDatabaseSchema(Field $field) { $schema = parent::getDatabaseSchema($field); $languageSupport = $this->wire('modules')->get('LanguageSupport'); $maxIndex = (int) $this->wire('database')->getMaxIndexLength(); // note that we use otherLanguagePageIDs rather than wire('languages') because // it's possible that this method may be called before the languages are known foreach($languageSupport->otherLanguagePageIDs as $languageID) { // $schema['data' . $languageID] = $schema['data']; $schema['data' . $languageID] = 'float'; $schema['keys']["data{$languageID}"] = "KEY `data{$languageID}` (`data{$languageID}`)"; } return $schema; } /** * Format value for output, basically typecasting to a float and sending to textformatters from FieldtypeFloat * * @param Page $page * @param Field $field * @param LanguagesValueInterface|float $value * @return float * */ public function formatValue(Page $page, Field $field, $value) { return parent::formatValue($page, $field, (float) $value); } /** * Given a value, return an portable version of it as array * * @param Page $page * @param Field $field * @param string|int|float|array|object|null $value * @param array $options Optional settings to shape the exported value, if needed. * @return string|float|int|array * */ public function ___exportValue(Page $page, Field $field, $value, array $options = array()) { if(isset($options['sleepValue'])) { // allow a sleepValue option, for use by other language Fieldtypes that delegate // their exportValue to this one, like FieldtypeTextareaLanguage $sleepValue = $options['sleepValue']; } else { $value = FieldtypeFloat::strToFloat((string) $value); $sleepValue = $this->sleepValue($page, $field, $value); } $exportValue = array(); foreach($sleepValue as $k => $v) { if($k === 'data') { $exportValue['default'] = $v; } else if(strpos($k, 'data') === 0) { $languageID = substr($k, 4); $language = $this->wire('languages')->get((int) $languageID); $exportValue[$language->name] = $v; } else { $exportValue[$k] = $v; } } return $exportValue; } public function ___importValue(Page $page, Field $field, $value, array $options = array()) { if(is_null($value)) $value = ''; if(is_float($value)) { $v = $value; $value = $field->type->exportValue($page, $field, $page->getUnformatted($field->name), $options); $value['default'] = $v; } if(!is_array($value)) { throw new WireException("Array value expected for multi-language importValue"); } /** @var Languages $languages */ $languages = $this->wire('languages'); /** @var LanguagesPageFieldValue $importValue */ $importValue = $page->get($field->name); foreach($value as $languageName => $languageValue) { $language = $languages->get($languageName); if(!$language->id) continue; $importValue->setLanguageValue($language->id, $languageValue); } return $importValue; } }
  5. Created an issue and pull request with a fix https://github.com/processwire/processwire/pull/91 https://github.com/processwire/processwire-issues/issues/385
  6. I wasn't sure about replying because you are giving wordpress a lot of attention here. But reading your a) and b) I have my 5 cts worth it: That's what I thought also years ago until I learned otherwise. Bumping into a client who wants it done in wordpress: trying to convince a client doesn't work. I spent no longer than 5 minutes opening the door to processwire, then I leave my card and move on. There are unlimited small offices and businesses out there who still don't have a website. Not true. Have a look at the api of processwire. Any experienced coder will pick up the api of processwire in no time. Processwire is decoupled so nothing to learn on the front. Just pick any framework or code your own css. And that is exactly what I tell my clients: If I am not around anymore all you have to do is to find an experienced coder and your website will go on. Heck, I bet an experienced coder will pick up the api of processwire faster than wordpress.
  7. Just for the record, in AOS you can easily add a WP-like page edit layout by adding enabling Add aos_column_break field to create admin columns tweak under Misc (and adding the aos_column_break field to your templates). The gutter between the columns is draggable.
  8. Nope. Will it help me convince new clients?
  9. Hmm. I am having the same issue. I did some debugging. It looks like the module is working as intended, and sending response to frontend with 'data-nosize' attribute set correctly. But in pwimage plugin for CKEditor, nosize setting isn't used at all. // pwimage/plugin.js function insertImage(src) { var $i = $iframe.contents(); var $img = jQuery("#selected_image", $i); // ... var $insertHTML = jQuery("<img />").attr('src', src).attr('alt', alt); // ... if (width > 0) $insertHTML.attr('width', width); // ... editor.insertHtml(html); // ... }
  10. Today
  11. have you tried lister pro?
  12. Hi Abdus, Actually I assumed that so, when testing, I removed the image from the page completely and added an all new one. Same result, the width attribute still keeps being added.
  13. It applies to images added after the setting is changed.
  14. Be warned, this is a bit of a ramble but interested to hear other points of view. It's not a 'I hate wordpress' post at all, we all know each project needs tools, and they are chosen depending on the project. https://www.cmscritic.com/processwire-vs-wordpress/ So, I've as looking at this old post yesterday and see a few of the regulars here getting involved I installed wordpress yesterday and have spent the best part of this morning getting to grips with some basic stuff. Anyway, I'm thumbing through the twentyseventeen theme and I can't help but be extremely confused by the whole thing. My mind is blown how overly complex it seems to display what is a big header image, with some posts under it and a sidebar. There's a 567 line functions file that does something or other. Is it a case of the theme has to support a zillion different things a user "might" do, when the processwire approach is to theme the site with exactly the requirements of a given project? Of course I don't have a lot of experience with custom themes in wordpress but I'm thinking it would take a good year or so (at least for me) to get proficient at this. Why am I doing this? Purely because (a) it's so popular and I can't avoid the possible work opportunities and (b) I have doubts that convincing people to use processwire is going to work. Mainly because I can't answer the question "who will take care of my site when you're gone". This is a legit question for a business owner and I feel this is also a big problem for a system that has a far lower userbase and (c) I'm love trying out different CMSs. i compared the UI side by side: What I liked about the above is that this is showing all 'Pages', and is listed as such. The above however also list 'Pages', because everything in processwire is a page. I think that 'Add new' should immediately popup on hover though like the way wordpress does. I can't much any point going to '/page/add/'. I also think 'Tree' should be removed entirely (when AOS module is used with 'Always show sidebar items'). The 'Page' link at the top goes to the same page and what does 'Tree' mean to a user? Off topic, but I find the Reno module awkward to use compared to the default admin theme. The accordian in the left menu requires a lot more clicking than the default theme hover/dropdown combo. However, Reno becomes a lot more useful with AOS and looks great. The actual editing process interested me as I remember wordpress being really easy to do this: This time though after using PW for a year is that there is too much distraction here. My eye wanders over to the right. The worst bit here is having to select a parent page every time you create a child page, that would pain me somewhat. I want to be able to select a parent and directly create a child (like Drupal or PW). I almost missed the 'Featured image' bit down there to the right (although it can be dragged up). Now this is nice. Very clear, a user will just move down the page, editing as they go. No need to worry about 'Parent' or 'Order' options (in WP). Another thing I notice as there doesn't seem to be any relationship to wordpress pages and posts. You can change the URL to posts to display on 'site.com/posts/my-post' but there is no 'posts' parent page. I find this quite confusing. Global categories can be set ( with a bunch of code https://stackoverflow.com/questions/16802751/multiple-custom-post-types-one-set-of-categories ) so your custom post types can use a single list of categories across the whole site. however, the categories are stored under 'Posts' in the admin bar to the left. So, in effect, they're global but don't LOOK global. Another +1 for my confusion. Custom fields (acf: repeater and repeater matrix, aka 'Flexible content field'... are only in pro version), custom post types (cpt), security (wordfence), user management (roles/permissions). I need plugins for all of those. There are plugins that do really simple stuff that cold be done in a few lines in PW. Although widgets look cool with the drag and drop, I'm not sure I'd actually want a client adding extra stuff all over the place on their site in sidebars etc. Setting image sizes, controlling image uploads are things I would expect in a CMS, not requiring extra functions to achieve. I mentioned earlier and this one is a killer for me, I hate this. I found a system that I'm productive with, it totally clicks with my brain, I can use any frameworks, any themes, make one from scratch, whatever, yet: (b) I have doubts that convincing people to use processwire is going to work. Mainly because I can't answer the question "who will take care of my site when you're gone". This is a legit question for a business owner and I feel this is also a big problem for a system that has a far lower userbase. So how do other people on the forum approach the above point? Currently looking at:
  15. Hi all, PW: 3.0.42 I'm trying to have responsive images in the body field. First I need to stop the image tag generated by CKEditor adding the width attribute to the image tag on insertion. I found the 'Skip width attributes on image tags?' in the settings of ProcessPageEditImage and that suggests it does exactly what I'm after. Sadly, even when this checkbox is checked and a new image is inserted the width attribute is still added. Am I missing something? TIA.
  16. So what happened @nickngqs I'm really interested in this. I need to find a way to convince people too.
  17. I just had to do this, as mentioned, it's here now:
  18. So I need a template and page to use template cache. I take a look at MarkupCache and WireCache. Thanks.
  19. @pwFoo MarkupCache only supports strings and uses files for storage. WireCache supports arrays (of non-objects), PageArray and strings and uses DB for storage. WireCache is the way to go.
  20. Thanks everyone for the help. I got a bit turned around and was struggling with digitalocean, when I should have been interacting with runcloud as my "dashboard". Ill let everyone know how my setup turns out once I get to it this morning.
  21. Should WireCache used instead of MarkupCache? Pro / cons to use MarkupCache?
  22. Gracias @abdus .. It Works .. Super Cool
  23. Template cache is bound to the template of the current page. When rendering a page, regardless of how many files you render or include, only the markup that is output to the browser will be cached into a file (can be found in /site/assets/cache/Page/<id>), so that the render routine can be skipped if request can be responded with the cached output. If you want to cache arbitrary bits of markup you can use WireCache class with $cache API variable, or use MarkupCache module. $layout = $cache->getFor($page, 'layout'); if (!$layout) { $layout = $files->render('layout.tpl', [ 'title' => $page->title, 'content' => $page->body ]); $cache->saveFor($page, 'layout', $layout, WireCache::expireDaily); } One thing to note is that template cache, by default, is disabled when you're logged in. https://processwire.com/api/ref/wire-cache/ https://processwire.com/talk/topic/7-new-markupcache-module/
  24. Hi, I use TemplateFile class to render custom files like _layout.tpl (base html layout file), but output I think output isn't cached. Because there is no template added to PW I can't configure template cache I think. How to activate template cache inside of php code temporarily or persistent (for example with a hidden / system template created)? Should be done with code (module install or inside a php file).
  25. You need to use $page argument. Also remember to check if field is actually the field you want. wire()->addHookAfter('InputfieldRepeater::renderRepeaterLabel', function (HookEvent $e) { /** @var Page $page */ $field = $e->object->hasField; // check the field if ($field != "events_detail_dates") return; $page = $e->arguments('page'); $e->return = date('D. j F Y', $page->events_detail_dates_start_date); });
  26. Thanks for the help. I did try this but it's returned as 1 January 1970. 'events_detail_dates' is the repeater and 'events_detail_dates_start_date' is the date field. $wire->addHookAfter('InputfieldRepeater::renderRepeaterLabel', function($event) { if ($event->object->hasField == 'events_detail_dates') { $event->return = date('D. j F Y', $event->events_detail_dates_start_date); } });
  1. Load more activity