Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/18/2020 in all areas

  1. I agree that the concept of output formatting could be better documented - questions about it come up regularly in the forums. @ryan, it would be helpful if there was a page explaining output formatting in the "Getting started" documentation. The key thing to take onboard is that if you are going to be setting and saving values to a page, you must set output formatting to false before you do anything relating to that setting and saving. In your case, you are getting the value of a field that you will later modify... /* get the images object array for the Page */ $myPageImg = $page->images; ...before you have turned off output formatting for $page. If you do... /* get the images object array for the Page */ $page->of(false); $myPageImg = $page->images; ...then when you save $page, the changes you make to $myPageImg will be saved to the field value. Another thing: assigning a field value to a variable like this ($myPageImg = $page->images) when you intend to later modify that field value is probably not a good idea. You can get away with it for an images field because the value of an images field is an object, and objects in PHP are assigned by reference. But the same would not be true for any field whose value is not an object, e.g. a text field. When you assign the value of a text field to a variable you are assigning by value, meaning that changes made to the variable are not simultaneously applied to the field value. To illustrate... $page->of(false); $images = $page->images; // $images is an object assigned by reference $images->add('https://www.site.com/image.jpg'); $page->save(); // Changes to $images will be saved to $page->images $page->of(false); $headline = $page->headline; // $headline is a string assigned by value $headline .= ' foo'; $page->save(); // Changes to $headline will NOT be saved to $page->headline So in your case, there's really no benefit to assigning $myPageImg = $page->images near the start of your code - it just increases the chance of confusion. You'd be better to make changes to $page->images directly: //... $page->of(false); while($file_headers[0] == 'HTTP/1.1 200 OK'){ $page->images->add($file); $affixnum++; $file = 'https://www.site.com/pictures/' . $page->title . "_" . $affixnum . $extension; $file_headers = @get_headers($file); $page->save(); echo $file . " added. <br />"; } //...
    3 points
  2. @JeevanisM @LostKobrakai That doesn't mean you can't have search, but it would probably be in the form of an external service or a serverless function. Algolia is the go-to solution for client-side search. Basically, you send all your content to their API during the build step, allowing them to index it. Then you use their API or their InstantSearch component to perform searches against their index. The search results then take you to the canonical URL of that content.
    2 points
  3. Yes and no. It might pre-compile some pages like e.g. all the category listings of blog posts. But those are not dynamic by something the user requests, but those are added by a developer to be created at buildtime. Say your SSG has access to all your blogposts. It can easily aggregate them by tags and create pages for "/blog/tag/static-site-generator". But it can't precompile a site where a user searched for "Static Site" in a search box and showing results.
    2 points
  4. There are always discussions how PW handles heavy sites. I redesign our webpage www.kentvitrini.com (Turkish City Portal -> News, events, directy etc) This page has now 49.500 news entries. On the left you see a list of states. If you click on any state then you see list of cities on the left . The numbers are the news count under each state or city. State and City names are UrlSegments in the url. In real it is whole running on the Home page but gets filtered by UrlSegment1 = State and UrlSegment2 = City. The news are pulled from a turkish news agency's RSS every 30 minutes with Cronjob. So the news list increases 1000-2500 news every day. This is not the final design and functionality. I put the site online to get Google indexes the pages. I am still working on the site. There will be a Company Directory, Events system and a ads system etc. I wanted to only shere to show you the performance of a website with 50.000 pages running on PW . Please note that i get 94% PageSpeed Score on Gmetrix without Google ads. So theese ads are slowing down the website. With ads i get only around 70% Score. P.S: This is not a Showcase post yet. so did not post it to the Showcase section. When it is totaly ready then i will share it there again.
    2 points
  5. Hello friends! I have another module for you, which will make your daily work as a Processwire developer easier. Introducing: AppApi This module helps you to create api-endpoints, to which an app or an external service can connect to. Features Simple routing definition Authentication - Three different authentication-mechanisms are ready to use. Access-management via UI Multiple different applications with unique access-rights and authentication-mechanisms can be defined The documentation has become quite extensive, so have a look at the Github repository for details: Installation Defining Applications Api-Keys PHP-Session (Recommended for on-site usage) Single JWT (Recommended for external server-calls) Double JWT (Recommended for apps) Creating Endpoints Output Formatting Error Handling Example: Listing Users Example: Universal Twack Api Routes Page Handlers File Handlers A special thanks goes to Thomas Aull , whose module RestApi was the starting point to this project. This module is not meant to replace this module because it does a great job. But if you want to connect and manage multiple apps or need other authentication methods, this module might help you. I am already very curious about your feedback and would be glad if the module helps you a little bit.
    1 point
  6. Althought Laragon is a great choice. You can also use Docker if you want ? Here I made a simple config for PW https://github.com/joyofpw/docker ?
    1 point
  7. I think this post has the info you need:
    1 point
  8. I tried them all => go for Laragon => fast => easy config easy ui https://laragon.org/why-laragon/
    1 point
  9. @NooseLadder ... or you take the easy way and get you a full copy of Laragon! It has everything you may need or not. Including One-Click-SSL-Certificates in your local dev environment to use and test full https protocol. And much more. ? see what others mean: site:processwire.com/talk laragon
    1 point
  10. Hi @NooseLadder, and welcome back! There are a number of xampp related posts on the forum that will help get everything set up and running. You can find them searching google like this: site:processwire.com/talk xampp Filezilla would be used to copy (sftp) files to a production server. You might use whatever IDE you prefer to access your localhost document root until such time as you want to go live. Hope this helps.
    1 point
  11. You should also take a look at Repeater Matrix https://processwire.com/store/pro-fields/repeater-matrix/
    1 point
  12. thanks for all info - so these SSG seems quit complicated, I will stick with traditional CMS ?
    1 point
  13. Which method exactly? It would help us reproduce/test. I don't quite get this. Aren't all hooks called from a class context? Perhaps you meant to say frontend versus backend? What errors? Where are you calling the hook? Some code to look at would help :-).
    1 point
  14. Hey I updated the spec. Now it's more like Pseudocode than a whole language in itself. The idea is just to communicate better and make plans before building or thinkering with the fields. Example for this small project that I'm building https://github.com/NinjasCL/chileanbirds-api @document { @wire { @templates { home: template().options({@once, @strong, @root}), notfound: template().options({@once, @childless}).description("Used in 404 errors"), birds: template().options({@strong}).family({ parents: ["home"], children: ["birds-item"] }), birds-item: template().options({@childless}).family({ parents: ["birds"] }) }, @fields { title: text().options({@i18n, @global}), body: textarea().options({@i18n}), uid: text(), href: url(), file: files().max(1), migration: checkbox(), dimorfism: checkbox(), size: text(), order: text(), species: text(), image: images().max(1).mediatypes([@jpg, @png, @svg]), images: images().mediatypes([@jpg, @png, @svg]), value: text().options({@i18n}), habitat: textarea() .description("Stores the habitat property") .options({@i18n}), didyouknow: textarea() .description("Stores the did you know property") .options({@i18n}), iucn: pagetable() .max(1) .fields({ body: body().description("Stores the iucn description"), value: value().description("Stores the iucn value") }), audio: pagetable() .max(1) .fields({ file, title.label("Author") }), map: pagetable() .max(1) .fields({ image, value }), }, @pages { + "Home" (template:home) @many -> { + "Birds" (template:birds) @many -> { + "Bird 1" (template:birds-item, fields: { title: title().label("Names"), body: body().label("Description").description("Stores the bird description"), images, habitat, didyouknow, iucn, audio, map, species, migration, dimorfism }) } // /birds } // /home } // /pages } // /wire } // /document
    1 point
  15. It is a free ProField. Welcome to the forums and ProcessWire ?.
    1 point
  16. Everything is possible in ProcessWire. ? For example, you could create a "max_children" integer field and add it to the template of any pages you want to limit the children of. Then use this hook in /site/ready.php: $wire->addHookAfter('Page::addable', function (HookEvent $event) { /** @var Page $page */ $page = $event->object; // If page has the "max_children" field, and the field isn't empty, and the number of children is at the maximum... if($page->hasField('max_children') && $page->max_children !== '' && $page->numChildren >= $page->max_children) { // ...then don't allow child pages to be added $event->return = false; } }); But this is not to say it's the best solution, just that it's possible. ?
    1 point
  17. You can use a limit in a children() selector: https://processwire.com/docs/selectors/#limit For example, this... $sections = $your_page->children("limit=3"); ...will limit $sections to the first 3 children of $your_page.
    1 point
  18. @MoritzLost IGNORE ME... Jeeeez. I'm having a meltdown today. Heavy weekend ? Thank you, thank you, thank you!
    1 point
  19. For what it is worth, I use this intermediate solution to use ProCache in combination with the RestAPI module: https://processwire.com/talk/topic/20006-module-restapi/?do=findComment&comment=186881. Which gives me: 1. site.url/rest-api => live data 2. site.url/api => served by ProCache Of course this would only be useful for (static) pages that don't require any authentication or whatsoever.
    1 point
  20. To be honest, I guess you will be an awesome journalist or a/an writer/author in literature ?
    1 point
  21. Two more things: Can you enable Issues in your respository on github? I'm getting an error in this line: https://github.com/Sebiworld/AppApi/blob/master/classes/Router.php#L275 Changing it to if ($last_error && $last_error['type'] === E_ERROR) { fixes it. (This was already suggested by someone some time ago on the RestApi module). I was providing a PR, but since AppApi is a fork of RestApi, when I try to fork it, it just goes back to my module ?
    1 point
  22. Another thing which would make usage of this module easier for users of the RestApi module would be to have an option to not have to use ApiKeys to access the API
    1 point
  23. I already have the first request: I was planning to, instead using a hook to intercept the request to play out the api it would be better to (again) use a page in the regular ProcessWire tree for the following reasons: Multi Language does not work with the current solution Caching with ProCache does not work with the current solution It is harder for users of the API module to use Subdirectories Also another request by a user was to move the API routes in `/templates` so it would be included in exports with the site profile export module.
    1 point
  24. Yeah this is pretty awesome! Since I'm struggeling with carving out time for the RestApi module over the last year (sorry again for not giving your PR much love @Sebi) I'm pretty happy someone is pushing things forward :) Actually I'm thinking maybe this module should be the official continuation of my RestApi Module. For me it looks like it is more advanced and as far as I can tell by creating a single endpoint the way things are used would be quite similar. What do you think? I'm gonna check it out myself now :)
    1 point
  25. Good news! We are live now! AppApi has been approved and now appears in the modules directory: https://modules.processwire.com/modules/app-api/ Thank you for your many reactions to the release - I hope it helps you build the best apis you can imagine!
    1 point
  26. Today, I am glad to announce that the module support the native image field ??
    1 point
  27. I hate hate hate hate (repeat however many times you would like) to say this, but WooCommerce is my weapon of choice for eCommerce. For the level of my client base, they are on the understanding that if I say I am not doing that with this software and you would need something more highend and secure, then they are ok with the functionality. That will be the only time you will ever hear me talk WordPress on here (until the new Padloper comes along). But, I did check out the module by @Gadgetto that @bernhard was talking about, and it is impressive. Yes you can plug everything into the frontend yourself with Snipcart, but the backend integration is lovely. If you are worried about the fees, then in my experience, you have a product that has too many competitors and there will always be somebody out there undercutting you. Just roll something out with a slightly higher price otherwise, test the water and adapt from there.
    1 point
×
×
  • Create New...