Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/03/2022 in all areas

  1. This week we've got a new core version on the dev branch, version 3.0.208. This version includes 15 new commits with a combination of issue resolutions and new features. See the dev branch commit log for full details. In addition, we have new versions of the following ProFields modules: FieldtypeTable, FieldtypeTextareas, FieldtypeMultiplier and FieldtypeFunctional. (Last week a new version of FieldtypeCombo was released as well). These are all posted in the ProFields downloads thread. These versions all add support for the new InputfieldTinyMCE module, in addition to other regular improvements and updates. I think that completes the list of modules I've developed that needed an update to support InputfieldTinyMCE. Speaking of InputfieldTinyMCE, it also received updates this week, primarily focused on resolving reported issues. Thanks for reading and have a great weekend!
    7 points
  2. A few months back I had the urge to try a lot of new things and one thing was a SSG (static site generator) called 11ty.dev and there was one channel and one website that made it super easy to start. https://www.youtube.com/@11tyRocks/videos https://11ty.rocks/ I liked it because it showed everything from start to "sure you can build an app with that". What I want to say is that even guides on how to install ProcessWire, make it more secure, or about hooks or how to "write your own module" would make perfect sense. There is more than enough courses could cover. As already mentioned... there are few bits and pieces out there, most of them are quite outdated or at least the ProcessWire backend already looks totally different which makes it awkward in some kind to watch those videos. A new fresh approach sounds really good. There are tons of topics your course or maybe even courses could offer and talk about. See @bernhard's videos. They are really great and in full detail while only talking about a specific module. Haven't thought it through but I personally would provide some basics at least (installation, file and folder structure, some best practices), then maybe something like building a blog or magazine (as mentioned already) and go from there. A blog could have a RestAPI, a custom RSS Feed, and, so, on... oh and there is always: SEO, Online Marketing and Affiliate Marketing. There could be courses about "Why ProcessWire is perfect for (or) How to do SEO, OM, AM with ProcessWire". Just outlined a few ideas out of my head. ProcessWire Basics Installation Security Migration Updates and Maintenance How to structure your project Dos and Dont's Import a HTML Template/Theme ProcessWire: Your First Real Project Blog/Journal/Magazine Member Area ProcessWire Advanced User, User roles, Access rights How to Hook How to Customize How to Whitelabel How to RestAPI/GraphQL ProcessWire as Headless CMS Use VUE, Angular, Svelte, AlpineJS with ProcessWire Your very first ProcessWire module How to structure your backend, fields and templates ProcessWire SEO PageSpeed Caching SEO-related Modules ProcessWire Setups Multi-User Setup Multi-Instance Setup Multi-Domain Setup ProcessWire Master Class ... ... ... My 2 cents for now.
    5 points
  3. With all the hype about ChatGPT, I wanted to see how useful it could be for us ProcessWire lovers. In a word: wow! It's pretty darn impressive for such early public testing and for such targeted subject. I love how it proposes code with comments, then proceeds to explain it. (Note: I've been getting more impressive and consistent results on mobile for some reason.) Prompt: Filter blog post by category in ProcessWire To filter blog posts by category in ProcessWire, you can use the find method of the $pages object, along with the category field and the equals operator, like this: // Get the category slug from the URL $category_slug = $input->urlSegment1; // Find all blog posts in the given category $posts = $pages->find("template=blog-post, category.slug=$category_slug"); // Loop through the posts and output their titles foreach ($posts as $post) { echo "<h2>$post->title</h2>"; } This code will find all blog posts that are in the category with the given slug, and output their titles. You can modify this code to output other information about the posts, such as their content, images, or dates. To make it easier for users to filter posts by category, you can also create a navigation menu that lists all the available categories, like this: // Find all categories $categories = $pages->find("template=blog-category"); // Output a link for each category echo "<ul>"; foreach ($categories as $category) { echo "<li><a href='/blog/$category->slug'>$category->title</a></li>"; } echo "</ul>"; This code will find all blog categories and output a link for each one, using the category slug as the URL parameter. When a user clicks on a link, they will be taken to the blog page with the posts filtered by that category. Prompt: Login form in ProcessWire To create a login form in ProcessWire, you can use the following code: // Check if form has been submitted if ($input->post->submit) { // Sanitize user input $email = $sanitizer->email($input->post->email); $password = $sanitizer->text($input->post->password); // Check if user exists and password is correct $user = $users->get("email=$email"); if ($user && $user->matches($password)) { // Login user $session->login($user); // Redirect to home page $session->redirect("/"); } else { // Output error message $error = "Invalid email or password."; } } // Output login form echo "<form method='post'>"; echo "<label>Email:</label>"; echo "<input type='email' name='email' value='$email'>"; echo "<label>Password:</label>"; echo "<input type='password' name='password' value='$password'>"; echo "<input type='submit' name='submit' value='Login'>"; echo "</form>"; // Output any errors if ($error) { echo "<p class='error'>$error</p>"; } This code creates a login form that accepts an email and password. When the form is submitted, it checks if a user with the given email exists, and if the password is correct. If the email and password are valid, it logs in the user and redirects to the home page. If the email and password are invalid, it outputs an error message. Prompt: User registration class in ProcessWire with email, password of at least 10 characters and age over 18. Check if email is unique. To create a user registration class in ProcessWire with email, password of at least 10 characters, and age over 18, you can use the following code: class UserRegistration { public function register($email, $password, $age) { // Sanitize user input $email = $sanitizer->email($email); $password = $sanitizer->text($password); $age = (int) $age; // Validate user input if ($age < 18) { $errors[] = "You must be over 18 to register."; } if (strlen($password) < 10) { $errors[] = "Your password must be at least 10 characters long."; } if ($users->get("email=$email")) { $errors[] = "A user with this email already exists."; } // If no errors, create user account if (!$errors) { // Create new user $user = new User(); $user->email = $email; $user->password = $password; $user->age = $age; // Save user to database $user->save(); // Redirect to confirmation page $session->redirect("/confirmation"); } } } This code creates a UserRegistration class with a register method that takes an email, password, and age as arguments. The method sanitizes and validates the input, and creates a new user if the input is valid. It also checks if a user with the given email already exists in the database, and outputs an error if one does. To use this class, you would first instantiate it: $registration = new UserRegistration(); Then, you can call the register method to create a new user: $registration->register($email, $password, $age); Prompt (similar to previous one): User registration form in ProcessWire with first name, last name, email, password of at least 10 characters and age over 18. To create a user registration form in ProcessWire with first name, last name, email, password of at least 10 characters, and age over 18, you can use the following code: // Check if form has been submitted if ($input->post->submit) { // Sanitize user input $first_name = $sanitizer->text($input->post->first_name); $last_name = $sanitizer->text($input->post->last_name); $email = $sanitizer->email($input->post->email); $password = $sanitizer->text($input->post->password); $age = (int) $input->post->age; // Validate user input if ($age < 18) { $errors[] = "You must be over 18 to register."; } if (strlen($password) < 10) { $errors[] = "Your password must be at least 10 characters long."; } // If no errors, create user account if (!$errors) { // Create new user $user = new User(); $user->first_name = $first_name; $user->last_name = $last_name; $user->email = $email; $user->password = $password; $user->age = $age; // Save user to database $user->save(); // Redirect to confirmation page $session->redirect("/confirmation"); } } // Output registration form echo "<form method='post'>"; echo "<label>First Name:</label>"; echo "<input type='text' name='first_name' value='$first_name'>"; echo "<label>Last Name:</label>"; echo "<input type='text' name='last_name' value='$last_name'>"; echo "<label>Email:</label>"; echo "<input type='email' name='email' value='$email'>"; echo "<label>Password:</label>"; echo "<input type='password' name='password' value='$password'>"; echo "<label>Age:</label>"; echo "<input type='number' name='age' value='$age'>"; echo "<input type='submit' name='submit' value='Submit'>"; echo "</form>"; // Output any errors if ($errors) { foreach ($errors as $error) { echo "<p class='error'>$error</p>"; } } Watch out, this is addictive 😃
    4 points
  4. Short answer is "no", at least not for now 🙂 SE populates a search index for a piece of content (page) and compares provided query string against said index. It's a tool for handling "regular" site search, from indexing to front-end rendering. The index is a textarea field, so complex queries (advanced text search) and a few special cases ("link:https://www.processwire.com") are supported, but the module has little to do with facets/filters. On a loosely related note, in recent projects I've been leaning towards implementing filters/facets on the front-end based on static data generated by the backend and cached on disk. The main reasons are performance and scalability: real-time search using ProcessWire can be pretty quick, but won't achieve the speed of a front-end only implementation. This is especially tempting approach when the amount of data is relatively small (i.e. you don't have to deal with tens of thousands of pages (or more) with numerous searchable properties each.) Which approach makes most sense — and how vigorously the search should / needs to be optimized — depends on the case at hand 🙂
    3 points
  5. 🚨 [[ UPDATE December 6, 2022 ]] 🚨 I prepared a small landing page to validate how many of you would be willing to take the course, so that we would have a rough estimate of how many people would be willing to take the course. 🔗 Show me your interest here 🔗 ------------------------------------------------------- Hello to the entire wonderful Processwire community! I am here to announce my willingness to create a video course for beginner/mid-level developers interested in learning more about the main aspects of our beloved CMS. I have been working with Processwire continuously for years now, so I feel confident that I can share what I have learned to other developers interested in becoming faster and more efficient in their day-to-day work. I have noticed that lately many people here in the forum have complained about a lack of material and tutorials for taking the first steps, and although so many resources are already present within the board, I understand how complicated it can be to be able to connect the dots and have a clear reference on how to get started or how to find clear answers in a short time. As you know Processwire is a very broad tool, very flexible and able to be adapted to any need, so it will not be possible to dissect every aspect in this course, especially the more advanced ones that can help in rarer cases (at least in my personal experience). 🎉 But don't worry, I plan to explain with many practical examples many tips and tricks that can help you in developing sites, even particularly structured ones! 🎉 So I am here to test your interest and ask you what aspects you would be most interested in me covering, even those related to design (css, scss, postcss, tailwind) or javascript libraries/frameworks integrations (vue, alpine.js, greensock for animations,etc.). My idea would be to create together a magazine with a restricted area for users, newsletter integration, catalog filtering according to different parameters (year, author, topics, etc.) and much more.💣 It will be a paid course, I have not yet decided what the price will be, but it will be affordable for everyone 👍. For a small period of time, I would be pleased if you would give me pointers and ideas, so I can see what your real interest is (if any!) and also motivate me 🙂 Let me know! Thanks! 🙏
    2 points
  6. This could possibly become a course all on its own, but there are often questions on how to manage navigational structures (header/footer/on-page) in ProcessWire. Covering how to (try to) plan around it, either based on the layout design, or based on the architectural design (or the client need?) are all potential topics. Sites with simple structures (and few templates) are usually fairly easy, but if you were to design a website for a university that holds many different departments all with unique needs and content, things can get quite complicated; often times there is the primary navigation, a sub-navigation (that may break into child-navigations per department), and custom footer navigation areas per section! If aimed at beginners, something that should likely be covered early on is templates/themes and ProcessWire's Site Profiles, and how unlike other solutions, downloadable site profiles contain not only the layout and design, but also the underlying architecture and fieldtypes, so switching templates is not (currently) a thing with ProcessWire. (We'd need something like WordPress' various theme builders [ex: Divi] where it's a theme framework, so the framework is the profile, and themes/templates/styles could be swapped within the framework...we just don't have that [yet?] for ProcessWire.) ...oh, and also that files and images are associated to the pages they were uploaded to (instead of a centralized media manager, unless one is setup [through a page] in your magazine website example). Also of note, and this took me awhile too: It's "ProcessWire", not "Processwire". 😅 I'd probably sign up just because I enjoy taking courses. You can always learn something new. Video courses are a lot of work (to keep updated) so I wish you the best of luck on this!
    2 points
  7. Sounds great. There are some PW video tutorials out there. But nothing structured or consistent like you are planning to do. Do you mean that others can contribute videos as well? You could use a platform like https://www.codecademy.com/ to publish your courses. Will propably reach a broader audience than a custom made solution. concept of "everything is a page" structuring content working with templates/fields in the admin different output strategies: delayed, MarkupRegions etc PW as headless CMS with https://processwire.com/modules/app-api/ or https://processwire.com/modules/process-graph-ql/ I wouldn't concentrate too much on that because there are tons of tutorials out there already and PW is flexible enough to let devs implement frontend stuff in so many ways. But the basics of where you can place your source files, and how to include assets in template files might be helpful. Go for it and good luck!
    2 points
  8. Media Manager Released 31 March 2016 https://processwireshop.pw/plugins/media-manager/ Documentation http://mediamanager.kongondo.com/ As of 10 May 2019 ProcessWire versions earlier than 3.x are not supported ******************************************************* ORIGINAL POST ******************************************************* API Example (frontend; will be added to documentation site) Accessing and outputting the contents of the MediaManager field(s) in your template is quite simple. The fields are accessed like many other ProcessWire fields. The fields return an array of type MediaManagerArray that need to be looped to output each media within. Assuming you created a field of type MediaManager named 'media', you can loop through it for a given page as shown below. @note: Each MediaManager object has the following 5 basic properties: DATABASE (saved properties) 1. id => pageID of the page where the media lives (hidden in admin and not important to know about) 2. type => integer denoting media type (1=audio; 2=document; 3=image [for variations this will be 3x, where x is the number of the variation of an original image]; 4=video) RUNTIME 3. typeLabel => user friendly string denoting media type (audio, document, image, video) 4. media => a ProcessWire Image/File Object including all their properties (ext, filesizeStr, height, width, description, tags, filename, basename, etc.) 5. title => title of media (@note: this is the title of the page where the media lives; may or may not be the same as the name of the media file itself). This can be used as a user-friendly name for your media $media = $page->media;// returns a MediaManagerArray. Needs to be looped through foreach ($media as $m) { echo $m->id;// e.g. 1234 (hidden page in /admin/media-manager/media-parent/) echo $m->type;// e.g. 3 (a media of type image) OR 1 (a media of type audio) echo $m->typeLabel;// e.g. 'document' (i.e. type would be 2) echo $m->title;// e.g. 'My Nice Trip' (whose media file could be my-nice-trip.mp4) /* @note: - $m->media returns an object; either a ProcessWire Image (for image media) or File object (for audio, document and video media) - This means you have access to all the properties of that object, e.g. ext, tags, description, url, filename, basename, width, height, modified, created, filesize, filesizeStr, etc as well as associated methods, e.g. size() */ echo $m->media->tags; } // only output images foreach ($media as $m) { if($m->typeLabel =='image') { echo "<img src='" . $m->media->size(100,75)->url . "'><br>"; } } // There's also a toString() method so you can do: echo $page->media; /* All your media will be output wrapped in appropriate HTML tags, i.e.: audio: <audio></audio>; document: <a></a>; image: <img>; video: <video></video>; */ ******************************************************* ORIGINAL POST ******************************************************* The topic of a central media manager feature for ProcessWire has come up several times: https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/ https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/?p=42578 https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/?p=42582 https://processwire.com/talk/topic/425-file-manager/ https://processwire.com/talk/topic/425-file-manager/?p=13802 https://processwire.com/talk/topic/425-file-manager/?p=13861 https://processwire.com/talk/topic/10763-asset-manager-asset-selector/ More recently, regarding my Visual Page Selector module, I have been asked several times why the module does not have an in-built feature to upload images. There's two camps on the topic of a central media manager: those who like them (especially those coming in to PW from other CMSes) and those who don't like them (primarily because of the chaotic way some CMSes (dis)organise their media management) . I think that we can have our cake and eat it too! If done the right way, closely following the principles of and harnessing the power of ProcessWire, we can have a well-implemented, organised, feature-rich, site-wide media manager. Introducing Media Manager: (a commercial module) Alongside a number of modules I am currently working on (both free and commercial), I have been developing a centralised Media Manager for ProcessWire. Before you cast the first stone, no, this is not going to be a one-large-media-bucket as in other CMS where it gets very messy very quickly . In the backend things are neatly stored away, yes, in pages. However, those are pages you will not see (just like repeater pages). Before anyone has a go at pages, remember a page is not that thing you see on the ProcessWire Tree (that's just its visual representation); A page is a record/row in the database . For the end-user of Media Manager, all they will see is the 'familiar media bucket' to select their media from. As long as it works efficiently, I don't think they care about the wizardry behind the scenes . The module allows for the comprehensive management of several media types: Audio Video Images Documents Each media type will be handled by its own sub-module so the user can pick and install/choose the type of media management they want. Features include: Access controls Centralized uploads of media Bulk management of media: tag, delete, describe, replace, etc. Bulk upload: zip; scan, single Quick upload in page edit mode Usage stats across pages (maybe?) Etc.. Would love to hear your thoughts and any feature suggestions. I think there's enough demand for such a module. If not, please let me know so that I can instead focus on other things , thanks. How other CMS do it The more efficient (PW) way of doing it
    1 point
  9. Thank you very much Teppo, it worked fine.
    1 point
  10. Hey @Sten, Sounds like your field (moment) may be configured to output a date that strtotime doesn't understand. You could test by seeing what "echo $event->moment" returns; is it "2023-04-03 18:30:00" or something else? Anyway, one way to resolve this would be to replace "$moment=strtotime($event->moment)" with $event->getUnformatted('moment'). This will return a timestamp, so strtotime is no longer required.
    1 point
  11. I once added a field to my repeater-fields to switch files. It was called something like "theme" or "style" and when something was selected in it, I just took the value, pointed it to the "new" layout/render file and went from there. So... in some kind an alternate render file, yet controllable.
    1 point
  12. Exactly what I neded it works great now thanks for helping 😉 yes the url to the file is in js so not sure how to call it outside of the foreach for each link (if u know what I mean). With the changed ID (above) it is now working great. Not sure if it is the best way but, no problems so far. R
    1 point
  13. Hello @szabesz! I recently implemented this feature for a project done for a client, and I am very pleased with the result. Unlike how Ryan did it for the Skyscrapers profile I used ajax (through js's native fetch() functionality) to communicate with the filtering logic. It works very well and is very versatile. It will definitely be a topic of discussion. 💬 Why not? It is one of several alternatives and/or combinations for categorizing data along with Page Referece Fields (they can also be used together). I will take this into consideration! ✌️ @gebeer It is indeed and it's going to be treated with proper attention 🙂 ...and yes, I'm using some Emoji's to grab your attention too (I usually don't) 😺
    1 point
  14. Frontend forms in general would be a good topic. There's so much to find scattered around the forum but still people seem to struggle with it, especially when it comes to frontend file uploads with WireUpload.
    1 point
  15. Hello @3fingers, +1 to this approach. What I think nowhere demonstrated in a nice and concise tutorial is the broad topic of search. One can take a look at Ryan's Skyscrapers demo profile but other than that there are just scattered bits of info on the topic. There is also @teppo's SearchEngine but that is a 3rd party module and I am not sure it can be used for Faceted Search or not, for example. With all that ecommerce raging these days, showing how to implement Faceted Search would be invaluable (along with listing products, sortable by categories), I think. Also, frontend autocomplete is another valuable topic, and what I have not yet tried but looks useful to build upon is InputfieldTextTags: https://processwire.com/blog/posts/pw-3.0.177/ See this related quote from Ryan: "...InputfieldTextTags works on the front-end, such as in FormBuilder or LoginRegisterPro forms, or any other InputfieldForm on the front-end." I have done some of the above over the years (built on ProcessWire of course) and I had to dig up ideas from source code of modules and from this forum of course. However, a guided tour can always speed up the learning process. Good luck with your endeavor!
    1 point
  16. The fieldtype repeater module is a core module and located under https://github.com/processwire/processwire/tree/master/wire/modules/Fieldtype/FieldtypeRepeater It should not be in the site/modules folder, you can just install it under Modules => Core.
    1 point
  17. v2.9.0 adds support for rfShrink() 😍 div { border: rfShrink(20px, 5px) solid red; } which means 20px border @ 375px viewport and 5px border @ 1440px viewport and fluid in between. div { border: rfShrink(20px, 5px, 600, 1000) solid red; } 20px@600 / 5px@1000
    1 point
  18. Hi @kono, Echoing the field ?. Media Manager field has as toString() method. <?php namespace ProcessWire; // toString() echo $page->name_of_your_media_manager_field; The above will render each item in the media manager field according to its type, i.e. audio (audio player), video (video player), image (thumb 400px wide, height auto) or document (file name with URL - viewable in browser or downloadable depending on document extension) Please see the docs here. Hope this helps.
    1 point
  19. Yes. It is a good idea, especially if you want to take advantage of newer features. I am not saying it is the reason for the errors you are experiencing. ProcessWire tends to be very stable across versions. It could be a case of Media Manager using one of the newer ProcessWire features. Upgrading ProcessWire is mainly a matter of swapping out /wire/ with the current latest one. However, some files such as index.php, .htaccess might also need overwriting with their latest counterparts. However, just in case something went wrong, it is a good idea to create a database backup of your site in case you needed to roll back. In the case of Media Manager itself, if you have implemented lots of changes and uploads, you might want to back those up. However, if you don't mind losing these (since you are still experimenting), I'd start from scratch. As for the Media Manager files themselves, the ProcessWire upgrade will not affect them. However, to ensure a fresh start, it is better to fully uninstall Media Manager, then upgrade ProcessWire. In summary: Create a whole site backup (e.g. using ProcessDatabaseBackups or some other database tool). Completely uninstall Media Manager. Upgrade ProcessWire. Please see the docs here. If the upgrade goes OK, do a module refresh on the site. Install & enable Tracy Debugger (if you don't have it already). Re-install Media Manager. Test Media Manager features. Please let me know how it goes.
    1 point
  20. this looks great kongondo! have you thought about implementing the blueimp file uploader to it? it has built in preview (at least for mp3 and images) and supports client side image resizing. that's one thing i am missing most when it comes to image galleries! looking forward to trying this module
    1 point
×
×
  • Create New...