Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by titanium

  1. This selector does not work for me, for instance: parent_id=1050 Is there any other way to show a field depending on the parent? (The selector id=1050 works, so it's no problem to show a field depending on the id of the current page. But I need the parent.)
  2. I think you need something like this (direct page access redirects to the parent page): if ($_SERVER['SCRIPT_URL'] === $page->url) { $session->redirect($page->parent->url); exit; } alternatively, if you would like to show a 404: if ($_SERVER['SCRIPT_URL'] === $page->url) { throw new Wire404Exception(); exit; }
  3. Sorry to disagree, but this time the Craft CMS' Matrix field is far superior to what Processwire has now. Compared to the Craft solution, PW repeaters feel a bit clunky IMHO and they don't offer the same functionality. Time for us to catch up...
  4. $sanitizer->selectorValue($value) limits the length of a selector to 100 characters, whereas the class constant "maxValueLength" of the "Selectors" class allows 500 characters. Shouldn't that be equal? Maybe it has been overseen by Ryan when he changed the selector code?
  5. I don't know if it makes any difference and if it is of any help, but Safari's latest version is 7.0 (default in OS X 10.9 Mavericks)...
  6. I have deleted my post, because: Adrian was 4 minutes faster than me and has already said it all
  7. Hi Horst, maybe you could set up a rule which takes care of the referrer, something like this? RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC] Only if the referrer equals your domain, allow access to the originals. Problem could be that your server does not use http referrers...
  8. Soma, I tried the Blocks module from github - it will be a great value to ProcessWire once it is ready for prime time! Thank you so much for taking your time for this. I'm sure it will be greatly appreciated. I think that the editor normally likes to see what he/she gets, therefore the repeater inline approach makes sense to me. This Blocks module can be of great use in cases in which we would normally use a rich text editor with all it's shortcomings. We as developers will gain better control of what can be entered: no more unpredictable image placing in TinyMce or ckEditor - great! I fear my programming skills are not good enough to be of any coding help, but I'm glad if I can help out with testing.
  9. Thanks, Adrian. My test case is like this (I put it in a template): var_dump(wire('page')->status); wire('page')->addStatus(Page::statusUnpublished); wire('page')->of(false); wire('page')->save; wire('page')->of(true); var_dump(wire('page')->status); exit; When the page is called in the browser the output is: int(1) int(2049) As far as I know, the page should have the status 2049 now, as int(2049) indicates. It should have been saved. But if I reload the page, I do get the same result! I expected int(2049), int(2049). What could be wrong with this?
  10. Dear ProcessWire fans, I'm trying to set a page to be unpublished by API. Reason is: the page contains a field with a timestamp. As soon as the timestamp is reached, the page should become automatically unpublished. As far as I know, the following simple code in the page's template should do: if($timestamp <= time()) { wire('page')->addStatus(Page::statusUnpublished); wire('page')->save; throw new Wire404Exception(); } The 404 is thrown, but the status doesn't get updated. If I edit the page in the admin afterwards, it is still published...
  11. Thanks Ryan, I should have been more precise. I did mean template cache. Meanwhile, I found some kind of workaround. As you said, this cache gets cleared when the page is saved, therefore I wrote at the top of the template: $page->of(false); $page->save(); $page->of(true); These actions just occur if a certain condition is met. I did this because I have build a contact form, which could be added with the help of Hanna Code to an otherwise cached page. I didn't want the client to select another (uncached) template if he uses this hanna code. I think it works so far.
  12. Hi joe, set the language of the guest user to the second language.
  13. Hi, I have build a custom module which changes a bunch of pages at once. How can I delete the cache of all pages to be sure that all pages reflect the latest changes? I didn't found anything in the API docs.
  14. Hi FuturShoc, try $emailUser = wire('users')->get("name=visitor"); $email = wire('sanitizer')->email($email); and so on... see http://processwire.com/api/include/
  15. I suppose you don't need "Programm Classes" to be ever displayed, right? Then give theses container pages no template file at all. The child pages get their own template ("class_and_instructor", to give it a name for example) then, and now you can use $childpages = $pages->find('template=class_and_instructor'); foreach($childpages as $child) { echo $child->title; }
  16. Did you take a look at the server logfiles? I bet you will find hints about the problem in "error.log". It Apache does not complain, it's most likely no Apache problem.
  17. I can confirm this. My best bet is that you've got enabled HannaCode as a textformatter in the setting of the "body"-field. I'm not sure what's happening, but I guess Hanna Code calls itself again, and overwrites the output itself. As a workaround, you could use different body-fields in parent and children - one with, the other one without Hanna Code enabled.
  18. I searched in the forum and studied the cheat sheet, but I didn't find an answer to my question yet, therefore I'm asking Is it possible to upload a picture, let's say in png format, to resize it and to output in a different format, e. g. as a jpg? As far as I know, PW always outputs the image in the file format it was uploaded. It would be nice if I could give a parameter to the resize function, like this for example: $options = array( 'quality' => 90, 'format' => jpg ); $thumb = $image->resize(600, 400, $options)->url;
  19. titanium


    MySQl uses port 3306 by default, so most likely you don't need to change that. Are you sure that db name and db user have to be the same? And "mysql.hostinger.ru" does not seem to be publicly available, I'm not able to ping to it with success.
  20. Hi Soma, I'm definitely interested! I already discussed this topic elsewhere, sharing similar ideas. I would be glad if I could try out what you have.
  21. It's a pleasure First let me thank you all for these different and very interesting approaches - there is so much to learn from! I like Ovi's module solution very much, it's something I would not think of. Maybe we should establish some kind of Processwire Coding Contest - every participant get's the same excercise, and the most "beautiful" or "creative" solution wins. ;-) I was looking for all these pages, which intro_text field contains less than 10 chars; this includes the pages which have the field set, but its value is empty. Pages, which don't have the field set, should not be listed. My initial solution was: // get all pages, even the hidden ones, sort by name $pages = $this->pages->find('include=hidden, sort=name'); if (count($pages)) { foreach ($pages as $page) { if ($page->template->fields->get('introtext') && strlen($page->introtext) < 10) { doSomething(); } else { $pages->remove($page); } } } This works fine so far, it returns a page array which contains the pages I want. Unfortunately, it doesn't work in conjunction with the renderPager() method I would like to use afterwards. I suppose the reason for that is explained by soma here. That was the reason I was posting, because one needs a proper $pages->find(...) to get renderPager() to work, as far as I understand it.
  22. I would like to find all pages which have a field with the name 'intro'. This intro's field value should be checked for a string length less than 10 - that should include the pages which have an empty value of introtext. Pseudo code to make it clear: $pages->find(strlen('intro') < 10) How could I achieve that?
  23. I think you will enjoy Batcher as much as I do
  24. I tried this great module a few minutes ago - with ProCache disabled, it works as expected. With ProCache enabled, it doesn't: given one main domain and one "campaign" domain, the browser displays the start page of the domain which was called first. I think it has to do with the .htaccess rules ProCache depends on.
  • Create New...