Jump to content

Stefanowitsch

Members
  • Posts

    293
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Stefanowitsch

  1. I want to show you a project that I started developing in summer of 2022 and that went online in january 2023.

    Kulturhaus Wilster ("Arts Centre Wilster")

    https://www.kulturhauswilster.de

    The Kulturhaus Wilster - also called "Wilster's living room" by many visitors - is a socio-cultural center in the heart of Wilster. 
    Wilster is a small City located north from Hamburg, germany. Despite the fact that this is a small venue they offer large amount of events.
    The events range all the way from concerts to theatre and everything inbetween!

    The old version of the site was a super simple WordPress website in a black-and-white only color scheme. In my opinion it did no justice to the very colorful program that the Kulturhaus offers so I tried my best to bring some color into the game.
    The whole website should have a shabby-chique look combined with clean, modern elements.

    The Homepage offers a preview of the next 8 upcoming events. A blog section is also included and the latest post is displayed next to the event calendar book as PDF download.

    The event pages offer a quick-reservation form (tickets are not sold online) and a quick look to the next upcoming events in the sidebar.

    The website features a large event calendar. It was a really nice exercise in using ProcessWires very own paging and selector features. Events can be searched and filtered by type (and month), too. All with a few lines of code only. 

    For example "Look for events that take place in the future in a specific category" 

    $events = $pages->find("select_event_cat.title~|%=$c, template=event, date_event>=today, sort=date_event, sort=time_from, limit=6");

    Besides that the website features some colorful content pages with large images, galleries, textboxes and some teaser elements. The editors of the website are able to display all facets of the Kulturhaus this way.

    Tech Talk:

    Frontend Framework is Bootstrap 4.6

    ProcessWire Modules used on this one are:

    - WireMail: SMTP (https://processwire.com/modules/wire-mail-smtp/)
    - SEO Maestro (https://processwire.com/modules/seo-maestro/)
    - All in one minify for asses (https://processwire.com/modules/all-in-one-minify/)
    - PageImageSource for webp image srcsets (https://processwire.com/modules/pageimage-source/)
    - JkPublishPages is used for time-controlled publishing of the blog posts. Please check out this module! Thanks @Juergen
    - @bernhards great RockFrontend was also used. In this particular project only the autorefresh feature (because this module was brandnew back then and development of the page was almost done). But even "only" using autorefresh makes it worth using it!

    Please have a look:

    image.thumb.png.9f6e0367cd2735b14835210935d1d084.png image.thumb.png.5d6db957416570be02704d6b743f6bc2.png

    • Like 16
  2. I just used this module in a project where I needed to add a line break into a headline field that does not allow HTML tags. Normally you would just insert a <br> tag.

    Sometimes you have this case where you need just this one little tweak and don't want to change field settings globally or create a new field/setting just for a single purpose.

    For example:

    image.png.4acfaa778010b10d551b5629c845e9da.png

    image.png.bd854af6cac6716b7db69e83bf5355d7.png

    How do you get a linke break into this headline when HTML is now allowed in the field settings?

    You could shrink down the parent container in the front end to "force break" the text. But this is kind of unpredictable as you never now if the client changes the text at one point in the future. 

    So here's my solution. I can define line breaks via the @-sign like this:

    image.png.c1302ae1bf3ae51b523c2b1bcb70abee.png

    Not without some custom code of course:

    $wire->addHookAfter("TextformatterRockDown::replace", function ($event) {
        $str = $event->arguments(0);
        $str = preg_replace("/@/", "<br>", $str);
        $event->return = $str;
    });

    This is the result:

    image.png.e92584d671edf1feb67b1dc29b7f54fa.png

     

    • Like 3
  3. A big shout-out and thank-you to @bernhard for keeping on improving the RockFronend. (and the whole Rock-EcoSystem) continuously. I asked for a minify-feature and here it is!

    I am using RockFrontend in every project now as it combines some must-have features for frontend development (IMHO!).

    Today a new feature was added (or lets say improved as auto-minify was included before)

    The Minify Feature (for Styles and Scripts!)

    See the Wiki entry here

     

    Lets start simple: How do I include stylesheets with RockFrontend in the first place?

    RockFrontend always had the feature to bundle stylesheets via the styles() function.

    For example I am loading some LESS partials into my header like this. You don't have to use LESS files, regular CSS files work the same.

    Note: Since RockFrontend offers LESS support you can add those files directly, no need to compile them and add the CSS files. For this you have to install the ProcessWire Less module.

     <? $rockfrontend->styles()
      ->add($config->urls->templates . 'styles/less/uikit/_custom-import.less') // add single LESS or CSS file
      ->addAll($config->urls->templates . 'styles/less/project') // point to folder to include files automatically
      ->addAll($config->urls->templates . 'styles/less/custom')
    ?>

    The result in this case is a single compiled CSS file that will be included in your head automatically.

    RockFrontend is very smart. You don't have to include tons of partial LESS project files here. Just use the addAll() function and point to a folder where your assets are saved and the module does the import for you.
    This is how my folder structure looks like. If I create new LESS files in there, they will be added and compiled automatically at runtime.

    image.png.a074556ac2fc1a748264c21db10bbe02.png

    How to minify

    For debugging and development purposes I don't use the minify feature. Instead I use it on the staging server exclusively.

    To generate a minified version of your stylesheet just add minify(true)

    <? $rockfrontend->styles()
      ->add($config->urls->templates . 'styles/less/uikit/_custom-import.less')
      ->addAll($config->urls->templates . 'styles/less/project')
      ->addAll($config->urls->templates . 'styles/less/custom')
      ->minify(true);
    ?>

    If you want to chain the minify function it to your debug-mode state you can do it like this (my preferred solution).

     <? $rockfrontend->styles()
      ->add($config->urls->templates . 'styles/less/uikit/_custom-import.less')
      ->addAll($config->urls->templates . 'styles/less/project')
      ->addAll($config->urls->templates . 'styles/less/custom')
      ->minify(!$config->debug);
    ?>

    That's it!

    Does minify work with Scrips?

    Yes, exactly the same. But you make use of the scripts() function in this case.

    <? $rockfrontend->scripts()
      ->add($config->urls->templates . 'scripts/script1.js')
      ->add($config->urls->templates . 'scripts/script2.js')
      ->add($config->urls->templates . 'scripts/script3.js')
      ->minify(!$config->debug);
    ?>

    Note that these script files are not bundled (even if you chose minify false). Instead they all come out as minified versions separately.

    I find that this workflow I straight forward and it combines some of the best features that RockFrontend offers! If you combine this with the awesome autorefresh feature, frontend development becomes a breeze!

    • Like 6
    • Thanks 1
  4. 15 hours ago, Richard Jedlička said:

    Hi @Stefanowitsch, is this the whole error message? Looks like the stack trace only.

    This entry is added to the exceptions log. Maybe it's not a problem of your module at all as it seems but has to to with the latest dev version? I have no idea why this is happening, though.

    No Template specified (in /wire/modules/Process/ProcessTemplate/ProcessTemplate.module line 760)

     

  5. @Richard Jedlička I've been using this module for years and it is really a helper.

    After upgrading to PW Version 3.0.213 dev (!) I encounter an error when I want to edit the page template via the quick link. The other quick links for the fields are working fine.

    image.png.bffec3ce0e5612f7d490a44d7325056e.png

    Heres the message:

    #0 /Users/XXX/XXX/wire/core/Wire.php(413): ProcessWire\ProcessTemplate->___executeEdit()
    #1 /Users/XXX/XXX/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___executeEdit', Array)
    #2 /Users/XXX/XXX/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessTemplate), 'executeEdit', Array)
    #3 /Users/XXX/XXX/wire/core/ProcessController.php(350): ProcessWire\Wire->__call('executeEdit', Array)
    #4 /Users/XXX/XXX/wire/core/Wire.php(413): ProcessWire\ProcessController->___execute()
    #5 /Users/XXX/XXX/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___execute', Array)
    #6 /Users/XXX/XXX/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessController), 'execute', Array)
    #7 /Users/XXX/XXX/wire/core/admin.php(160): ProcessWire\Wire->__call('execute', Array)
    #8 /Users/XXX/XXX/wire/modules/AdminTheme/AdminThemeUikit/controller.php(15): require('/Users/sthumann...')
    #9 /Users/XXX/XXX/site/templates/admin.php(15): require('/Users/sthumann...')
    #10 /Users/XXX/XXX/wire/core/TemplateFile.php(328): require('/Users/sthumann...')
    #11 /Users/XXX/XXX/wire/core/Wire.php(413): ProcessWire\TemplateFile->___render()
    #12 /Users/XXX/XXX/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___render', Array)
    #13 /Users/XXX/XXX/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
    #14 /Users/XXX/XXX/wire/modules/PageRender.module(575): ProcessWire\Wire->__call('render', Array)
    #15 /Users/XXX/XXX/wire/core/Wire.php(416): ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent))
    #16 /Users/XXX/XXX/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___renderPage', Array)
    #17 /Users/XXX/XXX/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Array)
    #18 /Users/XXX/XXX/wire/core/WireHooks.php(1060): ProcessWire\Wire->__call('renderPage', Array)
    #19 /Users/XXX/XXX/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'render', Array)
    #20 /Users/XXX/XXX/wire/modules/Process/ProcessPageView.module(184): ProcessWire\Wire->__call('render', Array)
    #21 /Users/XXX/XXX/wire/modules/Process/ProcessPageView.module(114): ProcessWire\ProcessPageView->renderPage(Object(ProcessWire\Page), Object(ProcessWire\PagesRequest))
    #22 /Users/XXX/XXX/wire/core/Wire.php(416): ProcessWire\ProcessPageView->___execute(true)
    #23 /Users/XXX/XXX/wire/core/WireHooks.php(952): ProcessWire\Wire->_callMethod('___execute', Array)
    #24 /Users/XXX/XXX/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'execute', Array)
    #25 /Users/XXX/XXX/index.php(55): ProcessWire\Wire->__call('execute', Array)
    #26 {main}

     

  6. 24 minutes ago, elabx said:

    I can click the button just fine on android Chrome,  but can also confirm you are not going crazy I tested in my wife's phone which is an iphone and I can replicate the behaviour! It takes too taps to click the button!

    Thank you! I found an old amazon tablet here (android) and there the button click events are working fine too. This looks more and more like an iPhone bug.

  7. 8 minutes ago, Juergen said:

    My explanation, was for the parent pages, not for adding the publishing fields to the template. To clearify: This blog post template will not be visible at the checkboxes list for the templates in your case?

    I will take a closer look on my local installation and give you a feed back after lunch. I guess there will be a problem in querying templates.

    I'll send you a PM with some screenshots of my page structure and the settings.

    • Like 1
  8. 3 minutes ago, Juergen said:

    Hello Stefanowitsch,

    you are right - this is exactly what it does. If you need a certain page to be selectable, you have to make some adjustments in the appropriate page template and sometimes in the template of the parent too.

    I recommend you to take a look at both template settings (current page template and parent page template) - in one or in both must be some restrictions set. If you need help, you can post a screenshots of both template settings here, and I will try to figure out the responsible setting

    You are right. This setting here in the page template settings seems to be responsible for including/excluding the template in the module settings. This was set to "NO" in my case:

    May pages using this template have children?

    image.png.67115bbcb0bd5f1e1bdc68eab2eddbfa.png

    Is this critical for the module to work? I want to include the "Published From" field to a blog post template. This template should not be allowed to have subpages underneath it.

    • Like 1
  9. 33 minutes ago, DV-JF said:

    Short reply: On my Pixel 6a with latest Android the link is working as expected in Firefox as well as in Chrome browser. 

    Maybe you could ask here: https://discord.com/invite/NEt4Pv7

    Thanks for testing! I only have my iPhone for testing and there the behaviour is identical in safari + chrome.

    I asked the same question on the UIKit discord channel yesterday. Which is a bit new for me - describing such a complicated thing in a chat room environment. Maybe they have an explanation.

  10. I ran over a bug (?) that kind of freaks me out. It's this kind of problem that seems to occur without any reason. But let me explain:

    I have a project that is using the latest UIKit 3 library. On the homepage I make use of a slideshow component which is also configured to take space of the entire viewport height (via: uk-height-viewport).

    The other content elements are introduced by using the Scrollspy component when scrolling down.

    I was wondering why no link is working (even javascript on click events on anything on the page). Instead the "first" click only triggers the hover state of the link/button. Then the second click triggers the link event. This only occurs on mobile devices (like my iPhone).

    The only solution to make links work in the first place is to get rid of the uk-height-viewport attribute of the slideshow. OR to get rid of all the Scrollspy instances. This makes no sense to me.

    I made a small demo site where I can exactly reproduce this phenomenon. So it seems to have nothing to to with my project code but is in fact a kind of UIKit bug (?).

    Please have a look:

    http://uikit.thumann-preview.de/

    1. Open the page on a mobile device 
    2. Scroll down to the red button
    3. Tap on the button. Nothing happens but the hover state is activated.
    4. Tap again on the button. The link is working.

    I also made a short video that shows the problem:

     

    Here's the code of this test page:

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>CDN Example</title>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/js/uikit.min.js"
            integrity="sha512-uNdy6/b4kpAKQgC1MqDRW7HzGqmja6jPPfQ0Pv3q4f0r5XpL4cxPlgqgSbFT5pnLFo4BSFZX8Ve/ak0DDN06OA=="
            crossorigin="anonymous" referrerpolicy="no-referrer"></script>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/css/uikit-core-rtl.min.css"
            integrity="sha512-+6D4TOLdOBhkuufbELpbCiGmD+Y4dzrNbSPGwtgGO2nf7Id3dM0x5R/Cw0bI/13pFUnsRL8pfpmKNWLbAx8fGg=="
            crossorigin="anonymous" referrerpolicy="no-referrer" />
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/css/uikit-core.min.css"
            integrity="sha512-Up68klxaLGLgBXFtu9KAkcM0/b1Vv97wru/VabGokNEwbQN1RBjBtthqDgildf/8YCOKaaLvT5ZfIvVPom5dIw=="
            crossorigin="anonymous" referrerpolicy="no-referrer" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.15.11/js/uikit-icons.min.js"
            integrity="sha512-Rrh7aqdTz7Q1BPfCdWCK3poag9FNK1HQJMbSdL/eRZwXkbS1EWlY5n2XJ70ZVh1ZLRIJEUoWxATps1cyzpGp/g=="
            crossorigin="anonymous" referrerpolicy="no-referrer"></script>
    
        <style>
            body {
                max-width: 90%;
                margin: auto;
                background-color: rgb(227, 227, 227);
            }
    
            footer {
                padding: 10px;
                background-color: cornflowerblue;
                padding-top: 20px;
            }
        </style>
    </head>
    
    <body>
    
        <header>
            <nav class="uk-navbar-container" uk-navbar style="background-color: cornflowerblue;">
                <div class="uk-navbar-right">
    
                    <ul class="uk-navbar-nav">
                        <li class="uk-active"><a href="#" style="color: white">Home</a></li>
                        <li>
                            <a href="#" style="color: white">Account</a>
                            <div class="uk-navbar-dropdown">
                                <ul class="uk-nav uk-navbar-dropdown-nav">
                                    <li class="uk-active"><a href="#">Login</a></li>
                                    <li><a href="#">Sign Up</a></li>
                                    <li><a href="#">Report</a></li>
                                </ul>
                            </div>
                        </li>
                        <li><a href="#" style="color: white">Item</a></li>
                    </ul>
    
                </div>
            </nav>
        </header>
    
    
        <!-- Slider  -->
    
        <div class="uk-position-relative uk-visible-toggle uk-light" tabindex="-1" uk-slideshow="ratio: false">
    
            <ul class="uk-slideshow-items" uk-height-viewport>
                <li>
                    <img src="https://picsum.photos/200/400" alt="" uk-cover>
                </li>
            </ul>
    
            <a class="uk-position-center-left uk-position-small uk-hidden-hover" href="#" uk-slidenav-previous
                uk-slideshow-item="previous"></a>
            <a class="uk-position-center-right uk-position-small uk-hidden-hover" href="#" uk-slidenav-next
                uk-slideshow-item="next"></a>
    
        </div>
    
        <!-- Cenetred Text -->
        <h1 class="uk-text-primary uk-text-center">This is awesome</h1>
    
        <!-- Adding card -->
        <div class="uk-child-width-1-3@m uk-grid-small uk-grid-match" uk-grid uk-scrollspy="cls: uk-animation-slide-bottom">
            <div>
                <div class="uk-card uk-card-primary uk-card-body">
                    <h3 class="uk-card-title">Card1</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
                </div>
            </div>
            <div>
                <div class="uk-card uk-card-warning uk-card-body">
                    <h3 class="uk-card-title">Card 2</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
                </div>
            </div>
    
            <div>
                <div class="uk-card uk-card-secondary uk-card-body">
                    <h3 class="uk-card-title">Card 3</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
                </div>
            </div>
        </div>
    
    
        <div class="uk-child-width-1-3@m uk-grid-small uk-grid-match" uk-grid uk-scrollspy="cls: uk-animation-slide-bottom">
    
            <div>
                <div class="uk-card uk-card-warning uk-card-body">
                    <h3 class="uk-card-title">Card 4</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
                </div>
            </div>
    
            <div>
                <div class="uk-card uk-card-secondary uk-card-body">
                    <h3 class="uk-card-title">Card5</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
                </div>
            </div>
            <div>
                <div class="uk-card uk-card-primary uk-card-body">
                    <h3 class="uk-card-title">Card 6</h3>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
                </div>
            </div>
        </div>
    
    
        <a href="https://www.google.de" class="uk-button uk-button-danger uk-margin">I AM NOT WORKING :-(</a>
    
        <!-- Card with images -->
    
        <div class="uk-child-width-1-2@m" uk-grid uk-scrollspy="cls: uk-animation-slide-bottom">
            <div>
                <div class="uk-card uk-card-default">
                    <div class="uk-card-media-top">
                        <img src="/slides/slide3.png" width="1800" height="1200" alt="">
                    </div>
                    <div class="uk-card-body">
                        <h3 class="uk-card-title">Human</h3>
                        <p>An average of 20 times every minute, your eyes blink. The tongue has roughly 8,000 taste buds,
                            each of which can have up to 100 cells. In reality, earwax is a form of sweat.</p>
                    </div>
                </div>
            </div>
            <div>
                <div class="uk-card uk-card-default">
                    <div class="uk-card-body">
                        <h3 class="uk-card-title">Cat</h3>
                        <p>Cats have a 6-times-their-height jump capacity. The average cat snoozes for 13 to 16 hours every
                            day (roughly 70% of their life). A cat's lifespan is equivalent to 15 years in a person's life.
                            A Maine Coon is one of the largest domestic cat breeds.</p>
                    </div>
                    <div class="uk-card-media-bottom">
                        <img src="/slides//slide4.png" width="1800" height="1200" alt="">
                    </div>
                </div>
            </div>
        </div>
        <br>
        <br>
    
    </body>
    
    
    </html>

     

  11. 25 minutes ago, bernhard said:

    Yes, it's a simple preg_replace that finds *bold* and replaces it with <strong>bold</strong>

        $start = "(^| )"; // allowed start
        $end = "($|\W)"; // allowed ending whitespace
        $str = preg_replace("/$start\*(.*?)\*$end/", "$1<strong>$2</strong>$3", $str);
        $str = preg_replace("/$start\_(.*?)_$end/", "$1<em>$2</em>$3", $str);
        $str = preg_replace("/$start~(.*?)~$end/", "$1<s>$2</s>$3", $str);
        $str = preg_replace("/$start```(.*?)```$end/", "$1<tt>$2</tt>$3", $str);
        $str = preg_replace("/$start#(.*?)#$end/", "$1<tt>$2</tt>$3", $str);

    You can do that with CSS, or am I missing something?

    Yeah thats what I needed to know. I look for a way to insert a simple <span> around a word or phrase inside the headline. I can then style this <span> like I want (color, different font, etc.)

    So I can just add this option here I guess (I used the @ as an example) ?

    @i have span around@

    $str = preg_replace("/$start@(.*?)@$end/", "$1<span>$2</span>$3", $str);

     

  12. Interesting. I have those "Headlines with bold/italic Text inside" in nearly all projects.

    I used to solve this by using a CKEditor for the Headline. Which is a bit over the top for a single headline that can (and should?) be handled in a text field:

    image.thumb.png.9c2db49770dd5acfac8b9c1808acbeab.png

    How does the formatted text element look inside the HTML code? Does your module apply the <i></i> or <b></b> tags dynamically?

    Is it possible to define custom formatting options for example a colored word inside a headline phrase (see screenshot).

    Last but not least: I never used a Textformatter before. How and where do I apply the Formatter to my field?

     

  13. SOLVED: THE FIELD HAS TO BE SET AS A MANDATORY FIELD (=REQUIRED) TO DISPLAY THE DEFAULT VALUE...

    This is the first time that I want to make use of a select field with a default value.

    It's all about the position of an image in this case. Either left or right. I want do have "left" as default value. So here are my field settings:

    image.thumb.png.f891d3c48f4381d9e48a53e09db395ac.png

    This is how it looks on the page I am editing:

    image.png.13471206f22823ab018251d79f288108.png

    The default value is never set. What am I doing wrong?

  14. Hello and welcome to ProcessWire!

    Basically what we are talking about here is called a "multi site". 

    This article here explains some options how to achieve this:

    https://processwire.com/docs/more/multi-site-support/

    When your two websites differ very much design wise and from the template/field structure I would not use the multi-site module (option #2) but instead install two separate PW instances to keep it cleaner.

     

  15. 1 hour ago, bernhard said:

     

    $rm->createField('mynewfield', 'text', [
      'label' => 'I am the field that the client wanted to have',
    ]);
    $rm->setTemplateData('home', [
      'fields' => [
        'title',
        'mynewfield',
      ],
    ]);

    Is that really too much to ask? Seriously. What is the pain here? Is it that you don't know the settings? That's why I added the code section to copy&paste. I'm not trying to convince you here. I'm trying to understand.

    No pain! Its just a question of the workflow.

    At some point or another you would have to do all things from the migrate.php instead of going through Setup->Fields->Add. 
    It's just different way of approaching things... how can I describe it... it's like a more professional, developer-style approach.
    I personally am a fan of frontend editing, where you can see what you do and where you click. Sometimes this is safer to use but none the less it will slow you down after time.

    What I like about RM is that it only takes a few moments to do lots of things once you are familiar the RM syntax. But at first it will resolve in a bit of trial and error and some people (including me) might be afraid to start using it in a finished and complex project.

    That does not mean that I never want to use RM. The opposite: Your recent video here answered a few of my questions I had before so now I want to try a few things out.

    • Like 2
  16. 13 hours ago, wbmnfktr said:

    Let's say I want to start using RockMigrations within one of my projects it would be nice to have a migrate.php file that contains already all fields, templates and fields in templates with their settings. With that file I could copy the migrate.php file over to a new instance, make my changes and run the migration. With this in place I could clone my existing structure of templates and fields right into a totally new and clean installation.

    Right now I have to copy the code hints from all of my 100 fields over to the migrate.php and that's something I'd probably never do unless really necessary. For now I would export all fields the PW-way and import them in the project. The same for the templates.

    +1 !

    That is the main reason why I am too afraid / too busy to start using rock migrations right now. I understand that in the end it can save you a lot of time but you have to start somewhere and it seems that all the field administration/creation will be done from the migrate.php instead of clicking around in the backend (the normal way) from then on.

    I mean the typical use case for me would be the following scenario:

    During site development I do all my field/template creation and settings in the backend. Adding fields to templates, edit the field in template context, etc. etc. 

    Then the site goes live.

    THEN the client wants something new on the site or wants to change things. 

    This is the moment where PW development becomes a little painful. You have to alter fields or add some new on your local dev environment and test it. Then you have to make all those changes on the live site again. 
    You COULD however replace the database on the server (which includes all the new stuff) but what if other changes were made in the meantime on the live site? Like new articles, new subpages...

    • Like 3
  17. 13 hours ago, Manaus said:

    Hello, I am building a page of events, where I want to show only the coming ones.

    I am doing the exact thing in a project and this is how I get those events:

    // all future events from "today"
    $events = $page->children("date_event>=today, sort=date_event, sort=time_from, limit=6");

    The magic lies here. You can literally "tell" the selector what to do. You don't need any timestamps or date functions.

    date_event>=today

    You could also do things like:

    // get all events of the current year
    $events = $pages->find("template=event, date_event>='first day of this year', date_event<'last day of this year', sort=date_event, sort=time_from, limit=6");

     

    • Like 4
  18. After upgrading to PHP 8.1 I get this message when sending mail:

    Deprecated: Function strftime() is deprecated in /Users/XXX/Sites/processwire-ui3/site/assets/cache/FileCompiler/site/modules/WireMailSmtp/smtp_classes/email_message.php on line 675

    This is no surprise - strftime() needs to be replaced in the future. It's still working fine at the moment, though. 

    See email_message.php, Line 675:

    return($this->FormatHeader("Message-ID", "<".strftime("%Y%m%d%H%M%S", $seconds).substr($micros,1,5).".".preg_replace('/[^A-Za-z]/', '-', $local)."@".preg_replace('/[^.A-Za-z_-]/', '', $host).">"));

    I am afraid to fix this line by myself... it looks complicated 🙂

    • Like 1
×
×
  • Create New...