Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


bernhard last won the day on December 4 2019

bernhard had the most liked content!

Community Reputation

4,179 Excellent

About bernhard

  • Rank

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Vienna, Austria
  • Interests

Recent Profile Visitors

13,894 profile views
  1. Hi everybody, I want to share what I came up with. Background: The goal was to get a color-accent to every headline on my new project. First thought was to use CSS-only with ::before pseudo element, but the problem is, that the headline is a either a block element (then position absolute left 0 leads to the accent being on the very left even for text-align:center headlines). Or if the headline is inline-block I had some other weird problem that I can't remember right now. Also multiline headlines where tricky. That's why I wanted to add a real element at the beginning of every headline. Wrapping the first word was actually not necessary. I'm adding an empty <i></i> now right behind the opening <h2> or <h3> tag, so the regex get's even simpler. Here's the result: Here's the LESS if someone is interested: // apply style to all elements with tm-fancy attribute // this attribute is added to all h2+h3 via textformatter *[tm-fancy] { font-family: @tm-font-fancy; i:first-of-type { position: relative; } i:first-of-type::before { content: ''; position: absolute; left: -15px; bottom: 5px; width: 120px; height: 20px; background: @tm-secondary; z-index: -1; border-radius: 2px; } } // adjust width and height for h3 h3[tm-fancy] i:first-of-type::before { width: 100px; height: 15px; } And here's the very simple textformatter that I can apply now an every textarea field: <?php namespace ProcessWire; class TextformatterFancyHeadlines extends Textformatter { public static function getModuleInfo() { return array( 'title' => 'FancyHeadlines', 'version' => 100, 'summary' => "Add <i></i> to headlines for color accents.", ); } public function format(&$str) { // early exit if there are not h2 or h3 elements if(strpos($str, "<h2") < 0 AND strpos($str, "<h3") <0) return; // add attribute and inline element via regex $re = '~(<h[23][^>]*)(>)~ism'; $str = preg_replace($re, "$1 tm-fancy$2<i></i>", $str); } } Thx for your help ๐Ÿ™‚ PS: If anybody knows a better solution please share it ๐Ÿ™‚ Maybe there's a CSS-only way of doing that?
  2. Thx @ukyo, it is, as I thought, a windows problem. I've tried the "next" branch - no change. It works on my linux server. Would be great to get a fix for this. As you can see in my screenshot the strange thing is that the FilenameArray is populated on line ~118 but it is empty on line ~174 (where the select field on the input tab of the pw field should get populated).
  3. Hi, I want to wrap the first line of every H2 and H3 in a <span></span> tag so that I can do further CSS styling on that element. The problem is that the markup comes from a CKEditor field, so it can have different versions: <h2>This is a headline</h2> <h2><span>This</span> is a headline</h2> // result <h2 foo="bar">This is a headline</h2> <h2 foo="bar"><span>This</span> is a headline</h2> // result <h2 foo="bar"><strong>This is a headline</strong></h2> <h2 foo="bar"><strong><span>This</span> is a headline</strong></h2> // result Any tips for me? Domdocument? Any 3rd-party dom parser? Or Regex? Thx for your help! ๐Ÿ™‚
  4. Hi @ukyo, I've just tried your module for the first time, but unfortunately it does not find any resources! This is the tracy dump: Somehow the resources array is empty: I have the following files in my setup: C:\laragon\www\kaum\site\modules\Mystique\configs\Mystique.example-dive.php C:\laragon\www\kaum\site\templates\configs\Mystique.mystique.php No matter what I try - the resources select is empty: I've even tried to do a $config->paths->normalizeSeparators() on the path without success (thought it might be a windows issue). Thx for your help!
  5. That was related to all previous posts, not only psy's - even though I think "stupid" might be an unappropriate wording here ๐Ÿ™‚ But I didn't want to blame her for that either ๐Ÿ˜‰
  6. I don't think it's fair to blame him for his opinion. I think there are some valid points in it. He clearly has a non-tech marketing background and I can imagine that some kind of problems get a huge challenge with ProcessWire that are simply some clicks on other platforms. We know the pro's and con's, but if you don't have the technical background I can really understand that you get frustrated with ProcessWire. Not everybody has the time or will to learn things "from scratch". The headline states that he assumes PW is great for developers, pretty bad for everyone else. While I don't agree 100% on that, the point that PW aims on developers is true. I'd maybe add that it is also great for clients. But that's not always the case, to be honest: I think we all have had situations where we've stored data (settings, lists of countries and so on) somewhere in the page tree, because that's the way to do it in PW... But that's not the way someone coming from other platforms would assume it to be. I guess they'd be looking for it somewhere in the menu, in some listings or whatsoever... I've also needed @gebeer convincing me that it is a great platform. But I enjoy all the technical challenges, so that'll most likely be a totally different experience than someone who he calls "business users" might have ๐Ÿ™‚
  7. How does that work with Tracy? ๐Ÿ˜ฎ
  8. I haven't used it, but it looks great! Thx for sharing!
  9. https://processwire.com/api/ref/page/get-unformatted/ $timestamp = $page->getUnformatted('event_start');
  10. Disregard that. I thought Joomla had a standard way of defining module positions. But that seems to be different for every template. The backend would nevertheless have to know which positions are available to choose from for the frontend ๐Ÿ™‚
  11. I built it 2017, so that's totally possible that I had some Joomla UI in my head ๐Ÿ˜„ I get your point, but I guess that would get very complicated... We'd need a complete UI for widget management. At the moment those widgets in my setup are pages and I only need one inputfield to handle visibility. Imagine the other direction: We are on the frontpage and want to let the user choose the widgets there... Which widgets do exist? If the user sets the widget visible, what about child pages (eg on blog overview page, what about the detail pages?). How to add a new widget to the page? Hmm... Maybe a quite simple field would be enough: Widgets visible on this page: W1, W2, W3 Other available widgets: W4, W5, W6 The widgets could be links that open the widget edit screen in a panel. Simple enough. But thinking about that, the next step would be some way of defining WHERE the widget should live on that page. Including some way to define the position/sort order... That's quite how modules in Joomla worked (at least until 2014). I think, a Widget Management Module would make the most sense... But then we would need some kind of frontend companion. I guess that's not how PW works?! Or at least it does not shine in that regard as much as it does elsewhere...
  12. That's a good input, thx. That would mean we'd need some kind of "not visible on that page, but on at least one descendant"...
  13. Hi, there has been some discussion about widget systems using ProcessWire: https://www.google.com/search?q=site:processwire.com+widget+system When working with widgets, you'll need to define somewhere WHERE the widget is visible and where it is not. The first thought might be: Let's use a Page Reference field for that! But there is a problem: What, if you want to show the widget on all "blog" pages? That's not possible with that Inputfield. OK, second thought might be that we can do that using the Selector Inputfield: The problem: This would mean "template=blogitem|clubs|event, parent=/presse" which only shows 2 blogitems that live under /presse, which is not what I want, because I'd need an OR condition for all rows... Besides I think this Inputfield is too complicated for non-tech users. What I've done in 2017 is this: (https://processwire.com/talk/topic/8635-simple-example-for-widget-management/?do=findComment&comment=148216) This post got 3 likes - I'd like to get your feedback on that approach, because I might need something similar on a current project and I'm not sure if that 3 likes mean "useless" or "overengineering" or similar... I'm thinking if that's maybe also too much for a regular webmaster and I should just create a simple text Inputfield to write a custom selector into (done by superuser)?! How are you solving this? What do you think of the ui shown in the screencast? Is that inutitive? Worth putting it into a module?
  14. I just voted YES because of the backend part ๐Ÿ™‚ Thx in advance!
  15. Thx for the link @dragan. I don't know if there are any options that one could set for the export. Maybe there is a way to make it work properly with native export as well...
  • Create New...