Jump to content

ryan

Administrators
  • Posts

    16,715
  • Joined

  • Last visited

  • Days Won

    1,516

Everything posted by ryan

  1. Whenever I run into strange errors like this, I clear the APC cache. And it usually fixes it. It sounds like that probably wasn't the issue in your case, but I have found that APC (or other PHP opcode caches) occasionally get confused and need to be cleared.
  2. JqueryWireTabs also has an associated JS and CSS file, so you'll want your template to include those: <?php $modules->get('JqueryWireTabs'); ?> <link rel='stylesheet' type='text/css' href='<?=$config->urls->JqueryWireTabs?>JqueryWireTabs.css' /> <script src='<?=$config->urls->JqueryWireTabs?>JqueryWireTabs.js'></script> Or you can do this, since JqueryWireTabs populates $config->scripts and $config->styles with the right entries (as do most PW modules that use CSS/JS): <?php $modules->get('JqueryWireTabs'); foreach($config->styles as $url) echo "<link rel='stylesheet' type='text/css' href='$url' />"; foreach($config->scripts as $url) echo "<script src='$url'></script>"; ?>
  3. Something to add to WillyC's example is checking whether the given page is active for the language. This is only necessary if you are selectively having some pages published in one language and not in another (meaning, you are using the "active" checkboxes to the right of the language-specific page names). echo "<ul>"; foreach($languages as $language) { if(!$page->viewable($language)) continue; // check if page not published for this language $class = "$language" == "$user->language" ? "active" : ""; $url = $page->localUrl($language); echo "<li class='$class'><a href='$url'>$language->title</a></li>"; } echo "</ul>"; The only change I added above was the if(!$page->viewable($language)) continue; That makes it skip over languages that aren't published for $page. If that check weren't there, then the user would just see a 404 page when attempting to view in the unpublished language.
  4. The only two of those that are PHP functions are dirname() and basename(). As far as I know, filename() and extension() are not PHP functions? So I'm not sure what you mean when you say "emulation of PHP's filename which returns the basename without the extension"? But I think I can tell you how to get the result you asked for of "basename without extension": echo basename($file->filename, '.jpg'); // substitute .jpg with extension you want to remove.
  5. It's not a bad idea to throw a 404 in that condition. Though the only way someone could access such a page is by manually editing the address bar URL. But if you want to account for it, here's how you could do it: $results = $pages->find("your selector goes here"); if($input->pageNum > 1 && !count($results)) throw new Wire404Exception();
  6. See the custom options reference on this page: http://processwire.com/api/modules/markup-pager-nav/ Though if you are just trying to wrap the pagination with a div, then you could also just wrap the output that it returns to you. The FieldtypeComments::findComments() function was added in 2.2.9.
  7. Sounds like you've got it right.
  8. Nothing will be as fast as going straight to a dedicated targeted SQL query like that. But if you wanted to use PW selectors, this is still quite fast: for($n = ord('A'); $n <= ord('Z'); $n++) { $letter = chr($n); $cnt = $pages->count("surname^=$letter"); echo "<li>$letter - $cnt people</li>"; }
  9. Global shouldn't be used with repeaters. Sorry guys, I thought I had that option disabled. I will fix.
  10. Manual sorting is intended for reasonably sized lists, like navigation. For large groups of pages that have a chronological basis, you should always use some kind of date sorting. If you need to go outside that in certain instances, then add a "sticky" or "featured" checkbox, so that the client can override what gets shown first on the front-end when they want to. For example, if we wanted to retrieve a list of all news articles by date, but with "featured" ones showing up first, we could do this: $articles = $pages->find("template=article, sort=-featured, sort=-date");
  11. Here you go: http://modules.processwire.com/modules/fieldtype-text-unique/
  12. I've looked into this, and don't think it's got anything to do with use of a language pack or admin theme. I tried executing the query manually in PhpMyAdmin and MySQL simply doesn't trigger an error when inserting duplicate values. It just skips the query. Maybe there are some conditions under which it will report an error, but not that I could find. I think the problem is that the query for inserting/updating fields looks like this: The "ON DUPLICATE KEY" part is where it's at. But we need that, otherwise we'd have to add another select to every insert/update just to see if something is already present. So it looks like any future fieldtype that supports a UNIQUE index would have to implement it's own savePageField() method with some more overhead to check things out and decide whether to insert or update. As a result, you can have a UNIQUE index right now, but it's just being enforced rather than reported. But making a new FieldtypeTextUnique or something like that would be a way to solve it pretty easily.
  13. Blowfish hashing was added to PHP in 5.3, so any version 5.3 and newer supports it. However, a security problem was found in versions of PHP 5.3 prior to 5.3.7, so they fixed it. Newer versions of PHP are still compatible with the old, but versions prior to 5.3.7 are not compatible with passwords generated on newer versions of PHP. Since your host is using PHP 5.3.3, this is likely why you ran into an issue. But a commercial hosting provider should probably not be using a PHP version earlier than 5.3.7 due to that security issue. So the workaround is probably not a good idea since it is circumventing that. I strongly recommend asking your host to upgrade the PHP version.
  14. For storing that scale of data, I think you'd want to have your module create it's own DB table(s) to store it in. Several modules do this. They create their tables via the __install() method, and drop them via the __uninstall() method.
  15. While I don't understand what WillyC is saying, his code is correct. Try "body%=grass, body%=seed" so that you are requiring both terms to be present somewhere in the target text. While that would match 'grasses' and 'seeding', it would also match 'seagrass' and 'birdseed', which you may not want. In that case, you would want to replace the %= with *=, which will use the fulltext index. Because the individual words are indexed, it would match 'grasses' and 'seeding', but not 'seagrass' and 'birdseed'. Also your raw SQL would not work because it would only find fields that begin with the word "grass" AND "seed" – an impossible condition.
  16. Soma, while I wasn't able to duplicate that here, I was able to find a bug when using just parent.title, so I'm wondering if it might also be responsible for the result you were getting. Can you try the latest dev branch and let me know if you are still experiencing the error?
  17. This is true as the requests are delivered as static HTML files. So it doesn't touch the DB unless the request isn't cached. It is a great way to let your server handle a lot more traffic. But regardless of what caching is in place, if you start to see a "too many connections" message regularly, then it's time to talk to your web host to see if the amount of traffic you are getting would benefit from a higher-end hosting plan. There are also cases with some web hosts where the resources are simply oversold and you might see those kinds of MySQL error messages even if you aren't getting a lot of traffic. In those cases, it's a good idea to find a new web host.
  18. You can get by without the symlinks option. It's there because I tend to make regular use of symlinks, and am guessing others do too. But nothing in PW actually requires it.
  19. If something triggers a fatal error, then the save can't be performed. Attempting to move a page somewhere that it's not allowed aborts the save. Also, template changes are confirmed with the user if the new template contains different fields. As a result, it has to be handled as a separate operation.
  20. The "missing required field" error message is translatable in this file: /wire/core/InputfieldWrapper.php
  21. Textformatters are intended for front-end rather than back-end. So you won't see the results of a Textformatter in the admin side. However, if you apply the SmartyPants Textformatter to any text field (Fields > edit field > Details > Text formatters), you should see the results on the front-end.
  22. I'm planning to bring the same import/export system that's in FormBuilder to Fields and Templates.
  23. What you are describing sounds very much like a custom application. It also sounds a lot more like a CRM than CMS. You could certainly do it in ProcessWire, but you are going to be in for some custom coding no matter what system you build it in. Whether using ProcessWire or another system, I recommend that you hire an expert to build this for you. Also, since everything you've mentioned is more specific to a CRM, I also recommend evaluating software like Salesforce for your needs. You can easily send data submitted from a website into into Salesforce using their web-to-lead forms. ProcessWire Form Builder can also submit data to Salesforce (and other services) natively.
  24. The ProcessWire 404 will look like your site. The Apache 404 will look like plain text. Though I actually think this is mod_security either way. I think this is something that only your host can answer. Though if someone else knows better, hopefully they will reply.
  25. I was wrong, the PageList won't work without Javascript at present. ProcessWire just delivers JSON for the PageList, and the markup is actually rendered in Javascript. Try this URL for an example of the output that ProcessPageList produces: /processwire/page/?id=1&render=JSON
×
×
  • Create New...