-
Posts
189 -
Joined
-
Last visited
-
Days Won
1
Everything posted by thomas
-
Thanks Nik, obviously there will be a lot more to exclude than to include but I can't fugure out a way to rephrase those queries for include other than what you posted earlier (using import()). I'll compare those two and ditch the iteration Thanks, thomas
-
I use MarkupCache to cache JSON data all the time so I'll definitely take a look at your code, Jeroen. Thanks
-
Thanks nik, that's what I thought. I have a rather large list of articles which can be sorted and configured by the user. It also contains 'private' articles and 'drafts' which are only visible to it's creater. Right now I iterate over the complete list but that's becoming too slow. I wonder if this is a good approach: $noShow = $pages->find('private=1,author!='.$user); $results = $pages->find('template = video,id!='.$noShow); there are about 1K articles and counting ... I'm thankful for all hints! t
-
Hello, Quick question: can i use selectors like $pages->find('fieldA=xy || (fieldA=z && fieldB = x)') ? (I'm on a mobile and need to know ...can't try before Monday ...) Thanks, t
-
Hi Joss, I found /wire/modules/Process/ProcessPageEdit really helpful. There you'll find all you need to know to use PW inputfields in your own form. Also look at roles and permissions and $users. Hope this helps.
-
No, "new pages" is not selected and I don't want it.
-
Hello, I just set up a PageAutocomplete field which was supposed to use a different field for selection (different to name or title that is). I didn't work. It seemed to find something but the pulldown showed empty lines and when I selected one of them, the list only showed "Label". Once I switched the field to title, everything worked fine. Is this a bug or is there something to configure before using a custom field for PageAutocomplete? Thanks, t PS: Using PW 2.2.15
-
Hello, I need to migrate a bunch of users from an old symfony site to the brand new PW one. Symfony saves the passwords as md5 hashes in the DB but I can't figure out how to configure PW for this. I set $config->userAuthHashType = 'md5'; $config->userAuthSalt = ''; and pasted the hash into the field_pass DB table of a working user. No success. What else is there to do?? Thanks, thomas
-
function inside a widget inside another page issue [solved]
thomas replied to Joss's topic in General Support
Hi Joss, you somehow need to pass that $page object of the mothership onto the widget page and into that function. I'm not on my coding computer right now and can't test anything but maybe you could simply attach it to the widget object function categorySidebarWidgets() { $categoryWidgets = wire("pages")->get("/content-management/settings/site-settings")->site_category_sidebar_widgets; foreach ($categoryWidgets as $categoryWidget) { # $categoryWidget->mothership = wire('page'); # echo $categoryWidget->render(); } } And then test if you can output $page->mothership->title in your widget template. If you can, run with it! Oops, Interrobang war schneller -
function inside a widget inside another page issue [solved]
thomas replied to Joss's topic in General Support
Hi Joss, are there more than one site_category_sidebar_widgets? I've never used the render() method so I have no idea how to access the main page. I usually use php includes which live in the scope of the main page ... What's in the template of site_category_sidebar_widget? Only that function? -
function inside a widget inside another page issue [solved]
thomas replied to Joss's topic in General Support
Not sure I understand. You said your widget is a page in a field of the main page? So "main" page would be $page and widget is $page->widgetfield ...? Now if you call that function getChildCategoriesPosts($page); The function will use the main page as $page (remember $page doesn't exist yet in the function, you have to declare it and it can be something completely different than $page outside of the function. For clarity it might help to use a different name than $page) If you call getChildCategoriesPosts($page->widgetfield); the widget page will be used . I hope I'm understanding this correctly ... -
function inside a widget inside another page issue [solved]
thomas replied to Joss's topic in General Support
function getChildCategoriesPosts($page=null) { if(!$page) $page = wire('page'); else $page = wire('pages')->get($page); #loads of stuff } getChildCategoriesPosts($pageyouwant); is this what you are looking for? -
How do you find the pages at /news/political/xoxox? To move the pages out of the tree, I guess you have a page somewhere that reads the urlSegment and then finds the approriate page in the tree (ie /content-management/posts/xoxoxo). THis would be your category page. Whatever this page needs is what you have to use as an url. So if your category page (/news/politics/) works like this to find an actual post: $post = $pages->get("name=$input->urlSegment1"); this code: <a href='/news/politics/{$post->name}'> *should* work. (make sure to use "name" not title, and watch the slashes)
-
Ah, now I get it. Try this: foreach ($posts as $post) { echo "<a href='/news/politics/{$post->name}'><h4>{$post->title}</h4></a>"; echo "</div>"; } Or even: echo "<a href='{$page->url}{$post->name}'><h4>{$post->title}</h4></a>"; to make the category variable as well ...
-
I don't really understand what you are doing here, but then again, I'm no Soma If post_category_select is a page field holding the category page and $page is that category page, you won't need any url segments at all. If your category name is fed to $page by an urlSegment, try this: $posts = wire('pages'->find('post_category_select.name = '.$input->urlSegment1) If your foreach() should link to the actual posts, you won't need any urlSegments since the url() of the posts are already ready and correct. I'm making a lot of assumptions here so maybe it's all wrong ...
-
Thanks for your answer Ryan, I just tried your code and the repeaters still remain in the DB. The unneccessary code was my attempt at forcing PW to delete the repeaters but that didn't work either. Could this be an issue of how the repeaters were created? Thanks, t
-
Hello Jeff, thanks for the detailed explanation. I was aware of that, but "reverse direction" does nothing for me when sort order (4) is on "manual drag and drop". It doesn't stay checked and it has no effect on the sort order. - thomas
-
Hello, I noticed that when using "drag and drop" as sort order in the admin, new pages always end up on the bottom of the list. We have a site that has a few hundred pages under one parent and i'd like to change the sort order to drag and drop so the editor can decide which article stands where on the page. The way it is now, he won't find his newly added article though, or only after going through an endless list. Is there a way to change this behaviour so new articles go to the top of the list? Thanks, thomas
-
Hello, I need to ressurect this thread for an old problem of mine. I still cannot delete repeater fields, no matter how hard I try. This is the latest approach and still all the repeaters stay intact. In the pages table, 814 pages with parent "for-field-125" remain. What am I doing wrong? $pa = wire('pages')->find("template=video,include=all"); foreach($pa as $p) { foreach($p->files as $file) { $p->files->remove($file); } $p->save(); $p->delete();}
-
Moin, sehr gute Idee! Thomas Fritscher, Köln, https://plus.google.com/116986246464503235258/about
-
I just tested the CropImage module and it seems to work fine for me in 2.3
-
I just upgraded my local /wire from 2.2.9 to 2.3. Smooth sailing so far. Are my eyes cheated by some spell or am I seeing a speed BOOST?? - MySQL 5.1.67 - PHP 5.3.6 - Apache 2.2.20
-
Templates, fields and (maybe) pages exported to PHP code
thomas replied to Alessio Dal Bianco's topic in Wishlist & Roadmap
I was just gonna post this as a feature request. I'd be great to have a way to export the fields/templates setup to later copy the files to the production server and recreate the fields/template structure without any data. -
set() on on inputfieldSelectMultiple doesn't remove unchecked options
thomas replied to thomas's topic in API & Templates
Thanks soma, that's what I did now. I was just curious why it works for "stock" fields but not on my own ... I guess PW likes to keep some of her secrets -
Hello, I need to build a combination of selectors which need to be in almost every find() statement on my site. Being lazy by nature, I was hoping for a way to make my life easier. I thought of three ways: - Hook after find, then find again with the new selectors. This works, but it scares me. Maybe it's not as bad performance wise as I think but my guess is, it is. - Build a property by which to find(). I liked this idea until I found out it doesn't work. The idea was to addHookProperty to Page, and then include this into find. But find only likes fields so no luck. - Hook before find and modify the argument passed to find(). I couldn't get this to work: $event->setArgument(0,"mySelector==yes,".$event->arguments[0]); $event->return = $event->arguments; What am I doing wrong? What are your ways of managing silly recurring selectors? Any thoughts on my ideas? Thanks! thomas