-
Posts
5,039 -
Joined
-
Days Won
340
Everything posted by Robin S
-
@robinc, check out this module code in a Gist by @adrian: https://gist.github.com/adrianbj/2b3b6b40f64a816d397f
-
module Recurme – Processwire Recurring Dates Field & Custom Calendar Module.
Robin S replied to joshuag's topic in Modules/Plugins
Hi @joshuag - any update on this issue? Are you able to reproduce the issue at your end? -
Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php: $config->paths->siteModules = $config->paths->root . 'shared/modules/'; $config->urls->siteModules = $config->urls->root . 'shared/modules/';
-
Various suggestions for the Comments field
Robin S replied to GuruMeditation's topic in Wishlist & Roadmap
There is this: If you are looking at doing more specific searches with FieldtypeComments::find() be aware of this issue. -
Selectors and operator for first name last name search
Robin S replied to verdeandrea's topic in General Support
Looks fine to me. -
Hooks, compare page before and after save
Robin S replied to heldercervantes's topic in General Support
Also see this post: -
Looks normal, so must something particular about the GitHub URL or the way that it is accessed that causes it to be blocked. It may be something that only your host can advise you on. You could try and set up a basic case to serve as a demonstration for them. ProcessWireUpgradeCheck.module basically does what I showed in a post above. If you take a look into WireHttp.php here and here you should be able to extract some of that code to create a basic test case in a PHP file that demonstrates the problem. For reference, here is what you should see when executing the code I posted above: [{"name":"dev","commit":{"sha":"651e8bd20c1f7bf13c08a2098f862adf82700a28","url":"https://api.github.com/repos/processwire/processwire/commits/651e8bd20c1f7bf13c08a2098f862adf82700a28"}},{"name":"master","commit":{"sha":"57b297fd1d828961b20ef29782012f75957d6886","url":"https://api.github.com/repos/processwire/processwire/commits/57b297fd1d828961b20ef29782012f75957d6886"}}]
-
I think your result means that the problem isn't with GitHub - the request is not being sent successfully. Perhaps a firewall or some other security restriction on your server is blocking it. Are you able to use fopen() on any remote files? If you put this in your template... $handle = fopen('https://www.google.com/', 'r'); bd($handle, 'handle'); ...Tracy should show a stream resource in the dump.
-
@DaveP, the GitHub API can respond with a 403 in a number of different situations, as described here: https://developer.github.com/v3/ But there should be some explanation in the "message" value of the returned JSON. You could put this in a template and see what you get back: $http = new WireHttp(); $http->setHeader('User-Agent', 'ProcessWireUpgrade'); $json = $http->get('https://api.github.com/repos/processwire/processwire/branches'); print_r($json);
-
I don't think there is any bug to report here - a $pages->find() selector must ultimately become an SQL query and the selector sort options become an ORDER BY clause. You cannot do something in an SQL query like "sort by some column but if that column is empty for a row then use some other column instead". But I guess you could make a request in processwire-requests in case Ryan can come up with some wizardry to allow OR sorting.
-
Page Reference field not updating with 'Show if...'
Robin S replied to Tom H's topic in General Support
Not sure why it half-works with role names, but the Roles field is a Page field and the correct way to match a Page field in an inputfield dependency is by ID. https://processwire.com/api/selectors/inputfield-dependencies/#example-page- 9 replies
-
- 3
-
-
- page reference
- show if
-
(and 1 more)
Tagged with:
-
@webaff, just to spell out what @bernhard is suggesting... For each language-alternate field you have, you can add a datetime or text field to the template to store the modified date. Here is an example hook for a single language: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template->name !== 'basic-page') return; // match whatever template you need // Output formatting is off in saveReady so File fields are WireArrays regardless of field settings if(count($page->file_german)) { // Use the modified timestamp of the German file field if a file exists $page->modified_german = $page->file_german->first->modified; } elseif(count($page->file)) { // Otherwise use the default file field if a file exists $page->modified_german = $page->file->first->modified; } }); Then you sort by "modified_german" in your selector.
-
How to use language-alternate fields inside selectors?
Robin S replied to webaff's topic in API & Templates
This error is likely caused by a page in your $matches PageArray having an empty file field. If there is no file then you cannot get the modified timestamp, hence the error. The issue is not related to language alternate fields and would also occur in your default file field if one was empty. -
PW featured in the article "10+ Free Alternative Open Source CMS Tools to Explore". https://designmodo.com/free-cms/
-
FieldTypeFile file names/description in search query
Robin S replied to MilenKo's topic in General Support
You can use the %=, ^= or $= operators to match the basename in a Files or Images field. $matches = $pages->find("file_upload%=$q"); You can use any of the operators on the description subfield. $matches = $pages->find("file_upload.description~=$q"); -
is it possible to link directly to the content or delete tab?
Robin S replied to bernhard's topic in General Support
@bernhard, try replacing this part of panel.js with... if(typeof panelURL != 'undefined' && panelURL.length) { var hash = ''; if(panelURL.indexOf('#') > -1) { var url_parts = panelURL.split('#'); panelURL = url_parts[0]; hash = '#' + url_parts[1]; } panelURL += (panelURL.indexOf('?') > -1 ? '&' : '?') + 'modal=panel&pw_panel='; if($toggler !== null && $toggler.hasClass('pw-panel-links')) { panelURL += '2'; // don't update target of links in panel } else { panelURL += '1'; // update target of links in panel } panelURL += hash; } Let me know if it works for you and if so I'll suggest it on the PW GitHub. -
is it possible to link directly to the content or delete tab?
Robin S replied to bernhard's topic in General Support
A link like /page/edit/?id=123#ProcessPageEditDelete works as expected when used as a "normal" link, so I think this issue is about the limitations of pw-panel rather than the link itself. -
Page Reference field not updating with 'Show if...'
Robin S replied to Tom H's topic in General Support
The value of each Roles checkbox is the ID of the role, so you must use ID(s) in your "show if" condition. Then the field with the show-if dependency will save as expected.- 9 replies
-
- 1
-
-
- page reference
- show if
-
(and 1 more)
Tagged with:
-
You can get the total number of pages found by a selector with a limit applied by using getTotal()
-
How do I use the API to test for session timeout?
Robin S replied to dweeda's topic in Getting Started
I think using $user->isLoggedin() should work fine. if(!$user->isLoggedin()) { $session->redirect('/some-url/'); } In what way is it not working like you expect? -
Welcome @sanstraces You need to save the page after you set the name. public function hookAfterAdded($event) { $page = $event->arguments[0]; $page->name = $page->name .'-'. $page->id; $page->save(); $this->message('added '.$page->name); } Normally the $page->setAndSave() method is useful in these situations, but there seems to be a bug when saving the page name.
-
Get template's allowed templates for children from API
Robin S replied to Sipho's topic in API & Templates
@Sipho, the name tip only appears if $config->debug = true -
Checking if Pages are already created, if not; create page
Robin S replied to louisstephens's topic in API & Templates
I think $pages->count() supports the same selectors as $pages->find(), plus you can supply an options array with "findAll", so should be no problem counting hidden or unpublished pages. -
unable to set $page->of(true) inside __invoke($page)
Robin S replied to bernhard's topic in Getting Started
Maybe this works...? return $page->getFormatted('title'); -
@ocr_b, you get the JSON parse error because the response from the server is some error message rather than the JSON object that is expected. If you search the forum (using Google) you'll find a number of topics that could be useful in tracking down the problem. Here are a couple: Based on comments in the forum some things to look at are: post_max_size, upload_max_filesize, max_execution_time, max_input_time, memory_limit mod_security (disable it) upload_tmp_dir