Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/03/2021 in all areas

  1. Let's start from here: No. you don't have to use Alpine.store(). However, store comes with some advantages as explained here and here. I prefer to use the store, maybe due to vuex influence. Not sure. When do you want to release it? Soon? Then I'd release it and refactor it later. A potential challenge here is that you may not find the time 'later' to refactor it ?. Do you have to use Alpine JS? No you don't. Personally though, I will be removing jQuery from everything I've built. It will take time though. This has nothing to do with the new tech such as Alpine really, but I now prefer to use vanilla JS and/or Alpine/Vue, etc. Modern vanilla JS syntax is just clearer to me. Anyway, I digress. Using reactive frameworks, you would have at least two options: #1. model the value: E.g. v-model or x-model in vue and alpine respectively. This two-way data bind means you don't have to listen to the on change event. That will be taken care for you, unless you also want to listen to the event and do something based on that. This approach will also trigger changes in other areas of the app that depend on the changed value. Your data will be changed (instead of the input value) and behind the scenes vue/alpine will change the value of the input for you. Everything stays in sync. By the way, if you want one-way bind, have a look at x-bind:value #2. on:handler: You handle the event yourself. E.g. with Alpine, @click='doSomethingWithClick' or x-on:click='doSomethingWithClick'. In this case as well, the idea is generally to modify your data based on some event INSTEAD OF modifying the input value directly based on the event. If you modify the data, you are back to #1, where everything is synced for you. Using Alpine, you won't need to work with the JSON object. You will be working with JavaScript objects, arrays, bools, etc. You won't have to do this. If modelling your data (x-model) to inputs, Alpine will update your data for you automatically. Your work will be to validate values and check other app states if required. This is very easy to do with Alpine/Vue. Just use an @click handler and handle that. I could give you a basic example but I would prefer to see your use case/code example as you might not need the click handler at all. As mentioned above, you don't have to do this yourself. Let x-model take care of it for you. When the form is saved, it will save with the modelled values. E.g. <input type='text' name='your_name' x-model='person_name'/> In the above example, when you type into the input box, Alpine will update the value of person_name to what you input. If you want to see it live as you type, you could do: <input type='text' name='your_name' x-model='person_name'/> <p x-text='person_name'></p> The text inside the paragraph will be synced to and output the current value of 'person_name'. I would need to see this in action to get my head around how you would model it in Alpine ?. Data You have a number of choices to pass your data from ProcessWire to your Alpine app. $config->js If your data was static, you could use ProcessWire's config->js to get it populated in the browser. E.g, send the current page ID or the URL to some backend API, etc. You could then access these in your JS code/Alpine as, e.g. // configs object const configs = ProcessWire.config.InputfieldPageBuilder Inline Script You can have your inputfield, in render(), output inline script that has your data. This is useful if you data is dynamic. You can see this usage in ProcessWire, e.g. in InputfieldRepeater. E.g. <?php // e.g. inside ___render() $data = ['age' => 24, 'gender' => 'female', 'department' => 'design']; $out = "<p>Some Inputfield Render Output</p>"; $script = "<script>ProcessWire.config.InputfieldPageBuilder = " . json_encode($data) . ';</script>'; $out .= $script; return $out; You can then access access the data as in the configs object in JS above. Inline x-data Attach your data directly to the x-data value in ProcessWire markup. JSON or 'object' (e.g. a string that resembles a JavaScript object) both work. <?php $json = json_encode(['age' => 27, 'gender' => 'female', 'department' => 'ai']); $out = "<div x-data='{$json}'><p x-text='age'></p></div>"; return $out; In all of the above, you don't need this: Or this: Is there a reason you are using Alpine as a module here? I'd probably send this data to the browser using an inline <script> instead of as a value of '#Inputfield_pgrid_settings'. Just makes life easier. I would then set the data as a property in my Alpine.data() or in Alpine.store(). Quick Tips If using $store inside a ProcessWire module, I create a class property and set my store value to it. Then, I only have to call it like this where I need it: $this->xstore. Saves with typing plus change it once, change it everywhere. In JS, I use getters and setters, either separately or combined into once function to handle data and store values. Saves from typing this.$store.mystore.settingsData.someValue = 1234, all the time. E.g. // below could be converted to single getter/setter methods // could also be adapted to handle nested properties or create separate methods for such setStoreValue(property, value){ this.$store.mystore[property] = value; } getStoreValue(property){ return this.$store.mystore[property]; } Hope this helps.
    3 points
  2. You can find plenty of great free resources on the web to learn PHP but I think @wbmnfktr is right that some kind of upfront investment (either time and/or money) in learning the basics of PHP will help you a lot for working with ProcessWire ? 15 min: https://www.youtube.com/watch?v=ZdP0KM49IVk 5 hours: https://www.youtube.com/watch?v=OK_JCtrrv-c
    2 points
  3. I am by no means an expert on this area (IANAL etc. ?) but this is worth checking out: https://ec.europa.eu/commission/presscorner/detail/en/ip_21_2847. While privacy shield is no longer applicable, standard contractual clauses still are. As such, I wouldn't completely rule out a company with non-EU presence. Most email service providers have comprehensive GDPR info available, and most of them also seem to provide a DPA (data processing agreement/addendum) for their clients, at least on request. Anyway, just my five cents. Of course when in doubt, it's a good idea to consult lawyer. Preferably one with experience in GDPR and Internet privacy ?
    2 points
  4. I developed the new Geffen Playhouse website over the course of 2018/2019 and launched it in September 2019. It has been perhaps the largest project I have been involved in. The Geffen Playhouse went through an entire re-branding done by Base (including a custom font), and I worked with Teak on the new website. Website https://www.geffenplayhouse.org/ Wikipedia https://en.wikipedia.org/wiki/Geffen_Playhouse Base write-up https://www.basedesign.com/work/geffen-playhouse-always-geffen-playhouse-always-new Teak SF write-up https://teaksf.com/work/geffen-playhouse-ticketing-ecommerce-website-design/ Another write-up: https://www.laurentakayama.com/geffen Their previous website was severely antiquated and it wasn't a responsive website (as of 2019!). Instead, it forwarded mobile users to a "mobile-friendly" website on a different subdomain, which I think was hosted by a third party service. However the data containing all the actors, shows, seasons, news and press articles were all in there. So one major aspect of this website was de-duping and importing their data into ProcessWire, along with some post-import cleaning… that's ~25 years of data. The site is built with UIkit 3 for the most part, and also uses FullCalendar for the large and small calendars. There is a custom integration with AudienceView, their ticketing system, which is used to import all the performance showtimes of their shows into ProcessWire. It's not the easiest API to work with (XML), but I eventually got it working. Repeater Matrix is being heavily used for section-based page building. Building out all the necessary matrix types took a long time as there was quite a bit of thinking what types and layouts we needed as we went along. However the end result has given the editors a lot of flexibility. ProCache is being used as well, including a CDN for all assets. This is crucial because when opening season sales are announced, the site gets slammed, but with caching turned on, it's not a problem anymore. On a deeper level, the site uses my new (well 2 years old now), universal and very opinionated base module that provides a menu builder, a standard set of fields/templates/pages, and a bunch of other tweaks that I tend to use on every site. All the fields, templates and pages are set up in a streamlined and editor friendly way. I wasn't able to access their previous CMS backend for various reasons (I only got the MySQL dump), so when developing the site and data model in ProcessWire, I was able to completely re-envision the editor experience and the data model without bias. A quote from one of the marketing directors at Geffen Playhouse: "We absolutely love ProcessWire." More details on my personal website: https://jonathanlahijani.com/projects/geffen-playhouse/
    1 point
  5. Hello. I've setup a page (without a php file) based on a template with some fields. I am able to render the text fields content from another page (an included php file): $pages->get('/general-information/')->phone_number However, I am unable to render the image field content $pages->get('/general-information/')->front_image->url I got an error message (method call on null) The image field is set to allow only one value, and to allow html entity characters
    1 point
  6. <?php // site/ready.php $wire->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments(0); $page->title = date("Y-m-d H:i:s"); }); Start with that hook, save the page and see the page title being updated. Then add conditions step by step (eg checking for template) and always check if the page title still updates when saving the page ?
    1 point
  7. Ok, that's interesting. Just gave it a quick look and have to look closer into this the next days but... well that could be a dealbreaker. Haven't had enough time for that. I just use it with WiremailSmtp and it works pretty well so far.
    1 point
  8. Hi @wbmnfktr, look here: https://dr-dsgvo.de/ist-mailjet-datenschutzkonform-nutzbar/ I don't know if this is a reliable source but sounds legit. And did it work for you with the WireMailMailgun?
    1 point
  9. A variable is something you store information in. It could be a string, an array, an object or something else in PHP. This is basic PHP knowledge, so maybe you should take a PHP course first. ? In my example the variable was just for demonstration that you could pass variables with the wireIncludeFile-function from "file-a.php" to "include-b.php". But you don't have to use it at all. The only difference is to write wireIncludeFile instead of include. Here is a comparison: <?php include("path/to/partial.php"); wireIncludeFile("path/to/partial"); But you can use the include-function if you want to, its just a matter of preference. ? Regards, Andreas
    1 point
  10. Sorry for interrupting the usual programm and topic here but... @franciccio-ITALIANO maybe you want to look up a mentor/tutor here that helps you to maintain and build ProcessWire sites from either the ground up or even to maintain already built sites. I know you from your past questions, requests and and posts in several other topics. As much as I want to see someone helping you... the more I think you need someone that's guiding you from the basics of PHP to the basics and fundamentals of ProcessWire to the state you can work out ProcessWire sites from each and every state and upwards. So... my questions for our awesome community is... who can help and assist @franciccio-ITALIANO to get to a state where he is able to maintain a basic ProcessWire-website? Native italian speakers (is this even the correct way to write this?) go ahead... and let us know. If there is noone who can assist... let me know @franciccio-ITALIANO... I'll put time aside to guide and assist you in some kind but in english. ;)
    1 point
  11. Missed the closing ?> after the php statement.
    1 point
  12. I prefer wireIncludeFile because of these points described by Ryan in his blog post: The foo variable is just an own variable you can pass and use in the included file. This way you can keep track where you added variables. Of course Markup Regions are also awesome and I like to combine Markup Regions with wireIncludeFile. I use Markup Regions for the whole blueprint of the templates and wireIncludeFile to split up large junks of code. Occasionally I use field templates for repeating fields markup. ProcessWire offers many ways to structure your code if you want to. ?
    1 point
  13. Is there a way to get this running with php 7.3? How can i upgrade the mpdf version? The files that i can download here https://github.com/mpdf/mpdf/releases doesn't look very much like the ones i got in my /site/modules/Pages2Pdf/mpdf folder. Or is this module not usable anymore? Thanks!
    1 point
  14. In my case everything was logged as expected. Each and every try was in the logs. The website was almost on point... maybe a minute or so off but yet... pretty good. Almost too good. But hey... perfect... it's working for you now. Awesome! Short update here: While SendGrid and the module work as expected I/we moved on using mailjet.de with WireMailSmtp. The project (as in "client") wants and needs to be perfectly fine with DSGVO/GDPR and therefore Mailjet was the better option. As they (client) send quite a huge amount of mails of any kind they were ready to pay one of their standard plans that should fit their needs. I disabled all tracking, opening and whatever options they offer in the settings as the project should create through all instances only a very small data footprint with as little data as possible. Right now the client and their "data and privacy" consultant are quite happy. So... if you are within the EU (or have been in there) look at mailjet. As Mailgun and Mailjet are somehow one company... I will play with the WireMailMailgun module in the next weeks. Maybe it works.
    1 point
  15. Hey @benbyf... I don't know if it's working now within your project... so I'll make it short: The module is working perfectly fine in my setup which is 10 minutes old and is running on PW 3.0.179. I just created an API key, limited it to just sending mails, put it in the module config and everything was fine - almost. The sandbox option prevents sending mails so it needs to be removed. I don't use any of the other options within the module expect logging. SendGrid tells you your usage (you fill find that link in the bottom of the sidebar) so you can check if something was sent. Another option is of course this gem here: https://processwire-recipes.com/recipes/logging-outgoing-emails/ (which is in place as well and logged all of my test mails).
    1 point
  16. I do it usually as follows: 1.) Create a file /site/translations.php <?php namespace ProcessWire; /** * TRANSLATABLE STRINGS * Define globally available translatable strings * * USAGE * place this file under /site/translations.php * __("My translatable string", $ferry); * The wire property $ferry refers to the textdomain of this file * */ __("My translatable string"); 2.) Define a wire derived object and place it in /site/ready.php /** * TRANSLATABLE STRINGS * Include translatable strings * @see /site/translations.php * @var $ferry */ $this->wire('ferry', '/site/translations.php', true); output in any template /** * output in template */ echo __("My translatable string", $ferry); Now you need to translate it only once, by using the string in any template. Usecase: strings like "read more" etc. For strings specific to a template you can use simply: /** * output in template */ echo __("My translatable string");
    1 point
×
×
  • Create New...