Jump to content

Zahari M.

  • Content Count

  • Joined

  • Last visited

Community Reputation

103 Excellent

About Zahari M.

  • Rank
    Distinguished Member
  • Birthday July 6

Profile Information

  • Gender
  • Location
    Kuala Lumpur
  • Interests
    Video, baroque & jazz music, good audio, good coffee & tea, mechanical keyboards, old ThinkPads, Raspberry Pi & Arduino, of course other things too...

Recent Profile Visitors

6,552 profile views
  1. @flydev and @LostKobrakai Thank you both for your help gents. For future searches & seekers that might stumble upon here... For those of you gents, ladies ( and any others ) that are wanting to be able to , from the admin side, create custom queries to select specific sets of pages, such that you can easily determine what pages are listed via a specific "listing" page, then the Selector fieldtype is definitely your friend! Rough Installation Guide Go to admin > modules > core. Scroll to the Fieldtype section. Locate and install "Selector" fieldtype. Create a new Selector field. I named mine 'selector'. Upon creating it, it suggests that you give it a starting value like template=product. In my case... I ended up not giving it any value. Leaving that initial suggested template value out means we have the option of subsequently selecting our template later, which gives us more flexibility in use. Go to your template in admin and add the selector field. Go to your template file and do something like below. Thus, we can, as LostKobrakai suggests, start building a selector that ultimately creates the required variable string and safely feeds this into our $pages->find() selector... $posts = $pages->find("$page->selector"); Go to a page that has this field and using the selector field's UI, start building your selector! I have tried attaching a screen shot of what it looks like. What I was trying to do earlier can be seen in my Query text field as mentioned in my original question. I have now removed this Query text field and just use the Selector field. As an aside, I am using a Page Reference field called opts_article displayed in the form of multiple checkboxes. What I am doing here is using these checkboxes as a means of preventing certain pages from being listed. For example, you can see here that my Selector is listing all pages that has the article-page template. You can also see the limit of 10 pages. But one of my favourite blog posts from Ryan talked about efficient use of PW fields,see here: Efficient Use of Fields. And so by creatively using a single Page Reference field, we can create, on the fly many checkboxes easily. I mention this because using this Selector field, it enables one to effortlessly select and factor in the desired logical purpose of your checkbox when building your selector. I'm sure this is all basic stuff for many of you here, but I'm also sure it can help dummies like me too 😊
  2. Hello psy Maybe it's a personal thing, but a hi or hello goes a long way when a total stranger addresses you directly... some might possibly consider it rude and confrontational I shall be happy to honor your request and no longer assume that ProcessWire devs are gents. If there are any other non males here that may have taken offence, my apologies to you all too.
  3. Hey LostKobrakai! Thanks for the replies!! I did look there initially before asking but there were quite a few uninstalled ones. Hence I thought better ask you first. I did find it and it's called Selector and it says... Build a page finding selector visually. Very interesting options to build the selector. I will try and figure it out from here... Cheers!
  4. Hi LostKobrakai Thanks for the reply! I'm not familar with this FieldType Selector. Is it a module we add on? Could you point me to a specific page that I could start looking into it? Cheers!
  5. Hi gents! Apologies if the topic to this question does not use the correct terms. But here goes... Lets say we have a parent page. This parent page has lots of child pages. In the template file for this parent page, I write this: $posts = page()->children('limit=10'); This works great. Now the question about saving this as a variable... I have created a text field called myquery and attached it to the parent pages template. Inside this text field, I have entered the whole selector and statement like so into the text field: $page()->children('limit=10') Now what I am trying to do in my template file is this: $q = $page->myquery; $posts = $q; Doing this gives me this error, Fatal Error: Uncaught TypeError: Argument 1 passed to ProcessWire\ukPosts() must be an instance of ProcessWire\PageArray, string given. If I wanted to lets say change the number of children from a text field in my template, I have managed to do this by way of passing a variable into the statement. So I could use a variable for the value for limit. This works. But the reason I want to try and save the whole statement and selector is so that we can run a query on this page and it can fetch pages from anywhere in our site. In a way, I do understand the error in that I am making posts now equal a string. But how can I echo out an entire query statement from a field and get it to be "run"? Hope the question makes sense! Cheers
  6. Hi pwired! Thanks for reading and your reply. Much appreciated! Yes your right!! It's all about the ports. The T60 T61 series laptops are special in that they have a dedicated adapter whereby you can take out the CD or DVD drive from the bay and in it's place put in a combined serial and parallel port interface adapter. I managed to find one of these adapters in France. So am hoping that someone there can purchase it on my behalf and ship it to me Even though they might be considered as antiques, I actually quite like these old ThinkPads. Also I am really getting in to Raspberry Pi's now and they would make a good low cost companion to connect to the Raspberry Pi with. I just bought a T400 with docking station, monitor, mouse and keyboard for a very cheap price to use to play with my Raspberry Pi 3 and to learn Python and SQLite on Thanks again pwired for chiming in
  7. Hi there! I'm hoping any forum members from France could perhaps help me I have an old ThinkPad laptop and I have been trying to look for a part for it. After some searching I have found one in France! I did try emailing the company, but they did not reply Anyways, I'm hoping that a member here in France could help me buy it online, get it delivered to their house, and then ship it to me in Malaysia! I will PayPal you upfront. If someone here can help, do let me know k! Many thanks!
  8. Hi guys! I have to say that I too had the same problem as cjx2240. The solution suggested by Gideo So was the trick! You need to add mystyles: before the path like so... mystyles:/site/modules/InputfieldCKEditor/mystyles.js HTH
  9. Ok... I actually figured it out. I just found this page which helped.... https://processwire.com/api/ref/page-array/add/ Here's what I ended up with.... $p = new Page(); $p->template = "basic-page"; $p->parent = "/api-generated-pages/"; $p->title = $randomTitle; $p->pageoptions->add(array(1023,1026)); $p->save(); Fortunately I had read a few threads looking for the solution and that is what helped me add the array in to add multiple pages into the page field at once. Hope it helps someone else! Have a great weekend everyone!
  10. Hi Guys Been trying to sink my teeth into the API as I want to be able to create pages via simple scripts. I am using a page type field in my template which enables me to select other pages. I am selecting these other pages via checkboxes as a means to provide options for my page. i.e one option is to hide comments and the other is to hide the sidebar. My problem is I can't populate the page type field with the values I need. So currently I am doing this $p = new Page(); $p->template = "basic-page"; $p->parent = "/api-generated-pages/"; $p->title = $randomTitle; $p->save(); All this works great. But how do I modify the above script to also populate my page field named "pageoptions" with the page id values of say 1234 and 1235? I've been searching the forum for an hour and tried many ways to write it but I can't seem to find a solution to set them. So pardon my poor searching. I'm sure the answer is there but I can't seem to find it! Many thanks!
  11. Thanks Steve!! Fabulous module indeed! Curious now... what were the jobs or the needs you had that made you make it?
  12. Hi Steve Have messaged you the details you asked for. Many thanks mate!
  13. Hi Steve Actually the site is on local host in MAMP Pro. I will upload it to a live site over the weekend and pass you the login details so you can have a dig! But now that you mention it mine is 3.0.38. Hmmm. Will rollback too and see! Cheers!
  14. Hi Steve Thanks so much again for looking into this. Unfortunately after trying the dev version, i think it's made things worse. At least for me. The clock picker has now stopped working on both a "normal simple" page and within a repeater matrix. Replacing it with the previous main one restored back the clock picker on the "normal" page....
  • Create New...