Jump to content

ryan

Administrators
  • Posts

    16,788
  • Joined

  • Last visited

  • Days Won

    1,537

Everything posted by ryan

  1. I like Dragan's approach if you don't mind mixing JS into the CMS side of things. Whether that's a good practice or not really depends on who's going to be using the admin. If you want to keep this on the development side rather than the content side, one approach I've used is to keep JS files named with the ID of the page. When a JS file existed that matched the ID of the page, it would be included in the <head> section. Example: <?php $file = "scripts/$page->id.js"; if(is_file($config->paths->templates . $file)) { echo "<script src='{$config->urls->templates}$file'></script>"; } More often, I use this approach with the template file, i.e. have a file named basic-page.js that gets included on any pages using the basic-page template.
  2. Looks like a good one SteveB! I look forward to it.
  3. Looks fine to me MarcC. My process here is pretty much identical to Horst's. Over the next couple weeks, I have to import 3000+ pages each with 10-50 photos. When doing large quantities, you may need to paginate it, or run it multiple times, if you run into any memory issues. Check if the page you are creating already exists and skip it if it does. Something you may also need at the top of your PHP file is: ini_set('max_execution_time', 60 * 60); // give it an hour.
  4. If it requires ProcessLanguageSupport, wouldn't you want it to be "requires" => "ProcessLanguageSupport" ?
  5. The new inputfields.js from the dev branch will attempt to maximize the row with the columns that are in it. If the total does not add up to 100%, it will expand the last visible column to fill the row. I'm guessing this is what you are seeing? This behaves well with the default admin themes (both old and new), but I've not tried Futura Remixed yet. It's possible that theme may need an update if it's not something we can work around. Dependencies are the field names are they are in the markup (id attributes). While I've not tried it, you may be able to get it to work just by using the parent field as it's named in the markup, which is "parent_id". However, you could only match the ID (number), you couldn't match something like parent_id.template=home.
  6. In order to store a file, you need to associate it with a page. Each page has a dedicated location where it can store files. In your case, it may be better to accomplish the functionality you are after with a template (and a page using that template) rather than a module. Though if you wanted it to be a module, you could always create it as a Process module that can handle uploaded files. The ImportPagesCSV module is an example of that. But I honestly think the simplest path is to use a template.
  7. The admin is intended for administrators or site editors, so it's not a place to send general users to. It sounds like you might be having these users modify a profile page? This is stuff you can easily code using the PW API on the front-end, and that's the recommended way to do it. There are some examples here in the forum, but let me know if you can't find them and I can track down some examples.
  8. I think this particular one might be fixed on the dev branch, as I recall hitting the same issue a couple months ago. But the intention is that you shouldn't ever have to use trackChange() yourself unless you are writing a module or doing something out of the ordinary.
  9. 2.4 is not PHP name-spaced. I got started with it and realized it was going to create headaches for many web developers having to namespace all their template files (not to mention modules). This is extra baggage that most of our audience would not appreciate. So I've put it off to one of the next versions when I can find a way to do it that doesn't require gratuitous verbosity to people's template files. I think that's possible with a built-in template compiler, but that's a bit more work than I was looking to get into for 2.4. If for some reason that doesn't work out, then we'll pen the namespace change to PW 3.0 when a major version would be more amenable to an upgrade that may require changes to one's template files.
  10. What version of PW? What happens if you change 'booked=0' to 'booked=' or 'booked=""' ?
  11. It seems like we should be able to change that behavior but I can't initially figure out why it's not accepting your argument to the render() method. Just to be clear, $slider is an individual Page (rather RepeaterPage) and not a PageArray? And the render() method is intended to be Page::render? One possible factor may be that repeater pages have their own class: RepeaterPage rather than Page, and this might be interfering somewhere along the line, but not yet deep enough in the code to see where.
  12. I also would like to make it more configurable, and definitely plan to. But in the short term, I think the best bet is just have it not show if there aren't any add-ready templates to populate it with. I will do this before 2.4 is final, but just wanted to keep it there with a little instruction notice to introduce it, as I thought people might not realize the option was there otherwise. Thanks for the screenshot comparison. It looks like the "e" also has the same issue with the bold Open Sans, though to a lesser extent. I notice the 12px size seems to look fine with both by comparison. Is the problem just the 14px font size with these fonts in Windows? Would using a different size (bigger or smaller) as a default be better in the Windows environment?
  13. Without that setting, pages like Home and Trash would retain those labels unless the the LanguageSupportFields module is installed. Since this is an optional module, I figured the system pages should still be translatable via a language pack.
  14. What's on line 71 of that file? Was the PHP version downgraded in the transition? Make sure you are running PHP 5.3.8 or newer on the new server. The table for the field may exist, but does it have an entry in the "fields" table? That error message would suggest it doesn't. I am guessing the database didn't successfully import to its new location. I would try to re-import the whole thing.
  15. I'll try to get this one in later today. This is actually the intended behavior because names specified in each language may not be unique. For example the spelling of Chocolate is the same between English and Spanish. But there are many examples, and it's very common to have the same page names across languages. As a result, "name" in a selector refers to the actual page's name, and not it's name in another language. While names aren't unique for the same page across languages, paths are unique (otherwise PW has no way to determine the language) so that's why your retrieval of the path worked but the name didn't. This is one that we can feasibly get working without too much trouble, if there's a need for it. One way you could do it is to change your "name" selector to a path selector: $p = $pages->find($page->parent->path . "namefor_german");
  16. I don't know enough about the Facebook API to know what's wrong here. But I would guess the Facebook authentication is failing and that you need to retrieve an error code or error message from it in order to know why. Does it have some kind of getError() method that you can call? Also your try/catch block is pointless here, as there's nothing with your try/catch block that can throw an exception. But I'm guessing that's just there as a placeholder that you'll be populating later?
  17. ProcessWire's permissions system is designed to deal with groups of pages (by template). When you get into wanting to assign permission for a specific individual page, the best way is to use your own code to identify the page. An example would be a hook in /site/templates/admin.php wire()->addHook('Page::editable', function($event) { if($event->return) return; $page = $event->object; $user = wire('user'); // if page ID is 123 and user is "joe" allow edit access if($page->id == 123 && $user->name == 'joe') $event->return = true; });
  18. Not currently with this module. Though you could write a quick file to do it for you. Place the following in your web root where ProcessWire's index.php file is, perhaps in a file called fix-names.php. Then load it in your browser. <?php include("./index.php"); // bootstrap PW $items = wire("pages")->find("template=your-template"); foreach($items as $item) { $name = preg_replace('/-s(-|$)/', '', $item->name); if($name != $item->name) { echo "<p>Changing $item->name to $name</p>"; $item->name = $name; // $item->save(); } } Uncomment that $item->save(); after you run it the first time to make sure it's doing what you want. I wrote the above here in the forum and haven't tested, so it may need tweaks.
  19. Alessio, i think your solution might be the one we've been looking for. While sleepValue() would ideally return a float, that's just not possible here unless MySQL recognizes the same float format as the PHP locale (which apparently it does not). So converting to a string actually seems like quite a good idea. I am going to make this change on the dev branch and test it some here, but so far I think this seems like the best solution.
  20. It looks to me like the database did not successfully transition to the new server. You may want to re-import your database and double check that all the tables are present that were present in the previous environment. Also make sure you've got the right credentials for logging into the database configured at the bottom of your /site/config.php file.
  21. For Soma's code to reset the password above, you might also need to add a $u->of(false); to turn off output formatting, before doing the save. But the "request aborted" message you are getting makes me think there's a file system write problem and sessions aren't saving. Your actual /site/assets/ might be writable, but is everything in it writable? I'm guessing not. You probably need to do a recursive reset of the permissions in there so that the server can write to it. On a unix system where you wanted to make it globally readable/writable you'd do it like this: chmod -R og+rw /site/assets/ That may not be the appropriate setting for your server, so it's one to check with your host about if you want to ensure the best security.
  22. It's hard to tell for sure without knowing the full scope of your user, role and permission settings as well as other things about the context. Keep in mind that a user can have multiple roles, and they will gain the combined set of permissions from those roles. Also keep in mind that these roles are activated for pages on a per-template basis with each templates' settings. If the combined permissions for a user don't allow them page-move or page-sort permission, then they shouldn't see a "move" link in the page list, nor should the see a "change parent" section in the page editor. Of course, this can all be overridden by modules and hooks. But I don't see anything in the code you've posted that would indicate it's overriding either of those permissions.
  23. Not sure I understand the question? But I'm guessing you might be talking about caching. You could certainly cache (and probably should), using the caching features at the template level.
  24. There is actually a redirect between the form save and the next form edit. Meaning, you don't get to see anything when the form is actually saving. For debugging purposes in this case, you can use $this->message("your debug message"); and it will be queued for the next page view. If it helps with debugging, you can also temporarily comment out the $session->redirect() in ProcessPageEdit.module.
  25. If new posts are working and not old posts, then it definitely sounds like a directory permissions issue. Most likely the directories represented by the old posts are under a different account ownership than the new ones.
×
×
  • Create New...