Jump to content

Ivan Gretsky

Members
  • Posts

    1,560
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by Ivan Gretsky

  1. This code <?php foreach ($pages->find("template=photo_page_template, parent=/events/, include=all, is_featured=1, sort=-date, limit=3") as $child) { ?> will not work - it will only give you the direct children of /events/. The whole topic is about how to get all subchildren and/or only grandchildren, so read above )) If you incorporate my little function, you could do what you intend like this: <?php $listingPages = getAllDescendants($pages->get(/events/))->find("template=photo_page_template, parent=/events/, include=all, is_featured=1, sort=-date, limit=3"); foreach($listingPages as $listingItem) { ... }; ?> This way you only get featured photoes from under just the selected parent. You could just place the function in the template file before the actuall call to it. To have it to my disposal at any template I put it in _functions.php, which could be prepended to every template file by putting this line in the site/config.php file of your installation: $config->prependTemplateFile = './includes/_functions.php'; where "/includes/_functions.php" is the path to the file relative to templates directory.
  2. Could it be something with the system requirements not met? Check 'em out.
  3. The problem seems to be solved. As I did not localize it accurately enough in the first place, I cannot be 100% sure, but it seem to work alright now. Thank you, Adrian. Will report back if something goes wrong.
  4. ...and just to contribute to the original topic. I use this function to get all subpages of a page: function getAllDescendants ($root, $prependRoot) { $descentants = new PageArray(); foreach ($root->children() as $child) { $descentants->add($child); if ($child->numChildren()) { $descentants->add(getAllDescendants($child)); } } if ($prependRoot) $descentants->prepend($root); return $descentants; } I include this function in _functions.php file which prepends every template file and use it like this: <?php $listingPages = getAllDescendants($pages->get('some selector'))->find("some selector"); foreach($listingPages as $listingItem) { ... }; ?>
  5. @Kay Lohn: Your "...limit=3" selector fires several times - as many, as there are children under "Projects". And each time it limits maximum number of featured photoes under that category. So you can output a maximum of (3 x NumberOfProjectsChildrenPages) featured photo pages. As Macrura suggested there are better/simplier ways to do what you intend to, like: <?php foreach ($pages->find("template=photo_page_template, include=hidden, sort=-date, limit=3")) { ?> <a href="<?php echo $child->link_to_page->url; ?>"> <img src="<?php echo $child->my_image->url; ?>" alt="<?php echo $child->image_desc; ?>"/> </a> <?php }; ?> Where photo_page_template is the template of you photo pages.
  6. Good day, Adrian! I believe I found a bug in the module. Once again it is probably encoding related (you're becoming true authority on that, like it or not ). If "Rename on Save" option is checked and you have some images in RTE field, non-latin characters get screwed up on save. Like this: Most likely none-RTE fields and RTE fields without images are not affected.
  7. There is a list of 3rd party modules on Mobile-Detect github repo page. It can be beneficial both for PW in common and the module to include the latter in that list. @justb3a: If you feel like the module is mature enough please consider submitting it there.
  8. Yes, but I do not know how to insert a tab with classified items and a button in the first place )) Could you help on this too?
  9. Yes, I understand what you are suggesting. Thank you! But this solution seems to me a bit "clumsy". I think it would be more convinient for the client to have a tab like "Children" with a list or related classified items and a big green button "Add new classified item". When user pushes that button he should be send to a new page creation screen with "classified-item" template chosen under specified root page AND company page field set to the company page he came from. Do you have an idea how this could be done?
  10. Good day! Sorry for not finding it if it is already out there in the forums. I did try, but probably do not even know the right words to put into a searchbar. I need to put a button in the page edit screen of the admin for a specific template. When a user clicks on that, he should be led to creation of a new page, related to the one he is on. Making it more of a real-life situation: it is a company page with a template "company" under "company-root". I need to place a "Create new classified Item" button on the edit screen for every saved page with that template When a user clicks on that he should be led to creation screen for a new page with "classified-item" template to be stored under "classified-root" template. I guess this should be a module which hooks into some method... But I am in the beginning of my journey to PW module-making, so please give me some (preferably clear and simple) directions.
  11. I just downloaded and tested Pretty Photo on Windows with Firefox. The example does work smoothly (exept for some problems with flash). On your site it does not.
  12. I'll dive into it ))
  13. My bad. I thought it is out of scope error (which probably happened when majkris was performing $fields->save if I got it right). I am glad Adrian helped us here. But I want to take something out of this for myself too . As I understand, $page = $event->arguments[0]; sets $page variable in the scope of the class method. But I do not know what is $event and its arguments. Where do they come from? I would be happy to get an explanation or a link to documentation article/forum post.
  14. Welcome to the friendly forums of ProcessWire dear Majkiris! Check this out. It will probably help with you in your quest.
  15. This is what I think we should ask to be done - generate the "translation" files for the default (English) language. We surely should base all further work on that and should be able to update the base translation easilly by parsing the core with in-build tool and meging the results to github. I plead the gurus of PW forum to help us with that.
  16. Just a wild guess - try putting your main.js file under jquery link or remove it at all.
  17. Lisandi! I am sure there are some better ways to manage translations than this one used in PW now. But I think it is not wise to expect Ryan to change this system at once. You write some clever stuff, but not sure that many have enough patience to get into the topic and read so many letters . I suggest we do try to get the best out of what we have by some small enhancements at first, and plan for complete rewrite in PW 4.0. As I see it languages are pages in PW now, and translation files are stored under assets/files/#### where #### is the number of the page (can vary from installation to installation for the same languages). Each file there represents the translation for one core file where the translatable strings can be found. Those files are in JSON and do not contain the original string which is always in default language (English). We need to export the default language files with all the strings translated to github repo, import them to Weblate, do the translation, export to github repos corresponding to languages and then (for now) manually install them in manually created language pages. I am stuck on step one - "export the default language files with all the strings translated". Can get all the files without translations, but not with the default string values.
  18. I do not see any obstacles to test out weblate + github for translations. I searched weblate repo and did not find Processwire there yet. Lisandi, why don't you start the project and configure it as you are most familar with the software. If it can't be done the way PW stores translation strings please report back so we can deal with it. If the translation project grows and becomes important for the community, you could then hand off or share the administration rights with those interested (and probably Ryan first). We can deal with documentation and integration later. What do you think about it?
  19. We missed black friday, but cyber monday is still coming .
  20. I think it is a very important topic lisandi brings up. Lack of decent translation for PW (at least for languages other than Deutsch and Finnish) is the thing that could limit its propagation. There is a Russian translation module, but it is quite outdated. I still can't figure out how to easily update it - the translation workflow is complex and not documented in any way. There are probably no translations for any modules in Russian. This topic was brought up several times by many but was never made clear. Managing translations could require some adjustments to the software itself. As our community has a distinguished leader and most architectural decisions are made with some sort of his approval I would ask Ryan to step in. We are eager to solve our problems ourselves, but we want to do it together in a non-contradictory way. Let's decide on something )) Translations are a step to make PW more wide spread and therefore to make its development and support more economically advantageous, as I see it.
  21. @Alexander - Could you please share your experience with the module? If you got time.
  22. Here in Russia the price of Ryan's commercial modules just multiplied x1.5 with the rise of the dollar. And I did not manage to buy Liser Pro as I intended. I know Black Friday - the day of crazy sales - is comming tomorrow. So I just wanted to suggest PW Store to make a marketing action on this if it is possible)))
  23. You should do something like this. Of course it can be simplified and refactored, but still... echo "UPCOMING<br><br>"; foreach($page->event as $event) { $event_title = $event->event_title; $date_to = $event->getUnformatted('event_date_to'); $today = time(); $date_from_formatted = strftime('%d. %B %Y', $event->getUnformatted('event_date_from')); $date_to_formatted = strftime('%d. %B %Y', $event->getUnformatted('event_date_to')); if ($date_from_formatted == $date_to_formatted) $event_out = "{$event_title}<br>{$date_from_formatted}<br><br>"; else $event_out = "{$event_title}<br>{$date_from_formatted} to {$date_to_formatted}<br><br>"; if ($date_to > $today) echo $event_out; } Same for past events.
  24. Please provide the code you are using now to help us understand what is your problem. As I got it you want to temporary replace 2 items from the WireArray and insert 1 other instead. But it could be a css question as well, so please be a bit more precise.
  25. I am talking about social share buttons specific to country. There are a few of them in Russia. And it so happened they are not on the list of availiable icons )) I do not know if they are going to be important to someone outside Russia so would not suggest them. As it is your module, I just thought that this could be possible it already has interface for extension.
×
×
  • Create New...