Jump to content

clsource

Members
  • Posts

    373
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by clsource

  1. Hello, I made this little experiment, maybe useful for someone.

    YAWS (Yet Another Webserver) is a HTTP 1.0/1.1 webserver which is completely written in Erlang. YAWS has been noted well suited for dynamic-content web applications in many cases.

    Because Yaws uses Erlang's lightweight threading system, it performs well under high concurrency. A load test conducted in 2002 comparing Yaws and Apache found that with the hardware tested, Apache failed at 4,000 concurrent connections, while Yaws continued functioning with over 80,000 concurrent connections.

    Mixing Erlang and PHP is a powerful combination. PHP has a vast web development ecosystem and Erlang
    has more than 30 years of production ready concurrency solutions that scale well.

    https://github.com/joyofpw/pwyaws/

     

    Cheers.

    • Like 8
  2. I think ProcessWire is perfectly capable of handling an ecommerce.
    My main consideration is that such project requires more time and expertise than for example
    configuring a Woocommerce, Open Cart or Prestashop type of ecommerce and just use their apis for showing up the products.

    If you would need a tailored approach, surely ProcessWire and Padloper can be handy ?

    • Like 1
  3. On 11/28/2020 at 4:54 PM, JeevanisM said:

    this is awesome. I want to create a mobile client for my website. I just need only a GET endpoint. ( I want to fetch certain number of videos ( say latest 20 videos ) from this website and show in my mobile app. ( the website https://www.bhimonlineclassroom.in/ is developed on PW3 ) . Can you please write an explanation on how to approach / develop the RESTful API with Processwire ? 

    thank you @clsource

    There are different ways of making a Rest API

    You can check https://github.com/Sebiworld/AppApi

    and

     

    • Like 2
  4. On 7/12/2021 at 7:49 AM, Rudy said:

    This is brilliant! Thanks for making it available.

    I made a Manifest module for PW awhile ago and I thought that it would be related to this Inertia module since you are using Laravel Mix for your example. Here is the repo link: https://github.com/lesaff/processwire-manifest

    Thanks, although my approach to the manifest was just reading the json file after webpack ends processing the files.
    Then using the json create a new PHP file named templates/_mix.php that contains those values and helper functions.

    The module approach is fine too ?

  5. I think PHP 7.4 is fine for now.
    I tested PHP 8 and PHPMyAdmin have issues running there.
    So I think is better to stick with the 7.x version until PHP8 is well tested.
    Maybe that would be a major version of ProcessWire since @Sephiroth pointed out module compatibility issues.

     

    • Like 1
  6. On 5/26/2021 at 10:26 PM, neildaemond said:

    Some unusual stuff happening on Freenode since the change in ownership (https://lwn.net/Articles/857252/). I got banned from freenode as a spammer just because I mentioned the word 'libera' in a room.

    Libera (https://libera.chat/) seems to be the place where the Freenode staff channels are are moving to & I've opened up a channel there. Please join!

    I will go to the PW channel on libera ?

  7. On 5/25/2021 at 5:59 AM, psy said:

    Quick update...

    Finally figured out to get React/NextJS to work with a basic (minimal field types to convert to JSON) PW site. Giving self a pat on the back when I discovered Svelte ?

    Svelte felt (I'm a poet & didn't know it ?) so much more like PW - JS, HTML & CSS with 'state management' and no shadow DOM. The only problem was routing. I'd spent far too long figuring out React/NextJS routing and Svelte offered no immediate solution. The old (like 2yrs) way of routing was called Sapper. Development on Sapper has ceased with all efforts now focussed on the new way, SvelteKit which is in pre-beta (? ). Anyhoo, went with SvelteKit and got it working.

    I've only scratched the surface on what's possible with React/NextJS and Svelte. Both offer Server Side Rendering (SSR) making the site SEO friendly & fast-loading. Given a choice, I'd choose Svelte every time.

    With both React/NextJS and Svelte using @Sebi's AppApi with customisation depending on the framework, I:

    • created a home page that pulls the data from the PW home page
    • created a 'slug' page that pulls the data from the PW page url and displays it in a component based on the PW page template as returned in the page JSON, and shows the correct route in the URL from a nav menu

    In both cases, the page layout is not a PW template but a conditional component file.

    Anyone else tried Svelte with PW? Your thoughts & comments welcome

    I loved Svelte too. For the routing part I mostly use Laravel and now ProcessWire (With the Inertia Module) with the https://inertiajs.com/

    Inertia adapters. That simplify greatly the flow and you got the best of backend and frontend ?

    • Like 4
  8. Inertia Adapter ProcessWire Module

    Hello! Long time no see.
    I created this module so you can use Inertia.js (https://inertiajs.com/) with ProcessWire.

    Description

    Inertia allows you to create fully client-side rendered, single-page apps, without much of the complexity that comes with modern SPAs. It does this by leveraging existing server-side frameworks.

    Inertia isn’t a framework, nor is it a replacement to your existing server-side or client-side frameworks. Rather, it’s designed to work with them. Think of Inertia as glue that connects the two. Inertia comes with three official client-side adapters (React, Vue, and Svelte).

    This is an adapter for ProcessWire. Inertia replaces PHP views altogether by returning JavaScript components from controller actions. Those components can be built with your frontend framework of choice.

    Links

    - https://github.com/joyofpw/inertia
    - https://github.com/joyofpw/inertia-svelte-mix-pw
    - https://inertiajs.com/

    Screenshots

    imagen.png.47d9d533960b71cd02039bd48fba9916.png

    imagen.png.cd3ed6667042a865e8cfbdddf87ec516.png

     

    • Like 22
    • Thanks 1
  9. 58 minutes ago, Manuel said:

    A very neat project to learn from!
    You really should deliver the pictures in a a resized version and activate lazy-loading (at least native lazyloading).

    
    <img src="image.jpg" loading="lazy" alt="..." />

    For now, the whole site has about 226 requests and needs to download about 113MB (!!!) of files.

    grafik.png.ffc285c63a5c8f8aee5368383981cc49.png

    Thanks this is a nice improvement ?

    Now it's lazy loaded and the thumbnails are 200x200 px ?

    • Like 3
  10. 1 hour ago, PWaddict said:

    Thanks, this seems to work if I have 2 languages but it doesn't work if I have only 1 and I don't understand why cause it's the default language for both cases. I need it to work with 1 or additional languages.

    https://processwire.com/api/ref/languages/get-default/

    $wire->addHookBefore("Pages::saveReady", function(HookEvent $event) {
    
      $page = $event->arguments(0);
      if($page->template->name != 'mytemplate') return;
    
      if(count(wire("languages")) > 1) {
      	$defaultLang = wire("languages")->getDefault();
      	$page->title->setLanguageValue($defaultLang, "New Value");
      } else {
        $page->title = "New value";
      }
    
      $event->arguments(0, $page);
    });

     

  11. 10 hours ago, bernhard said:

    To be honest I don't see anything better in "your" world compared to "mine". My world is basically the PW API, so I don't see why it would be better to learn another language/syntax that does the same but works a little different. PW API can be used everywhere, works out of the box, is documented, tested, maintained etc...

    But I'm open to suggestions for improving the RockMigrations API further ? 

    I didn´t mean to say which approach is better. I think RockMigrations is a good tool. SolidWire is not a replacement of any migration strategy or tool.
    It's just an idea to ease the communication and prototyping between developers and other people.
    It's in the same area of https://plantuml.com/

    Just a tool to improving an eagle view of the system. The JSON output is just an idea similar to https://doc.mapeditor.org/en/stable/manual/introduction/

    Any other proper migration tool could use it to generate a proper output. But is not mandatory :).

    • Like 2
  12. Ok I have been toying around with this lib https://mudgen.github.io/webscript/docs/

    And make a somewhat implementation of SolidWire using Javascript.

    import builder from "webscript/src/webscript.js";
    import createElement from "webscript/src/createObjectElement.js";
    
    const { wire, templates, template, fields, field, pages, page } = builder(
      createElement
    );
    
    const core = {
      fields: {
        textarea: field.class("FieldtypeTextarea"),
      },
    };
    
    const site = {};
    
    site.fields = {
      body: core.fields.textarea.name("body"),
      about: core.fields.textarea.name("about").max(100),
    };
    
    site.templates = {
      home: template
        .name("home")
        .root(true)
        .fields(site.fields.body.label("Content")(), site.fields.about()),
    };
    
    site.pages = {
      home: page.title("Home").template(site.templates.home()),
    };
    
    const render = (data) => Object.values(data).map((item) => item());
    
    const solid = wire(
      templates(render(site.templates)),
      fields(render(site.fields)),
      pages(render(site.pages))
    );
    
    console.log(JSON.stringify(solid, null, 2));

    executing that code brings this result in json

    {
      "tagName": "wire",
      "children": [
        {
          "tagName": "templates",
          "children": [
            {
              "tagName": "template",
              "children": [],
              "value": "",
              "__isElement": true,
              "name": "home",
              "root": true,
              "fields": [
                {
                  "tagName": "field",
                  "children": [],
                  "value": "",
                  "__isElement": true,
                  "class": "FieldtypeTextarea",
                  "name": "body",
                  "label": "Content"
                },
                {
                  "tagName": "field",
                  "children": [],
                  "value": "",
                  "__isElement": true,
                  "class": "FieldtypeTextarea",
                  "name": "about",
                  "max": 100
                }
              ]
            }
          ],
          "value": "",
          "__isElement": true
        },
        {
          "tagName": "fields",
          "children": [
            {
              "tagName": "field",
              "children": [],
              "value": "",
              "__isElement": true,
              "class": "FieldtypeTextarea",
              "name": "body"
            },
            {
              "tagName": "field",
              "children": [],
              "value": "",
              "__isElement": true,
              "class": "FieldtypeTextarea",
              "name": "about",
              "max": 100
            }
          ],
          "value": "",
          "__isElement": true
        },
        {
          "tagName": "pages",
          "children": [
            {
              "tagName": "page",
              "children": [],
              "value": "",
              "__isElement": true,
              "title": "Home",
              "template": {
                "tagName": "template",
                "children": [],
                "value": "",
                "__isElement": true,
                "name": "home",
                "root": true,
                "fields": [
                  {
                    "tagName": "field",
                    "children": [],
                    "value": "",
                    "__isElement": true,
                    "class": "FieldtypeTextarea",
                    "name": "body",
                    "label": "Content"
                  },
                  {
                    "tagName": "field",
                    "children": [],
                    "value": "",
                    "__isElement": true,
                    "class": "FieldtypeTextarea",
                    "name": "about",
                    "max": 100
                  }
                ]
              }
            }
          ],
          "value": "",
          "__isElement": true
        }
      ],
      "value": "",
      "__isElement": true
    }

    @bernhard maybe some JSON like that could be used in RockMigrations. So you have the best of both worlds. A simpler syntax and an output that could be used to define migrations using JSON ?

  13. 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
    

     

    • Like 3
  14. I think another approach is just having a "Homily" template.That uses a repeater field to storage dates and seasons.
    Maybe a structure similar to this

    <homilies>
    <homily>
    
       <title />
    
      <about />
    
       <repeater>
           <priority type="int"/>
    
           <date/>
    
           <season />
    
       </repeater>
    
    </homily>
      <homily>
    
       <title />
    
      <about />
    
       <repeater>
           <priority type="int"/>
    
           <date/>
    
           <season />
    
       </repeater>
    
    </homily>
      <homily>
    
       <title />
    
      <about />
    
       <repeater>
           <priority type="int"/>
    
           <date/>
    
           <season />
    
       </repeater>
    
    </homily>
    </homilies>

     So you can search all the homilies and put the different dates and season configuration for that homily.

    If one or more homily is on the same date then you can use the priority field to sort them out.

    • Thanks 1
×
×
  • Create New...