-
Posts
351 -
Joined
-
Last visited
-
Days Won
5
Everything posted by Stefanowitsch
-
Do I need the "Pro" plugins to build a full website?
Stefanowitsch replied to Castle's topic in Getting Started
You can build great websites with everything that comes with processwire. If you need something more special there are almost always free modules available. I built all of my websites without any pro modules. Until now.... I thought I might give it a try ? the repeater matrix pro module is a really sophisticated way to add/manage content on pages. Creating forms can be a bit tricky though - there is no form editor or whatsoever included so I would advice you to give Pro Forms a try. Otherwise you would have to hard-code the forms or use the processwire API to create them. As long as there is only one simple contact form on your page I would try to code it myself in that case. -
@bernhard So far I want to make use of the livereload feature only. I installed the module and set the reloading in my config file: $config->livereload = 1; But now it keeps reloading the page in intervals of 1 second continuously even when there are no changes made. Can you explain why this is the case?
-
Get children of a page but start at a certain index
Stefanowitsch replied to Stefanowitsch's topic in API & Templates
Is there a way to set page fields to "hidden" or "readonly" in the backend? Just curious... However. my personal solution for this was to write a cronjob that runs on the 1st day of every month and simply sets the status of the previous month page to "hidden". In that case those months won't show up in the sub navigation. The events will later be updated on a 3-month basis, so I think it's okay to let the user create those "month" pages and populate them with events manually. -
Get children of a page but start at a certain index
Stefanowitsch replied to Stefanowitsch's topic in API & Templates
Well, yes and no ? I love (!) Bernhards work but I just stick to my solution for now. If you take a closer look at the page structure in the backend here, I think no one can't deny that this is easier to maintain than having all event pages underneath a single parent. I am thinking about the client who has to do the content work at the end... From a technical perspective this is also convenient, because you can view all events of a specific month directly via URL, like www.mysite.com/programm/2022/august/ Otherwise I would have to make use of URL segments to make the filtering happen. -
Get children of a page but start at a certain index
Stefanowitsch replied to Stefanowitsch's topic in API & Templates
IMHO creating the events on a "month-page-basis" makes the organization much easier. The client has about 120 events per year and some of them are recurring events on a weekly basis. So having all those events listed under a single parent would be too much. After two years there would be 240 events, because once an event as taken place the page is not deleted. I've got the filtering for upcoming events, events in a single month or past events set up and everything works great so far. For example the upcoming event selector looks like this (the event pages itself do have a date field of course). $events = $pages->find("template=event, date_event>=today, sort=date_event, limit=6"); The month subnavigation is the only thing that is missing so far. Right now I am thinking of putting a month-page to "hidden" to make it not show up once the month is over. In that case it would not show up at all in the subnavigation. -
I am working on a project wich includes a simple event list. In the backend the structure looks like this. The user can then create event pages under the corresponding month page: In the frontend I want to display a subnavigation of the upcoming events by month. Starting from the current month! So in this case starting at "August" to September, October, etc. This "month pages" only include a title field, to timestamp or whatever. I need a selector that filters the children of the year starting by an index - the index of the current month. I know that in the example above, August would have an index of 4 (because January - March are missing). But for now we can just ignore that. This selector here looks correct to me but it only displays "August" not the following months after that (September, October, and so on). // get all months starting at the current month $months = $pages->get("template=event-year, title=$year")->children("index>=4");
-
I think its perfectly fine to put those graphics inside an assets folder. I always hard-code things that usually never change during the lifespan of a website. For example footer address information, logos, social media icons, etc.
-
How Twig can improve your template structure
Stefanowitsch replied to MoritzLost's topic in Tutorials
I kbow it has not directly to do with the topic but thanks to your code examples I finally stumbled upon a solution to include php files with arguments! Like this: <? wireRenderFile('inc/project-data.php', ['data' => $page->project_data]); ?> I've been using Processwire for years and always looked for a method like that. Crazy... I used PHP functions in that case - until now. It's time to update my projects ?- 11 replies
-
- 1
-
-
After a long time of concept work and a (not) so long time of development I launched a new website: https://www.marvin-wieckhorst.de Beware: German Language ? The whole site consists of 5 pages only. But the pages on this one are huge and full of different design elements. I'm trying to split it into interesting screenshots here but I think it's best if you visit the site and have a look at it by yourself. Here are some pictures, the tech talk section is below. Introduction with large images and catchy headlines on each page: Different teaser elements: Rocket animation with some vector images: Custom build ajax forms for the booking of the different training packages. These forms are presented in a modal. These forms are feeded directly from the backend via my custom form solution: Tech Talk: Well first a bit of design talk. Concept and design was the greater challenge than the later development. The customer had very clear expectations of what the different design elements should look like. So the real challenge was to get all the ideas right and put into a working design that does not look too overwhelming and convoluted in the end. PLUS it had to be responsive of course. Fitting giant design elements full of content that look awesome on a 2560 x 1440 display are difficult to handle on an iPphone display. Used Modules: I always try to use at few modules as possible. No pro fields were used on this one. Everything you see was build with the tools that Processwire offers out-of-the box or which is are in the core ? However some modules are just a must have in my opinion and there is what I used (and use in all my other projects aswell): - AOIM+ for bundling and compressing of JS+CSS - WireMail SMTP for all mail work - SEOMaestro - PageImageSource for WEBP image support - TracyDebugger For the frontend work I am using good ol' Bootstrap 4. Basically because of the excellent grid system / frontend forms and form validation / modals. Most else Bootstrap offers is not included in my build. All other frontend elements are custom. Plugins i used: - aos.js for all animations - lazysizes.js - owl carousel - masonry.js - niceselect for the custom dropdown menus inside the modal form There is also a video player included the the videos for this site are not produced yet. All together I get a really nice lighthouse score for the site: That's it for now. Have a nice week!
-
I like the idea of having a cronjob for fetching data. I also used this technique in an actual project (that I will introduce here when its finished!) but there was no external API involved.
-
Fascinating! Can you explain how you approached the API Data fetchig? Do you use a simple Ajax Request when filtering items or are you actually creating pages, populated with data and use those instead? I am always interested in methods to "feed" processwire from outside nowadays.
-
Sort and Filter Combined in URL query (Separate inputs)
Stefanowitsch replied to Liam88's topic in Getting Started
I might get into the same "issue" in a project I am working on. If I find a solution I will inform you here ? -
Timestamp value of date field always -1 day in the past
Stefanowitsch replied to Stefanowitsch's topic in General Support
I found the reason: https://www.php.net/manual/en/datetime.construct.php The $timezone parameter and the current timezone are ignored when the $datetime parameter either is a UNIX timestamp (e.g. @946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00). So thats why i get the wrong date when using this code here (my timezone gets ignored) <? echo IntlDateFormatter::formatObject( new DateTime('@' . strtotime($page->testdate)), "dd. MMM", 'de_DE' ); ?> Even when explicitly setting the timezone inside the DateTime object constructor it gets ignored. -
I am bootstrapping processwire in a php file for cronjob purposes. Everything works fine, I can output all the data from fields that I like. What confuses me: I have a datetime field. When displaying the field value in the bootstrapped file, I only get the timestamp of the selected date. When displaying the same field value on a page inside of processwire the field value is a formatted date. Can somebody explain to me why this is the case and to get around this (without date formatting).
-
Timestamp value of date field always -1 day in the past
Stefanowitsch replied to Stefanowitsch's topic in General Support
My config.php looks like this: $config->timezone = 'Europe/Berlin'; setlocale(LC_ALL, 'de_DE.utf8', 'de_DE'); I edited the json file in the Backend (with: de_DE.UTF-8). The timestamp looks like this: 1654898400 When examining this timestamp I get both dates: GMT: Friday, 10. June 2022 22:00:00 Your time zone: Samstag, 11. Juni 2022 00:00:00 GMT+02:00 DST It seems that I just ignored that fact that there are two dates shown (always look at the first one). My $page->testdate field outputs the date like this: 11.06.2022 So this outputs the right date (11. Juni): <?= strftime("%e. %B", strtotime($page->testdate)); ?> My problem is that this is deprecated in the future and the new way to do this looks like this: <? echo IntlDateFormatter::formatObject( new DateTime($page->testdate), "dd. MMM", 'de_DE'); ?> This also outputs 11. Juni (correct) But when using the timestamp I get the wrong date: <? echo IntlDateFormatter::formatObject( new DateTime('@' . strtotime($page->testdate)), "dd. MMM", 'de_DE' ); ?> This outputs 10. Juni -
I was upgrading some date formatting code lines in my projects and noticed a strange behaviour. I have a date field in the backend which is a classic processwire datetime field. In this field I can set - for example - an event date. For date selecting I am using the HTML5 Datepicker option in the field settings. Besides that I changed none of the fields settings at all. To display this date in the frontend all i do is: echo §page->event_date; However - I need to format this date in multiple ways throughout the whole site. So I need a unix timestamp (for localization of the date). strtotime($page->event_date); When I check the timestamp that comes out - it is always exactly 1 day before the date that was set in the date field. So when selecting "08.06.22" in the date field, the timestamp says "07.06.22" When I format the date -based on the timestamp- to make it human-readable again I can confirm that the new date is one day in the past... How is this possible?
-
So i tried the other way around and formatted a date using the IntlDateFormatter. This thread helped me find my way: https://stackoverflow.com/questions/71874030/local-language-without-strftime-deprecated-but-with-date So imagine we want to output "today" like this (formatted for german) Mittwoch 8 Juni 2022 This was the old way to to it: echo strftime('%A %e %B %Y', strtotime('now')); Since this will be deprecated in PHP 8.1 and removed in PHP 9 now we have to make use of this instead: $fmt = new IntlDateFormatter('de_DE', IntlDateFormatter::FULL, IntlDateFormatter::FULL ); $fmt->setPattern('EEEE d LLLL yyyy'); echo $fmt->format(strtotime("now")); The only thing that freaked my out about this was the weird formatting pattern. At first sight it makes no sense (to me), but the ICU documentation offers a big list of available options for formatting the date in any way you could imagine: https://unicode-org.github.io/icu/userguide/format_parse/datetime/ If you are looking for a "one liner solution" then this seems to be the right way (https://stackoverflow.com/questions/12038558/php-timestamp-into-datetime) echo IntlDateFormatter::formatObject( new DateTime('@' . strtotime("now")), "EEEE d LLLL yyyy", 'de_DE' ); EDIT: Beware that timezone settings get ignored when you work with timestamps. This might get you into some trouble. My solution was to format the timestamp into a date string: echo IntlDateFormatter::formatObject( new DateTime(date("d.m.Y", $timestamp)), "EEEE d LLLL yyyy", 'de_DE' );
-
I have no take on this (yet!) but since I am using the strftime function a lot I better get used to a solution for the future. The library you postet here https://github.com/alphp/strftime looks promising enough, the "old" strftime code needs to be altered just with the locale and it works good for me: <?= strftime('%e. %B', strtotime('now'), 'de_DE'); ?> The "offical" solution seems to use the IntlDateFormatter::format, but I find the usage is nowhere as straight forward as with strftime... https://www.php.net/manual/en/intldateformatter.format.php
-
I was in the need for using this module together with background images too - but in the "classic" way without any components. I am using the famous Lazysizes JS Plugin for lazyloading the images. To create responsive background images with the PageImageSouce module I also included the lazysizes bgset extension So the code in my template file looks like this: <div class="img-title-wrapper lazyload" data-sizes="auto" data-bgset="<?php echo $image->size($imgFormat)->srcset() ?>"> /* your content */ </div> The wrapper element then gets it's height either via CSS (height: 100vh for a big introduction title image) or through the elements inside the container. Adjust the background image styles to your needs (e.g. background-size:cover).
-
Wuppermann Group | Corporate Website | Relaunch
Stefanowitsch replied to olafgleba's topic in Showcase
Ah okay. I do not use the ProField Modules. That's a really cool feature, though. -
Wuppermann Group | Corporate Website | Relaunch
Stefanowitsch replied to olafgleba's topic in Showcase
Really cool design! I love the content module solution. I build something like that my own by using nested repeater fields... but can you tell me how you realized that good looking "Select type to add..." popup? -
Most of the time its the smallest things that cause the biggest problems when going "live" with a site ? That is the usual way I do it (and I think most of developers do): 1. Export your local database 2. Create a new (empty) database on your live server and import the database there 3. Upload all project data from your local directory to the live server via FTP 4. Adjust the config files for the new database connection 5. Testing with debug mode enabled