Jump to content

ryan

Administrators
  • Posts

    17,232
  • Joined

  • Days Won

    1,699

Everything posted by ryan

  1. Make sure that you aren't outputting anything the call to $session->redirect(). In order for a redirect to work, it must happen before any output is sent. Also, make sure to sanitize your 'id' variable by typecasting it to an integer: $session->page_id = (int) $input->get('id');
  2. I've always thought that the "template engines make it easy for non-programmers" was a myth, as it really just comes down to semantics and what characters you think are easier to type. But the reality is that template engines give you something like a jailed environment, and that increases the comfort level of some people. The prospect of limitation becomes an asset in that context. It means it's going to be harder to break things, and there is going to be a ceiling on what can be learned. I don't ever want to be in a "jailed" environment with a low ceiling, but also kind of understand the appeal to someone that may have never stepped beyond the likes of EE (which has come crossover with our audience). As we work to broaden the audience for ProcessWire, an alternate template engine for those that desire limitation here may help us to capture new audiences. There is also just the word "PHP", which scares off some, regardless of what is real or what we do. ProcessWire is always going to be an PHP API-driven environment at it's core, but I'm not opposed to adding on template engine(s) as an option for those that want them, in the future. It's something that's not at the top of the list on priorities, but it is something we'd like to eventually offer. They are a little more tricky to implement in PW vs. a system that is built purely for tags. The reason for this is that ProcessWire templates are executed directly by PHP rather than by ProcessWire itself. ProcessWire just hands off some API variables to the templates and lets PHP and the template execute natively. It's nice, fast and efficient. (Other systems like EE actually execute PHP code in templates using eval(); which is slow and inefficient… they hope you won't be using much PHP). The way we'd have to implement a template engine in ProcessWire, while still retaining the speed, is with compiled templates. The template using template-tags would have to be compiled to a native PHP template before it could be executed. Lots of these new template engines are designed to work that way anyway, so not a big deal, but just outlining how it would be done.
  3. You could also do this in your homepage template: echo $pages->get('/path/to/page/')->render();
  4. Try this one: $invoice = $this->modules->getModuleID('ProcessInvoice'); $invoicePage = $this->pages->get("template=admin, process=$invoice");
  5. Can you suppress this error with $config->debug = false; ? If not, we may need to add a version check before calling debug_backtrace.
  6. So long as the servers can share a common file system (or give that appearance), you should be able to set this up. For instance, your /site/assets/ could be a symlink to a dir on another server. But PW needs to be able to scan this directory for files, open files that are in it, and place new files into it when it needs to. PW uses PHP functions like move_uploaded_file(), copy(), rename(), getimagesize() and others to act upon the files in /site/assets/ as needed, which is why they must be accessible as if they were local.
  7. This looks pretty awesome Nico! You should start a separate thread for this release. It looks like it provides one of the important capabilities we want to add in the future, and this answers a lot of questions on how it can be done. Though it looks like it may require that everything be writable on the user's web account, and this isn't the case with any of mine at least. But that can be solved by having the module go through and perform its installation via FTP (which is what the WP installer does I think). I see the unlink_recursive function, which the name of which scares me a little. I'm sure it's completely safe, but just wondering about the option of having it archive (perhaps to some other dir) rather than delete stuff? Either way, this looks like a high quality and ambitious module, nice work!
  8. Marty, I can't take on more work here, but am always available to talk you through how to do anything. I'm guessing that one of the other guys here that might have availability will contact you offline. But if not, post some more detail on what you are trying to do and we can talk you through how to do it (or how to estimate it if that's what you need).
  9. If the content you want to add consists of fields that would be applicable all users, then it's preferable to add them directly to the user template. But if it's content that is only going to be applicable to some users, then may be better to make them child pages.
  10. Right now the field is basically following the rules of PHP's URL filter. I can experiment more with this to see about adding mailto. It does make sense as a possible configuration option as there are many places where you might want to use mailto where you'd also use a URL.
  11. Thanks for the feedback everyone. @Soma: I'd like to support themes, but not really sure how since /site/templates/ pretty much is the theme. I may end up moving some of it to a module so that the theme aspects can be better isolated, but not sure it's the best way to go. I've taken a different approach with the development of this to maximize markup reusability. I'll be curious to have some more eyes on this and see what you guys think is the best way to maximize the flexibility too. @Apeisa: I didn't observe this issue in iOS, but unfortunately I didn't have any other mobile devices to test with. I'm trying to get the profile to be as good of a starting point as possible, so am removing most Foundation-specific classes that are stylistic in any way, so those gradients will be gone in the next version you see. @Teppo: Trackback support isn't there now, but sounds like a good idea for the future. I don't know how to implement it at present (and have never used them), so will do more research. The blockage of the back button is intentional to prevent double posts and allow for potential single-use validation keys. However, the form should have everything they entered in it without them having to click back. Though if they enter an invalid email address, it'll remove it. Error messages have never been comprehensive here, but will be improved as upgrades are made to the Comments field, separate from the blog profile. Thanks, Ryan
  12. There are a number of ways to do this, but for the purposes of an example, lets look at your first one: Brand. Lets say you've got your brands as pages here: /brands/acura/ /brands/audi/ /brands/ford/ ...etc. Your search form might look like this: $checkedBrands = $input->whitelist('brands'); if(!is_array($checkedBrands)) $checkedBrands = array(); foreach($pages->get('/brands/')->children as $brand) { if(in_array($brand->id, $checkedBrands)) $checked = " checked='checked'"; echo "<label><input type='checkbox' name='brands[]' value='{$brand->id}' $checked> {$brand->title}</label>"; } And your search processor might look like this: $selector = ''; if(is_array($input->get->brands)) { $brands = array(); foreach($input->get->brands as $brand) $brands[] = (int) $brand; $input->whitelist('brands', $brands); if(count($brands)) $selector .= "brands=" . implode('|', $brands) . ", "; } $vehicles = $pages->find("template=vehicle, $selector"); Now when it comes to showing something like models, you'd either want the models to have a page reference selecting a brand they relate to, or you'd want to make the models children of the brand. That should make it fairly easy to determine your models once you know the brands: $models = new PageArray(); foreach($brands as $brand) { $models->import($pages->get((int) $brand)->children); }
  13. I'm not sure I understand the question 100%, but I think we need to take a look at the code that actually generates the selector (rather than just the code that generates the form). Also, while developing search engines, I always find it helpful to output the selector that is being used. Once the site is finished with the development then I remove it. But to do this, you may want to add something like this at the top of your search results: <?php echo "<h2>" . htmlentities($selector, ENT_QUOTES, "UTF-8") . "</h2>"; ?>
  14. I don't understand what you mean about "denounced by phishing hotmail", so might need more explanation there, but understand the rest. Whether it's a security hole depends on your hosting environment. If you are in a shared hosting environment and accounts are not fully jailed or virtualized from one another, then a directory set to 777 will be writable by other users that also have accounts on the same server. But in this environment, just changing to a different permission doesn't totally solve the problem either, because the other users can still write to your directory so long as Apache is running as a shared user. Still, the user would have to be on the same server and have an account just like yours, so the culprit will be easy to spot for your web host. Given that they haven't identified a "who", I think it's more likely that you have another software installed on your account (WordPress compromised?) and that any writable directories are being taken advantage of from your own account. Either that, or someone guessed the password for your PW admin account. So check into these possibilities. Either way, inquire with your host what permissions they recommend to make files writable to your CMS. Then update the relevant settings in your /site/config.php. You'll also want to adjust the permissions for files already on the system. I'll be happy to tell you what to do, but we need to know what permissions your host says to use, as what applies to one system may not to another. Best case scenario is that Apache is running as your own user account and that we can remove all write permissions except to you. But even that won't solve a hacked WordPress or compromised password.
  15. The term "block" implies generated output or some understanding of what the final output is. PW is meant to be totally markup and output independent so there is no concept of anything relating to generated output. It may be web-based, but the content it's managing might not be. It's the opposite of something like Drupal. I'm not saying the other systems have the wrong approach, because there are benefits and drawbacks to different approaches. But I've been working on this blog profile for ProcessWire the last couple of days and my mind is entrenched in blocks at the moment. I'm not sure if this is exactly what you are trying to achieve, but what you guys are describing sounds kind of similar to the "widgets" sidebar in the blog profile. There is a multi-page reference field called 'widgets' on the homepage. You select (asmSelect) from different widgets (pages) that you want to appear in the sidebar (i.e. Recent Comments, Recent Posts, Twitter Updates, etc.), and then drag them in the order you want them to appear. All the pages in the site inherent these widgets. When other pages in the site have their own 'widgets' field, it gets prepended to the list of widgets inherited from parent pages. Though I'm thinking about making it override rather than inherit, as I'm just trying to find the easiest to understand solution for new users. But regardless of where it ends up, it was pretty easy to setup: // inherit and append widgets $widgets = $page->widgets; foreach($page->parents as $parent) { if($parent->widgets) $widgets->add($parent->widgets); } // output widgets foreach($widgets as $widget) { echo $widget->render(); } I'm guessing this is still different than what you guys are talking about, but figured it might at least add to the conversation since it sounded somewhat similar to what's already been mentioned.
  16. Currently ProcessWire only attempts translation on page names. There is some overhead with doing it, so we avoid it where possible (like with filenames). If there's more demand for doing this, or if we find ways to make it happen without extra overhead, it would certainly be a consideration down the road.
  17. Not currently, but will keep this in mind for a future version.
  18. I'm not sure I understand: a module that removes rooms for tourists? I don't get it. I have a feeling the link would answer it, but it doesn't seem to work (got a 404).
  19. This is on the list for 2.3, so should be coming soon!
  20. I've been working on a blog profile that we can have as an installation option for ProcessWire. The goal is to have a profile that someone could download and setup a pretty nice website/blog without having to touch any code (i.e. it's ready-to-run and populate). I'm hoping that this is something that may help us to grow our audience beyond the web development community. The requirement is that it must be as easy (or easier) than WordPress, both to install and use. This profile is also for web developers, as it's a blog profile ready to be styled and enhanced -- a good starting point. It uses the Zurb Foundation CSS framework, so it is fully responsive and mobile-ready. It's not much to look at now, but should be fully functional. I'm making progress and wanted to post a preview. The content you see here is from one of my client's blogs and the content is just here to test things out. http://processwire.com/blogtest/ I'm hoping to get this up on GitHub next week. I've never really done much blogging, so am seeking feedback on what others would suggest to make the blog profile as good, powerful and simple as it can be. Right now it's pretty much a generic Zurb Foundation "look and feel", so it probably needs at least some color tweaks and integration of some masthead photo(s) or something.
  21. Great module Diogo! Tested here and seems to work well. I did have to change the selector to "$field.status<1, include=all". I did "<1" rather than "=0" so that it would catch comments marked as spam as pending too. In your getModuleConfigInputfields I recommend removing the "size=200" attribute, as that's causing an overflow issue in Chrome/Mac at least. I would just leave off the size attribute there (unless you need it small), as it'll automatically size to the screen width if you leave it out.
  22. Once PHP 5.4 is pretty mainstream (later this year?) we'll drop support for PHP 5.2 and then use PHP 5.3 namespaces. But lots of folks are still running on PHP 5.2 (including me on a few servers) and I don't see any way to be backwards compatible with PHP 5.2 once we start using namespaces. Still, I'm anxious to get them in the PW core and just trying to find the right time when it'll help more people than it will hurt.
  23. Something that is storing images exclusively on another server probably needs to be a different animal from the existing image/file fieldtypes. Rather than trying to hook into functionality there, I would go and create a new fieldtype so you can start fresh. On the other hand, if the goal is to just keep a copy of any files used at the other server, and then replace references to them at runtime (like when output formatting is on or something) then I think that would be more of a scenario where hooks would be useful.
  24. JS is certainly an easy way to accomplish it for helping the editors. It's more the developers I'm worried about, coding in a manner that expects a field to always be populated, when it may not be technically possible for that to always be the case. But if it's just helping the editors that we need, then that's no problem: there are no technical challenges there.
  25. Not sure about this one. Another user had requested that we add that str_replace(' ', '%20', $filename) in the past because it apparently wasn't working without it on filenames that have spaces (and that's why it's there). Sounds like this behavior may depend on the environment. I would never think to use spaces in filenames for anything like this, so can't say as though I know exactly how to tailor this to everyone. But I've added another check in there and pushed it to the source. Though not sure if this will help in this particular situation or not. Either way I recommend avoiding filenames with spaces as that's not very portable. But give the update a try and let me know if it makes any difference here.
×
×
  • Create New...