Leaderboard
Popular Content
Showing content with the highest reputation on 08/05/2021 in all areas
-
@jploch there's an error in your json. Close to the end: } } } }], "breakpointActive": "base", should be: } } }], "breakpointActive": "base",2 points
-
Hi, as a passionate PW user and web developer for small company websites I am searching for a video hosting solution which has a good playback performance and where I can host also large videos. Sure, we all know we can just upload videos to the PW backend and then implement it on the website. But - at least on the servers I am using - the playback performance is to weak (to much waiting time). And I am also sure we all know Vimeo (great playback performance). But as a developer coming from Europe who puts importance on respecting privacy laws (GDPR), Vimeo is not really a option for hosting your videos, since it is an US company. Therefore my question: Which solution do you use for video hosting? Do you know providers comparable with Vimeo (regarding price and performance) but coming from the EU? I know, video hosting is not necessarily a processwire related issue, but I hope you can help me though. Cheers!1 point
-
1 point
-
You have several possibilities depending on whether you are looping through items or whether you just needed a single item from your items. Here are examples of both scenarios. Inside a loop <div> <!-- getGridItems here is a function that returns the current grid items --> <template x-for="(item, index) in getGridItems"> <!-- bind id to item id and its text to item state --> <span :id='item.id' x-text='item.state' :key="index"></span> </template> </div> Get One Item Several possibilities here: // use filter and since expecting only one item, get it at the first array index const myItem = items.filter((item) => item.id === itemId)[0]; // loop let myItem; for (const item of items) { if (item.id === itemId) { // you have found your item myItem = item; // break out of your loop break; } } // find const myItem = items.find((item) => item.id === itemId); // do some sanity checks here before using myItem For more on loops and iteration, have a look at the Mozilla docs. Depending on the app you are building, you might want to keep a caniuse tab open ?. I see that you are storing tagName (div, etc), meaning you are creating elements on the fly? You can use vanilla JS for this or depending on the number of element possibilities (div, span, ...n), you could use a number of x-ifs. Note, though, that there is no x-else in Alpine. The flatter an object, usually the easier your work. However, sometimes this is not always possible. To access nested data, again, you have several options. You could create a function that returns the object property you want. You can also use either of brackets or dot notation (myItem.breakpoints.base.css.color). However these can get messy if the nesting is very deep. Maybe you could flatten the breakpoints object since really, it is all mainly CSS? It would make it easier to bind styles to an element.1 point
-
Have you tried this? <?php $_SERVER['X-Shopify-Topic'];1 point
-
Does this mean that you've got the __text() call directly in the template file, site/templates/sometemplate.php? If so, then it's likely the issue I mentioned in my previous post: if you use functional fields in any file other than the default template file, you'll have to select that file via field config "file mode" setting.1 point
-
Thanks Horst, that works! I need different sizes of the same crop to use in srcset for responsive images. I referred to this in your opening post:1 point
-
It finally worked. I don´t know how. I was setting permissions everywhere. But when I started revoquing unusual permissions again, trying to figure out the cause of the issue, I ended with the code still rendering the url. So I don´t know. Maybe a cache issue on the ProcessWire side. Anyway, thanks @Andy I appreciate your help.1 point
-
@CBE The method of accessing other pages certainly works. Perhaps you have an error somewhere or access to the page is denied. There is little information on this here. Try to break the task into steps, check it step by step. $my_page = $pages->get('/general-information/'); if($my_page){ $my_img = $my_page->front_image; if($my_img){ $my_url = $my_img->url; }else{ echo "Image not acces"; } }else{ echo "Page not acces"; } Or just see what PageArray returns to you $my_page = $pages->get('/general-information/'); if($my_page) print_r($my_page); // use var_dump($my_page) for bit more info1 point
-
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-c1 point
-
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.1 point
-
1 point
-
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, Andreas1 point
-
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
-
I made it work with the instructions in Github. $config->MarkupSocialShareButtonsServices = array( "example" => array( "example_url" => "http://exampleurl.com/", "example_params" => "?url={url}&description={text}", "example_icon" => "<img src='{themeUrl}png/example.png'>", ) ); Using: https://api.whatsapp.com/send?text={url} Thank you!1 point
-
This looks very interesting: https://cloudblogs.microsoft.com/opensource/2019/03/12/microsoft-open-sources-accessibility-insights/ You can find 2 tools: 1 chrome extension for Web, and 1 Windows App for WinProgs: https://accessibilityinsights.io/ And the GitHub Repo: https://github.com/Microsoft/accessibility-insights-web1 point