Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/16/2017 in all areas

  1. Reading and writing times shouldn't be (noticeably) influenced by the pure size of a volume (unless the physical disk underneath is nearing the end of its capacity or the underlying FS becomes highly fragmented). Enumerating large number of entries (files/subdirectories) in a single directory would likely be a factor, so if you have more than 10k pages, breaking up the flat hierarchy of site directories could be worth thinking about - but even then, structuring them by year wouldn't be my first approach as it is counter-intuitive and has a number of pitfalls (e.g. timezone changes, duplicate files when overwriting, code that assumes all files for a page can be found in the same directory). Here's an example that adds a three-digit parent directory based on the page id that could be a starting point. It ignores the pageFilesSecure option, so be careful with it. You can look at PagefilesManager::___path and Pagefilesmanager::___url how they deal with that and other "magic". Of course, instead of that purely id-based dir, you can have the getPageSubdir function return anything you like. If you want to split your data between volumes, it could just return "old" for page ids < 5000 (or whatever the latest page id on the old volume is) and "new" for those above. /* * Change files path, insert a three-digit directory above, left-padded * with zeroes. This way, there won't be more than 999 directories under * site/assets. * * Subdirectory count won't be an issue unless you cross the million pages * mark. */ wire()->addHookAfter("PagefilesManager::path", null, "modifyPath"); function modifyPath(HookEvent $event) { $p = $event->return; $p = preg_replace_callback('~^(.*/)([^/]+)/~', function($match) { return $match[1] . getPageSubdir($match[2]) . "/" . $match[2] . "/"; }, $p); $event->return = $p; } wire()->addHookAfter("PagefilesManager::url", null, "modifyUrl"); function modifyUrl(HookEvent $event) { $url = wire('config')->urls->files . getPageSubdir($event->object->page->id) . "/" . $event->object->page->id . "/"; $event->return = $url; } function getPageSubdir($id) { return str_pad(substr($id, 0, 2), 3, '0', STR_PAD_LEFT); }
    5 points
  2. Hi, and welcome to the forum. We do have wireshell, which can be used to install modules from the directory by class name. As for Composer, I think that the module would specifically need to support it - widespread implementation hasn't been done as yet, but I'm sure we'll get there in the future. There is a third-party installer for those modules that do support it. Hope that helps.
    4 points
  3. You have two different divs displaying that info, one for large screens and one for small screens, that's why they are different. You can resize your browser window and see it change.
    3 points
  4. It looks to me like there is a typo in the core code that means the Wire::changed method is never called. See here... if(($hooks && $hooks->isHooked('changed')) || !$hooks) { But the phpDoc comments for WireHooks::isHooked say... * If checking for a hooked method, it should be in the form `Class::method()` or `method()` (with parenthesis). So it should have been... if(($hooks && $hooks->isHooked('changed()')) || !$hooks) { ...and if you change to that then the hook starts firing. @gebeer, will you open a GitHub issue for this?
    3 points
  5. @Robin S thanks for confirming. I already submitted a bug report.
    2 points
  6. Hi @rash Maybe you should include include=all to your child selector like if($user->isSuperuser()) { $post = $pages->get("/kompendium/")->child("name=$name, include=all"); } else { $post = $pages->get("/kompendium/")->child("name=$name"); }
    2 points
  7. Once you are in the site->template folder you can structure your files/directories as you like, as long as you link them correctly inside your template folders. And yes, leave site->assets alone You can contact me on skype (my nick is : The3fingers), I'm italian too.
    2 points
  8. Sounds like FieldtypeSelector: Modules > Install > FieldtypeSelector
    2 points
  9. Hi @Mustafa Online Yes, you can do it. Take a look at these similar topics:
    2 points
  10. @Robin S thank you for looking into this. I can confirm that after making the change to Wir.php the hook fires. I will open an issue. EDIT: added issue on github
    2 points
  11. Many of us have used "classical" systems with "system rules" to make websites before using Processwire. Processwire is a decoupled system without any rules. So with Processwire you handle html by: 1. writing your own html code in your processwire template files, 2. including inc files that hold your html code using php include, 3. generating dynamic html code with the processwire api combined with php, 4. etc. etc. etc. So if you see a nice free html template somewhere on the internet that you want to use to make a website, you would have to strip its html code and bring it inside processwire.
    2 points
  12. I would just say, it's no small thing – adapting a CSS theme to be used in processwire requires a decent knowledge of how to use the API, as well as some fairly good experience with HTML and PHP. I can get a basic HTML 'theme' into a simple PW site in around 3-5 hrs, depending on the complexity, and that is using a lot of helper modules and functions that I developed over the years. It depends on the content of the site, how many templates you have and the types of fields you are using. For a 1 page site, it should be pretty simple, you just need to replace the contents of the _main.php file with the content of the html file and then update all of the paths to the assets, using for example a call to the $config variable for the templates folder (e.g. $config->urls->templates . "styles/my-style.css";)
    2 points
  13. you would not imagine how often i have thought that myself and then i found out how to do it the processwire-way and it just seemed too simple with something like a 3-liner "heavy use" of repeater sounds like you could maybe improve/change how you structured your content. in PW thats a very important part of your work. if you structure your project/data well, most of the time you end up with very simple and clean selector-calls like $pages->find('template=product'); // or $page->children('category=car'); of course that's just wild guesses, but if you want to share your setup i'm sure you'll get valuable feedback from lots of knowledable guys (and girls) here
    1 point
  14. Yes. I was thinking about the new users. We seem to be getting a few new members in the forum, which is great! I wonder how many have looked at the site without yet joining.
    1 point
  15. You can avoid some repetition and shorten the way you get field content in your templates like this: // Get the repeater item (the item is a page) $r_item = $page->repeater_field->first(); // Get field content from the item echo $r_item->foo; echo $r_item->bar; echo $r_item->baz;
    1 point
  16. You probably already know this, but the buttons on the download page just link to the current state of the files in the master and dev branches. You can download at any time and get the latest commits regardless of what version number is shown on the button.
    1 point
  17. No, I meant pages of the ajax paginator. However, it was a false alarm as I forgot to update to the latest version, now it works, sorry for this! And thanks as always
    1 point
  18. You mean tree level 1 and 2? There were issues with the thumbs lately, make sure you're having the latest version.
    1 point
  19. Off the top of my head ... 1. Is pagination enabled on that template? 2.
    1 point
  20. @Marc I think you can do the same with hosts.
    1 point
  21. you would be writing php code to communicate with the PW api, to get your dynamic content from the CMS. In reference to the $config->urls->templates, you can take a look at the default _main.php to see how that is being used to reference the themes folder, when you reference an asset (css or js file) that is stored within your templates folder.
    1 point
  22. I would just do a normal page for news ; your sidebar and main content would be separate things, and then your news template shows the $page->body, this way the news pages are indexable, and bookmarkable. the links need to links to the ->url parameter,so if you are foreaching the news items on the sidebar as $item, then the href is $item->url;
    1 point
  23. haha. They seem to be kickin' my behind lately.
    1 point
  24. Actually it is Modules > Core > Selector ...but yeah...
    1 point
  25. Yes, that is what I thought. But it's now Tuesday.
    1 point
  26. I just wonder if there could be usability issues here? I don't know the background, obviously, but displaying a random selection and then making them look 'non-random', isn't that risking misleading (maybe that's too strong a word) users that they are seeing everything when they aren't?
    1 point
  27. I can confirm. Seems like a bug to me - I tried sorting on a range of different fieldtypes in the parent page and they all worked apart from a Page Reference field, which gives the error shown in the first post. @Alxndre', I suggest you create a GitHub issue for this so Ryan can take a look.
    1 point
  28. Are you talking about html mails, where the images are blocked when viewing it? If so that's a setting of each individual email client / their users. That's nothing you can control on the senders side of the email.
    1 point
  29. Hello, I read about conditional hooks and wanted to utilize them. In the process of trying to implement them I found that they do not get called. So I reduced my hook to a minimum wire()->addHookAfter('Page::changed', function($event) { die('changed'); }); And nothing happens at all. Also with Page::changed(title) or Page(template=basic-page)::changed(title) no luck. In the code comment in Wire.php it says: "Hookable method that is called whenever a property has changed while change tracking is enabled" I see that change tracking is enabled as wire()->addHookAfter('Pages::saveReady', function($event) { if($event->arguments[0]->isChanged('title')) die('changed'); }); is working. The hookable method ___changed() in Wire.php is empty. I tried this on 2 different installs PW 3.0.61 and 3.0.62 Can anyone please confirm or let me know if I'm doing anything wrong here. Thank you.
    1 point
  30. https://processwire.com/api/ref/database/query/ Usually missing a closing parenthesis or a backtick or using a keyword in SQL that you have to quote
    1 point
  31. You are right - interesting that this has not come up in the forums before (to my knowledge). Thinking of ways of working around this, I think you'll need to find all your city pages without applying any limit so the random sort is only done once. Then you can "fake" the pagination, getting a slice() of the city pages on each results page. This technique for using array_chunk might also be handy: See this post for how you can use MarkupPagerNav outside of its typical use: If you have a large number of city pages you might not want to load them all into memory. So a couple of approaches you could look into: 1. $pages->findMany() 2. $pages->findIDs() to return an array of IDs, then use PHP's array_slice together with $pages->getById() to load each page of results.
    1 point
  32. The dot syntax for sub-selectors like what you are using should be fine too. The support for this dot syntax was expanded in 3.0.25 to include nested sub-selectors: https://processwire.com/blog/posts/pw-3.0.25/ I think including .id on the end may be redundant though - you could try simply sort=parent.customer
    1 point
  33. Hello @franciccio-ITALIANO, you could start by renaming the HTML files inside your templates folder from .html to .php and add them as templates. But those template files would be still static HTML. So you would have to define some fields for your dynamic content and add them to your templates. Next step would be to output those fields with PHP between the HTML. But this has been already explained more better here: http://processwire.com/docs/tutorials/how-to-structure-your-template-files/ https://www.smashingmagazine.com/2016/07/the-aesthetic-of-non-opinionated-content-management-a-beginners-guide-to-processwire/ (Must read) Regards, Andreas
    1 point
  34. Its just a spotify playlist . If you want to share it you can use the code https://open.spotify.com/user/clsource/playlist/3xl7eUL5ccWacR3V7dz2Er
    1 point
  35. hi novalex! great that you found a way just take care if you have a more complex setup and need some advanced selectors the repeater setup COULD be a problem (or a little harder). if you have 2 regular fields forename and surname a selector would be: $pages->find('forename=john, surname=doe'); if you have a repeater setup, it would be: $pages->find('yourgroup.forename=john, yourgroup.surname=doe'); as long as it is simple like this it will work, but i can remember that it can lead to problems but don't remember exactly... just keep in mind that it could be easier to have "duplicate" fields and simple selectors than the other way round
    1 point
  36. put this in your ready.php wire()->addHookBefore('Page::addable', null, function ($e) { if ($e->object->parents->count > 1) $e->object->template->noChildren = 1; });
    1 point
  37. Don't know if it still functions: https://github.com/Da-Fecto/LimitChildren/blob/master/LimitChildren.module
    1 point
  38. I can't write a working example yet (on mobile) but if you're comfortable with hooks, you can hook into Page:addable and return false (change $event->return) or throw error when the page ($event->object) has more than 2 parents ($page->parents->count)
    1 point
  39. in templates you can do $results = $db->query("SELECT * FROM yourtable"); or in modules $results = $this->db->query("SELECT * FROM yourtable");
    1 point
×
×
  • Create New...