alxndre

Members
  • Content count

    111
  • Joined

  • Last visited

  • Days Won

    2

alxndre last won the day on September 30

alxndre had the most liked content!

Community Reputation

158 Excellent

About alxndre

  • Rank
    Distinguished Member
  • Birthday 05/06/1987

Profile Information

  • Gender
    Male

Recent Profile Visitors

3,610 profile views
  1. I'm doing something similar (far from being as awesome as your module) using only some hobbled up pages and templates, and it's getting out of hand. This looks worthwhile to dig around in. I'll try it out and try to give helpful feedback. Thanks for sharing.
  2. There was a recent post somewhere in the forum of a video of Rasmus briefly explaining (sort-of) why PHP was "bad" at the beginning, and how far PHP has come in 2017 with PHP 7+. I personally love PHP despite its reputation because it's almost as old as the internet itself, and has endured with it. While that's not directly a measure of being a good programming language, it's a measure of stability that means anything I learn doing in PHP will be useful for years to come, unlike how some modern frameworks/language/libraries come and go. And like horst said, there are always good and bad coders regardless of the language. Just like how they hail Python as a good programming language, but I've seen some people write some horrible stuff in it, ProcessWire is probably one of the best things I've come across that's written in a "bad" programming language.
  3. Thanks for this great module, @Robin S! Can i request to add this as I still think this is useful, and it fits within your module:
  4. Hello, out of the topic, but what module is this? Thanks.
  5. Are you using the latest master? If you haven't already, try adding a ProcessWire namespace to your file, or use function ProcessWire\wire : <?php namespace ProcessWire; use function ProcessWire\wire;
  6. This is a simple loader for LessQL, an ORM alternative for PHP. It is based on NotORM, and provides a quick way to access and find things in a database, including traversals and back-traversals. As discussed in some earlier topics, there are times when you'd like to store some data away from ProcessWire's pages/fields/templates structure for whatever reasons. However ORMs are sometimes cumbersome and requires a lot more effort to deploy. LessQL offers a quick way to just up and go like you're using an ORM but without the added complexity and configuration files. Module: https://github.com/alguintu/LessQL This modules simply loads the LessQL library into ProcessWire and exposes a $lessQL variable (configurable in settings) that gives access to your database. It uses the same database specified in $config by default, but can be set to use a separate database, along with its credentials. Usage given a table person : $people = $lessQL->person()->select("id, firstname, lastname")->where("firstname LIKE ?", "%alex%")->orderBy("firstname")->limit(10); It uses lazy loading and doesn't execute the query until it needs to. Checkout www.lessql.net for more info on LessQL. Module wrapper is pretty much lifted from @teppo's RedBeanPHP module, but with a few modifications.
  7. I'm an idiot. So it's because I'm watching the log page trying to poll the logs. Thanks guys.
  8. Hi @abdus, the modules I tested are both set to 'singular' => true.
  9. I just happened upon something that I think is curious, and I'm wondering if this is default behavior. So help me because I know nothing. While writing a module, i logged something in wire('log') inside the module's init() function. I was surprised to see that the text was being logged multiple times continuously. So I tried to open a small random module and logged something in its init() function as well, and the same thing happened - the text being logged many times. My question is, is this supposed to happen? I just want to understand what's going on. My concern is that if I do something huge in the init function, it will get called repeatedly, as with the log, and cause performance issue. Please note that these are both autoload modules. I was expecting them to log at least once when I refresh, but not continuously like what happened. Please let me know. Thanks.
  10. Thanks for the response, I tried without logging but it's the same. And also, sorry bout the wrong selector, you're right it should be parent=[selector] as a subselector. I'll try later using find only. Thanks!
  11. function copyParent($begin, $times) { for ($i=$begin; $i<=$times; $i++) { $limit = 50; $set = $i; $start = ($set-1) * $limit ; $tx = wire('pages')->findMany("template=transaction-earn, start=$start, limit=$limit, sort=transactiondate"); if ($tx->count < 1) { wire('log')->save('migration', "no mas transaciones"); break; } wire('log')->save('migration', "updating $start to" . $set*$limit); foreach($tx as $t) { $p = $t->parent; $t->setAndSave([ 'tagreference' => $p->tagreference, 'idreference' => $p->idreference, 'transactiondate' => $p->transactiondate, 'merchantreference' => $p->merchantreference, 'userreference' => $p->userreference, 'terminalreference' => $p->terminalreference, 'offline' => $p->offline, 'amount' => $p->amount, 'product' => $p->product ]); } } } I have this code that i'm trying to run in the background to copy some data from a parent node to a child node. The problem is each iteration of this code runs for about 15 seconds for every 50 pages saved / copied (or about 200/minute). I have about half a million of these pages to update and it would take 2 straight days running. Maybe someone could point me out to what's causing the slow down? Or if anyone could suggest a better way to do what i'm trying to do. Thank a lot, as usual. Edit: By the way, the reason I'm doing this is because when I'm trying to query the child nodes with criteria from the parent node, it takes an incredibly long time, but takes close to nothing when I tried copying some to the child node and do the query there. I hope that helps a bit. $tx = wire('pages')->findMany("template=transaction-earn, start=$start, limit=$limit, sort=transactiondate, [tagreference=$tag, merchantreference=$merchant]");
  12. Your selectors are not actually doing anything to filter the posts you want: If for example you have a category called "tech" and you want to find articles with that "category" field, you could do: $category = $pages->get("template=category, title=tech"); $posts = $pages->find("template=article-post, category=$category"); This also works with filtering multiple categories: $categories = $pages->find("template=category, title=tech|botany"); $posts = $pages->find("template=article-post, category=$categories"); Now, if you want to do your list with the headings and the posts underneath them, you'd have to loop through your categories and do the same thing. Hope it helps.
  13. If you're using the processwire variables within a function, you could reference them using the wire() function such as: wire('pages')->find('selector'); wire('users')->get('selector');
  14. I think get() always returns a single page. Have you tried $pages->find("id=1|2|3"); which will return a PageArray.