Jump to content

Pete

Administrators
  • Posts

    4,046
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. Pete

    Client of the Day

    I'm now on page 70-odd of stories on the Clients from Hell website... it's a bit addictive, and quite amusing
  2. Cheers - I forgot I had similar in place for page edit as well! My next message as about not having template edit access, but I figured I could save a lot of headaches by just allowing the right permissions on the template (though I did see your note on the subject here: https://processwire.com/talk/topic/371-page-specific-permissions/page-2 ).
  3. So my edit function works great, but my add function fails to override the correct permissions (I'm happy overriding permissions because the users can't see the page tree to cause mayhem and I will have other checks in the code too). I was trying to do something like this: public function executeAdd() { $this->fuel->breadcrumbs = new Breadcrumbs(); // start with a fresh breadcrumbs list $this->fuel->breadcrumbs->add(new Breadcrumb($this->config->urls->admin . 'mymodule/', "My Module")); $this->fuel->page = $this->page; $this->fuel->page->addable = true; $addForm = $this->modules->ProcessPageAdd; $addForm->parent_id = $this->page->id; return $addForm->execute(); } However $this->fuel->page->addable doesn't seem to want to work. I'm probably missing something obvious, but any suggestions?
  4. Pete

    Client of the Day

    Did you have fun explaining it to him in that last example? Please paint a picture of the look on his face (using words, not MS Paint ).
  5. Can you not just do this when they submit the text field containing the URL? $pic->add($input->post->your-text-field); Not sure it works with URLs but that's the way to test it
  6. Exactly what Soma said. What you are trying to do above when you say $page->title works sounds like you're trying to find all pages with the template "child-template" that have the current page in the "provincie" field, so you don't need to do anything more complicated than this (because $page is the current page): $selects = $pages->find("template=child-template, provincie=$page->id"); Or if you don't specify a field on the end of $page then it returns the page ID anyway: $selects = $pages->find("template=child-template, provincie=$page"); It sounds like you're trying to find other pages that relate to the page currently being viewed, so you should always try matching the current page's ID, assuming "provincie" is a Page fieldtype? For that fieldtype pages are stored using their IDs. UrlSegments is just over-complicating things at this stage
  7. Would you like to export it as a site profile for ease of installation? All you have to do is install the Profile Exporter module to create a profile from your setup and then people can install ProcessWire using this profile.
  8. EDIT: I edited my posts because millions of rows will slow down a search, but you have to ask yourself when you expect to encounter millions of rows in your database? Comments on a news site maybe, but then when are you ever going to want to search the contents of a comments field across all articles? It's all relative to what your scenario is.
  9. I know IPB (this forum software) has an archive feature, but it's only worth it for forums when you reach many thousands of posts and want to archive some stuff that you don't want to search. I just did a whildcard search on the forum database for these forums over the 59,000 posts and it took 0.2973 seconds! Add on maybe a second or two when we get to 590,000 posts and it's still not that big an issue (though I would consider Sphinx or something by that point). For large numbers of invoices/bookings/whatever if you simply use sensible selectors in your templates then there isn't really an upper limit aside from disk space. For example, only returning small result sets (25 or 50) and paginating, or offering filters to specify date ranges etc. You will very rarely want to return thousands of results in one massive list, and even if you did you certainly wouldn't want tens of thousands, let alone millions, so you're very unlikely to ever try and pull in every row of a database into memory - you're more likely to want to filter your results to find something. If your tables are properly indexed (I think in PW the equivalent is that your fields would be autojoin ) then hundreds of thousands of rows are just taking up space, not slowing down queries significantly. Now, when you get to queries where you want to search the body field which contains unknown content length for a specific word and you have millions of rows, then yes - that will probably take a lot of time. If you want to do things like that then something like Apache Lucence or Sphinx will be the option to go for. I wouldn't worry about it too much though to begin with. I used to get into a habit of thinking "what if my site reaches this size" and you generally find that you don't have to worry about it for several years or more, by which time there will be other technology or improved technology available to help you out (the next Lucence or Sphinx for example). So if you implement a solution on day one of your site/application but don't need to worry about such volume in your database until year 2+ you'll probably only have to update your code anyway to make use of newer technology
  10. The sky is the limit really, I hooked up Processwire to this forum software at www.StrategyCore.Co.uk but it really depends on what you want to do.
  11. I've heard the "unoptimised script" excuse with different software on different hosts over the years and it always ticks me off when you're using software you know is properly configured and can handle the load. If nothing else I feel your pain
  12. Why wouldn't you be able to store it in the database though? A database still exists on a disk so your only limitation is disk space and server power (assuming lots of pages means lots of visitors). It would be more worthwhile looking into caching options instead I think. Something like the ProCache module (see the Store link at the top of the forums) caches your pages as static HTML so the database doesn't get queried for users who aren't logged in and is a relatively simple but really massive speed boost whilst taking a lot of load off the server (neither PHP or mySQL get touched for ProCached pages). If you have some really complicated page templates, ie. lots of fields in an invoices template that will have hundreds of thousands to millions of rows etc, then it can be worthwhile building a fieldtype specificaly for it so that it acts like a normal table and all the fields are in the one table in the database (less queries to join all the data). I would definitely investigate other options first, but always remember that a database exists on a disk so is theoretically only limited by hardware if your queries are built well. What size site do you have that is causing you to ask about this anyway, if you don't mind me asking?
  13. I've gone back to marking one of Soma's answers as the "solved" answer purely because his way doesn't require the extra pages, though both ways work. For those who are curious, you can use Soma's code in the executeEdit function and this in the executeAdd function to avoid the requirement of extra pages: public function executeAdd() { $addForm = $this->modules->ProcessPageAdd; $addForm->parent_id = your_parent_page_id; return $addForm->execute(); }
  14. Ha, oh yeah - forgot it was under wraps I feel so silly - that's kind of obvious now you mention it I'd love to see the code behind that page - it's a bit further developed than mine is but in the same direction I'm heading.
  15. Okay, marking Tom's way as the answer. In conjunction with this code in my autoload module I can even have the breadcrumbs displaying correctly: // In init: $this->addHook('ProcessPageEdit::execute', $this, 'articleBreadcrumbs'); public function articleBreadcrumbs($event) { $page = $event->object->getPage(); if ($page->parent == $this->kbHome) { $this->fuel->breadcrumbs = new Breadcrumbs(); // start with a fresh breadcrumbs list $this->fuel->breadcrumbs->add(new Breadcrumb($this->config->urls->admin . 'knowledgebase/', "Knowledgebase")); return $this->fuel->breadcrumbs; } } Since two correct answers were given in this topic I feel a bit bad changing it, but I'm sure Soma won't mind (look at the amount of likes he's had!!).
  16. You know, I hadn't thought of doing it that way Tom - kind of obvious now I understand what you mean
  17. Soma's solution works perfectly. I did have a look at the source and see if the page ID was in a field or something since it wasn't pulling it from the URL, but I guess it's something else. Doesn't matter too much as it works now. Thanks guys! Ha, but now my custom admin page isn't correctly highlighted in reno's new admin theme. Guess I can't have everything though hey?
  18. I'm not setting the custom admin page as ProcessPageEdit though if that's what you mean?
  19. Hmm... it is something to do with kb_category=page.kb_category so that narrows it down. When I remove that it's fine.
  20. Ah, you're right for the majoirty of fields - my issue appears to be with a very specific field I have. I have a select field called "category" with hardware and software as options (these are pages created using a config template) and depending on which one you pick a select field appears for subcategories for either hardware or software. When I edit the page in my custom module, the subcategory field doesn't load any options or show my selected option after save. If I go to edit the same page in the normal way, without saving it, the options are there in the subcategory field and the correct value is selected. Something about using the "custom selector to find selectable pages" option for this subcategory field isn't populating in my custom module. That selector looks like this (not that I think this is the issue): parent=/config/kb-subcategories/, kb_category=page.kb_category
  21. I want to include the page edit form in another module. This can be achieved by doing something like this and the edit form loads perfectly: public function executeEdit() { // Change the breadcrumbs to be something related to our custom module instead of Admin > Pages > etc $this->fuel->breadcrumbs = new Breadcrumbs(); // start with a fresh breadcrumbs list $this->fuel->breadcrumbs->add(new Breadcrumb($this->config->urls->admin . 'myeditpage/', "My Awesome Edit Page")); $processEdit = $this->modules->get('ProcessPageEdit'); return $processEdit->execute(); } However when you save the page it says it has saved but none of the changes are saved. Any ideas what I might need to do to get this working? It's basically for an Intranet system where I don't necessarily want people to have access to the Page tree but want to be able to use the normal PageEdit form to save effort on replicating its functionality unnecessarily.
  22. Pete

    Client of the Day

    Has he been having an 18 year snooze or something?
  23. Pete

    Heartbleed

    Oh, and the other panicky information I hate at the moment is that some sites are recommending change passwords immediately when the correct course of action is probably to change them in a few days so services you use have a chance to patch their servers - otherwise you may get complacent and think you're safe but the server may still have been compromised. It's a bit of a mess to be honest, but most companies seem to be reacting swiftly. One thing I will be trying to do is keep a comprehensive list of sites I have an account with in future.
  24. Pete

    Heartbleed

    I know Servint updated servers as soon as the patch was released, but if you want to check for yourself and are on a Linux server then this is really useful: http://blog.servint.net/2014/04/08/patching-heartbleed-bug-openssl/ There seems to be a lot of panic over it to be honest and not enough clear information that mainly affects Linux servers, and not enough helpful links like the one I just posted to see if you're affected. If in doubt though, contact your Web host.
  25. His is the one I was talking about - read his first line of code and re-read my post EDIT: specifically his first line of code should say $_SERVER and not $_SEVER in it.
×
×
  • Create New...