-
Posts
4,054 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
To be honest it might just have been server incompatibility in my case, but it was blocking legitimate users too and it was a reasonably wavy traffic site with users from across the globe so when some legit users were being flagged and I didn't have time to look into it further it was easier to turn it off. I will definitely revisit it in future as the concept is amazing and the price is great (free).
-
I wouldn't do it that way though if it's going to be the case that you have pages in multiple locations a lot of the time. Take for example your first structure - most ecommerce packages would handle this y creating the category structure, then adding products and ticking a box in a category lost to assign that product to multiple categories. When browsing the structure you would have a URL of vacuums/wet-vac-cleaning-solutions and under that it would list your product, but when you click on the product it would appear at a URL of something like products/super-clean-2000 I would suggest handling it this way as well, as I'd you use redirects you're essentially taking the user from one category to a completely different category which would make them a bit confused I think. As such, I would make the structure of your categories under a page called "categories" and create a template for those pages called "category". Then create a page called "products" and a template called "products" for it to use. The product template would need a field called "categories" that uses the Page fieldtype which is set up to allow selection of all pages under the category page. You then simply add products and select the categories they appear in When editing the front-end categories template to show the relevant products in that category you can simply use a selector to find all products that are in that category. Sorry, that's a whistlestop tour of how I'd recommend doing it and doesn't sound simple, but it is pretty easy in reality and not as daunting as I've probably just made it sound
-
I never quite got Cloudflare working properly - it worked, but it was blocking legitimate users and caused me issues in PW admin so I quickly turned it off. I think if I approach CloudFlare again I'll definitely do a lot more testing first to try and smooth out the kinks!
-
How to troubleshoot: non-virtual folders returning PW 404?
Pete replied to MarcC's topic in General Support
Silly question, but are the permissions set correctly on Piwik's folder and files? That would be my first guess. Also might be an idea to test temporarily by selecting and cutting all the contents of your .htacess file so it's blank and see if that allows you to access Piwik, then put it back to how it was quickly (assuming it's a live site). -
If you add a hook before page save you don't need the last line where you save the page (it'll do that anyway), otherwise it will infinitely loop as you're making it go in circles. Take out $p->save; and it should be fine.
-
It's not particularly relevant here as something like the above should be fine for a one-off URL, but it might well be possible to create a configurable module in future if this sort of scenario arises again. I can see a simple textares config field with this being able to work for multiple templates, one per line followed by fieldnames to concatenate: template1name,field1name,field2name,field3name template2name,field3name,field1name,field7name That's the easiest way I can think of to do it for multiple templates in the same site and have it configurable with no code edits. Of course the module code above would have to become more complicated to support that, so for a one-off stick with the code above - I'm just thinking out loud and once again being pleasantly surprised by the fact that anything seems possible with ProcessWire.
-
I'm not of much help on the rest of this topic, but since you asked Soma I think the phrase you are looking for is "level of complexity". Your English is still infinitely better than my Swiss
-
It won't affect images or files attached to the page if you change the title or name fields - it's all tied together using a unique ID so you can rename things as much as you like. You would need a custom module to auto-generate a URL concatenated from the fields in question and it would depend on how you have certain things set up. I would suspect Make and Model would be Page fieldtypes (see this video, but you'd want to set it up as a Select or Autocomplete rather than a multiple select). The title field itself would be best left as a stock number I think as this can easily be outputted as something like "Stocknum - Make Model" in the <title> tag in your template (which I'm guessing you've already worked out), it's just the URL you'll need a module for and you'll be happy to know that even that shouldn't be too hard. The module would be something like this: <?php class BuildUrl extends WireData implements Module { /** * Basic information about module */ public static function getModuleInfo() { return array( 'title' => 'Build URL', 'summary' => 'Builds a URL on page save based on specific fields.', 'href' => '', 'version' => 001, 'permanent' => false, 'autoload' => true, 'singular' => true, ); } /** * Populate the default config data * */ public function __construct() { } /** * Initialize the module and setup hooks */ public function init() { $this->pages->addHookBefore('save', $this, 'buildUrl'); } /** * Checks if we're in maintenance mode and performs any neccessary redirects * * @param HookEvent $event */ public function buildUrl(HookEvent $event) { // Accesses the $page object $page = $event->object; // We only want this to apply to a certain template if ($page->template->name == 'yourtemplatename') { $page->name = $page->make->name . '-' . $page->model->name. '-' .$page->stocknum; } } } The code above is untested but should give you a bit of a head start. The code only wants to run before save on a page using a certain template - it then gets the name from the "make" field (so it checks the make and fetches the name value from that associated page) and the same for the "model" field, then attaches the stocknum field (just a plain text field I guess) to the end, concatenated with hyphens. Because it runs before page save there's also no need to call save, but some extra checking would be advantageous as some of those fields won't be populated when the page is first saved (i.e. brand new). To install the module, whack that code in a file called BuildUrl.module and place it in your site/modules directory. Then go to the modules section of the admin and check for new modules, then install it (after making changes to suit your fields and template name). EDIT: Some of the settings at the top (autoload, singular) might not be right as I was doing this in a hurry and don't have more time tonight, and I'm not sure the empty __construct function is required, but left it in in case it broke without it. I'm sure someone else who's around later will improve on it with other suggestions
-
The inputfield and process ones are specific to those modules so it makes sense that they're separate, even if they're core modules. That said, minifying them would save a few seconds on each admin page load - the question is how easy that would be to do (I'd use the PHP minify project personally, but doubt that can be distributed with PW?). It might make things a bit snappier where larger numbers of different fields are concerned, but even with that it's not exactly sluggish (though my live site list of files that's simialar to yours above is only 4.6 seconds max and that's not even localhost!).
-
Memory size limit – works for me, not for client
Pete replied to yellowled's topic in General Support
He's using the mouse left-handed - he should be using his right hand Where's WillyC with his words of wisdom when you need him? -
I suppose in practice I probably do the same as Thomas actually
-
RoR was really big a few years back with a lot of hosting companies scrambling to support it on their servers - presumably to cash in on the craze. I've just not seen much done with it though. If someone asks you to code in it and you're trying to get back to the safety and comfort of PHP, it's always handy to be able to say things like "Google and Facebook both use PHP and look what they can do". Obviously it you're talking to a client who's part of a large organisation, half their staff may be on Facebook most of the time so probably best not to mention that one and stick with Google as the example
-
It's to do with keeping the indentations inside your echo lines as well: Assume for this example that you're going to echo each part of an unordered list with a new echo per line: echo "<ul>\n"; echo " <li>Something here</li>\n"; echo " <li>\n"; echo " <ul>\n"; echo " <li>Nested</li>\n"; echo " </ul>\n"; echo " </li>\n"; echo "</ul>\n"; You can see that I've put the indentation in as part of the echo line so it will retain that spacing when echoed. The \n simply returns a newline so the next element in the source is on a new line. I also could have written it like this: echo "<ul>\n <li>Something here</li>\n <li>\n <ul>\n <li>Nested</li>\n </ul>\n </li>\n </ul>\n"; Sorry - I forgot that there's a bug in the forum editor at present that messes up indentaions, but hopefully you get the idea.
-
Ah, okay - I wasn't aware of that. A good Java uploader I've used before is JavaPowUpload - it's not free, but it is really good and pretty simple to get going with. The advantage of a Java app is that you can upload and download entire folders, maintaining their structure. In the case of one site I was working on, the files were stored in numbered folders (somewhat like PW) and folder structure for downloading them was based on nested pages (thing nested pages in PW), so the download function built the folder structure on the fly. It was hard work, abut satisfying when it worked
-
I think it depends solely on the max filesize limits on the server. Technically the page shouldn't timeout so you won't have that problem in theory with the current file upload field.
-
I'm sure ryan mentioned something about doing that recently... just can't remember where. EDIT: Soma beat me to it.
-
It does need a lot of attention ryan - the other instance I occasionally upgrade and install extensions for has a lot of admin-level users that can keep on top of spam, as well as a barrage of extra plugins. Even then it's not foolproof
-
ProcessWire Conference 2013 / London / Cambridge
Pete replied to ryan's topic in News & Announcements
Never heard of it. -
-20000 is fun - it's like he's cycling very fast on a rug on a smooth wooden floor (the rug would move but he wouldn't) and the background is attached to the rug It's like having many extra pairs of eyes looking over your work for free which is very useful indeed, but I'm sure that's not exactly what you meant - more the fun aspect and the collaboration Back to the site, it might be worth changing the shortcut from CTRL+1, but to be honest I didn't know that shortcut existed for FF to switch tabs until today so I think it's unlikely anyone will notice. Plus, if anyone presses that and views the site and is curious then they could have fun with the input field. Thanks for letting us know how it was made. I want to check that out now as it sounds like fun - hard work but fun!
-
Okay, it's installed now and makes editing the wiki MUCH easier.
-
Wow, if I'd have known that was around back in 2010 teppo I'd have installed it on the other MediaWiki site I maintain - the mind boggles as to why they don't include things like that in the core distribution as for a wiki that would surely increase participation by a huge amount, or at the very least aid in terms of legibility I'll look at installing that one soon. EDIT: hang on, it is in the core by default, must just not be switched on by default which is slightly odd.
-
I thought I was going mad as I've looked at this site a few times the last few days from a couple of different machines but I don't see a header animation: But then I realised that it just took ages to load for me The problem is that until it loads, the site looks like the above. Is there any way to have a loading graphic or something to prop the page open? My only worry is that until it loads, it looked broken to me and might do to others. Only other issue is that whilst pressing CTRL + 1 opens up the slider in Chrome, it switches to your first open tab in FF and sticks in a nasty input field under the animation on your site, which I don't think is intended either. It's awesome typing 200 into that field though as he rides like a maniac then Increase it to 20000 and he starts cycling so fast the scenery moves backwards 20000000 and he cycles on the spot! Other than that, the animation is awesome - great work! I've not seen something this good before that wasn't Flash-based and it's top quality stuff
-
Modules are cool - apeisa's right In fact, modules don't just have to do one specific task or set of tasks - they can be a whole application (see his shopping cart application http://modules.processwire.com/modules/shopping-cart/ or the discussion forum application: http://modules.processwire.com/modules/discussions/ for examples). I'm personally thinking of developing a few modules to sell as a service to prospective clients (management of their own clients/services is about as much detail as I can go into just now) as well as to see what I can do with PW since I've not done too much myself with the PW admin interface. These are pretty much going to be applications by the end of it, but all I mean by "application" is that they will simply just be a collection of installable modules that are grouped together and reliant on one another. Hopefully I'll be a bit careful about how I build a couple of the modules as there is some crossover, so I could create some base modules to extend for each specific app
-
No probs - just wasn't sure you'd seen that page yet and it helps to include the link to explain it for others who might have similar questions. The best way probably is to see if there's a module that does something similar to what you want and take a look at the code. The triple-underscore thing is literally just for hooking - I don't think there is anything else like that that springs to mind - most of the things you might do in your module are going to be a mix of regular PHP and the API. If you explain what you're trying to do we might be able to give more specific help, but your last question is a little broad as it depends on what your module is doing - since a module can do pretty much anything you can think of (within the confines of what it's actually possible to code in PHP) then there's no easy answer to that one
-
This would be a good starting point: http://processwire.com/api/modules/ Anything with 3 underscores is hookable, so in the init function on that page you can hook into anything with 3 underscores.