Jump to content

Michael van Laar

Members
  • Posts

    105
  • Joined

  • Last visited

Everything posted by Michael van Laar

  1. I’m just building my new blog with processwire. Regarding the publish date of an article I’d like to have the same functionality WordPress provides. My idea: I include the “Publish From Date“ field of the Schedule Pages module in my template. I use the “Publish From Date“ field in my frontend templates to display the publishing date of an article and to sort articles chronologically. When writing a new article, I’d like to have two options:If I want to schedule the publishing of an article, I fill the “Publish From Date“ field with the desired date and time. If I want to publish a new article instantly, I leave the “Publish From Date“ field empty and simply click the “Publish” button. In this case right after publishing – or even better before the publishing workflow step is finished – a page with an empty “Publish From Date“ field, the “Publish From Date“ field should be filled with the current timestamp automatically. Otherwise no publishing date could be displayed in the frontend and the article couldn’t be sorted as latest one correctly. Is there an easy way to achieve this auto-filling of the “Publish From Date“ field when publishing a page? I guess I have to hook into anything to achieve that. I have not worked with PW hooks by now, so my knowledge of hooks is very limited. But I couldn’t find anything “publish” related in the PW hooks cheatsheet. Of course I could simply fill the “Publish From Date“ field manually even if I want to publish the page instantly. But I’d like to use this functionality for other blogs, too – with editors who are used to the publish date field auto-filling like WordPress does it.
  2. I just added the “replace new line with a space character” before the two other rules of the original Thinspace module do their work: public function format(&$str) { $str = preg_replace('/\n/u', ' ', $str); $str = preg_replace('/(?:\x{20}|\x{a0}){2,}/u', ' ', $str); $str = preg_replace("/\n{2,}/u", "\n", $str); } E. g. the combination “space + line break + space + line break” will be converted into “space + space + space + space” in a first step and then into a single “space” in a second step. To have optimal content for meta elements which have a length limit, I create separate fields on a separate tab and use the Textarea Counter module. Of course i always include fallbacks in my templates. So if a description field is not filled with text, there are multiple fallback steps – ending with a “nice break” extract from the page’s main body text.
  3. Because I wanted to be able to strip all line breaks from a textarea field and then apply the Thinspace textformatter, I forked Netcarver’s module, added the required line and simply called it “Thinspace Plus” (which is not very creative, I know): https://github.com/MichaelvanLaar/PW-TextformatterThinspacePlus I use this Textformatter mostly for textarea fields that contain meta descriptions and similar content. The reason I use textarea fields here – instead of simple Text fields – is that I want to be able to use the great Textarea Counter module with these fields. But since these fields are intended to be simple strings without any line break or paragraph formatting, I want to “flatten” them – just in case an editor enters a line break. OK, the line breaks probably won’t do any harm in meta descriptions, OpenGraph descriptions, etc. But I just want to see them in my rendered source code ;-)
  4. Sérgio, this is a side effect of the lazysizes script. The fallback image, which has a different aspect ratio, is loaded first. Then the apppropriate image for the screensize is loaded and displayed. I just changed the behavior by not using the lazysizes script for this particular image. Now it takes a bit longer until anything is displayed on this place. So the perceived loading speed is a bit slower. But it’s definitely better because there is no change in aspect ratio of the image without the browser window being resized.
  5. I don’t use a framework. Instead I use my own collection of boilerplates, polyfills and tools I (re-)use in most of my sites: https://github.com/MichaelvanLaar/Website-Template-Starting-Point This starting point is still far away from being perfect. In fact, there are always things I want to change – right now it’s more BEM-ish CSS. But it serves its purpose.
  6. A friend of mine asked me to build a website for the dog training business she just started. She already had a graphic designer create a logo and a small print brochure and wanted a clean, simple website. www.hundeschule-grosse-freiheit.de is the result. The website is neither big nor fancy. But it has some nice details: Responsive, lazy loading images Almost all images (except the SVGs and the badge image in the footer) are maintained via the ProcessWire backend. Each image is rendered in eight different sizes – using respimage and lazysizes for frontend display. All images are created using the great ImageFocusArea module – something I wanted to be able to use in ProcessWire since I first worked with Drupal’s “ImageField Focus” module. Of course all images are minified using minimize.pw. Central asset management for images Because most of the decorative images are used on more than one page, it made sense to build a central image management – using a specific “settings” part of the page tree with one page per image. Images in sidebars or on the gallery page are chosen using page fields in combination with the Page List Image Label module: So an editor’s experience regarding the visual representation of the “linked” images is not so much different from working with default image fields. Consequent usage of a cookieless subdomain for static content. The cookieless subdomain specified in the AIOM+ module’s setting is also used to deliver images. Multi-language content. Nothing big, but my first ProcessWire site with more than one language. Of course it uses the Autodetect Language module for the homepage – as well as “hreflang” links in each page’s head to give Google as much language information as possible. Feedback and ratings The feedback page, which features quotes and pictures of happy clients, is populated semi-automatically. Feedback is collected using a Form Builder form on a secret page. After a training has ended the site owner sends an email to clients, thanking them for taking part and asking them for their feedback with a link to the secret form page. Clients can enter a quote, a 5-star rating and optionally an image – as well as their permission to use the quote and the image (necessary to avoid legal problems). This information is saved as a new unpublished page. After a new feedback entry page is published by the site owner, the new entry is displayed on the main feedback page. The pages used to save feedback entries feature multi-language fields. So it’s possible to present all testimonial quotes in both languages. The footer of each page features an aggregated 5-star rating, calculated from all single ratings displayed on the feedback page. Each individual feedback entry on the feedback page as well as the aggregated rating are formated using Schema.org markup. So it can be read and understood by Google and thus has the potential to be displayed as rich snippet on Google result pages. Oh by the way: The decision to use email links rather than a contact form was made by the site owner.
  7. I opened an issue on Github mentioning the above findings: https://github.com/ryancramerdesign/ProcessWire/issues/919
  8. Having the same problem here, I investigated a little and found a bug and a workaround. First, there is a bug in LanguageTabs.module, lines 83 and 84. This prevents the JS and CSS file from being found. Wrong: $this->config->scripts->add($this->config->urls->LanguageTabs . "LanguageTabs.js"); $this->config->styles->add($this->config->urls->LanguageTabs . "LanguageTabs.css"); Right: $this->config->scripts->add($this->config->urls->LanguageSupport . "LanguageTabs.js"); $this->config->styles->add($this->config->urls->LanguageSupport . "LanguageTabs.css"); But this doesn’t solve the bug that the module doesn’t show up in the Core section of the module list. The quick and dirty workaround to fix this: Move the file LanguageTabs.module from directory /wire/modules/LanguageSupport to /wire/modules Unfortunately I have no idea why this fixes the problem. I have not found any hint in any file which would indicate that ProcessWire doesn’t like the file LanguageTabs.module in the subdirectory /wire/modules/LanguageSupport
  9. Since I can’t help so much with developing ProcessWire or PW modules (because I’m not a PHP expert yet), I’d be happy to help extending the documentation. So please tell me if I can help.
  10. Great. I didn’t know that I can put a selector into “->count()”. Did I miss this in the API cheatsheet?
  11. That’s what I did in my current project. I have a “more topics in this blog“ box on every tag page. The box features a list of links to all tags – except the current tag page. So every tag page has a different "more topics" list, wich is cached for 24 hours. Probably a far longer cache period would be reasonable, since I’m not going to add new tags every day. <?php $tags = $pages->find("template=tag, sort=title"); $cache_topic_name = 'more_tags_list_for_' . $page->name; $cache = $modules->get("MarkupCache"); if(!$more_tags_list = $cache->get($cache_topic_name, 86400)) { $more_tags_list = '<ul>'; foreach ($tags as $tag) { if ($pages->find("template=blog-article, tags=$tag")->count() > 0) { $more_tags_list .= '<li><a href="' . $tag->url . '">' . $tag->title . '</a></li>'; } } $more_tags_list .= '</ul>'; $cache->save($more_tags_list); } echo $more_tags_list; ?>
  12. Thanks Ryan! I’ll definitely try this once I have my e-mail newsletter up and running.
  13. A stupid question, but I want to get it right: The module chooses the name, with which the cached markup result snippet can be identified later on, automatically by looking at the if-statement?
  14. Great! Exactly what I was looking for to display related content based on common tags. If I find the time – and if my limited PHP knowledge will be sufficient – I’m going to extend this to be able to find related content based on more than one field. This would also be a great addition to display search results based on their relevance. If there is not yet a solution which does so …
  15. One additional question: Are there any performance drawbacks? Generating a list of ten or twenty category links must be quite CPU-intensive if Processwire has to iterate over hundreds of blog articles every time just to check if a category is used at least once.
  16. By the way, being able to extend the comment form would be nice anyway. A typical use case would be an additional checkbox which a commenter can check to subscribe for a newsletter. You would then “only” have to hook into comment processing to pass this information (in combination with his e-mail address) through to an e-mail marketing service provider’s API. But this is just an idea.
  17. Great! Then I will wait fro v2.3, since this is not a key feature for my blog ;-)
  18. I’d like to have an input field for the commenter’s web address in my comment forms. Is there a way to extend the form and the comments output without hacking the module?
  19. I see, I should have written the doc in English. Sorry for that.
  20. Wow! Looks good. Here is my first (and surely incomplete) list with things that have to be changed, if the shop module should be ready for the german market: https://docs.google.com/document/d/1xsvQQboXQwnrvJ-fnkln--yZ255e5Y3PAIM4onMk6GU/edit Please feel free to add topics I forgot.
  21. Wow, you’re really fast. I hope I can keep up with you ;-)
  22. Sorry guys, absolutely no time for a chat today. But how about setting up a Google Document or so, which we can fill with ideas, requirements etc?
  23. I already had a look at the shopping module in a local test installation some weeks ago. A roadmap like Luis already said would be the best way to start. How about a skype call or conference call tomorrow (October 24th), let’s say 4 p.m. German time?
  24. OK, meanwhile I had a deeper look at Ryan’s blog profile. And of course using pages as tags is great, because you can add a description field (like you do with categories), which makes tag pages performing way better regarding SEO. I used pages as categories in my old MODX based blog. But adding new categories/tags was not as easy as it is here.
×
×
  • Create New...