Jump to content

Jan Romero

Members
  • Posts

    612
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Jan Romero

  1. It’s not a mouseover, but I think you’re looking for something like Soma’s Field Helper module? It also provides links to edit the fields. Very helpful. http://modules.processwire.com/modules/helper-field-links/
  2. Sure, as long as the name is unique enough for you to put it in your selector. You may also want to look into urlSegments. For this purpose, they’re basically the same thing, but with prettier urls. For example the url might be /mycategory/atlanta/, where atlanta is a urlSegment. It doesn’t exist as a real page, but you can access it with $input->urlSegment1. Or something like that. I'm on mobile, so just check out the docs on urlSegments. It’s very easy to implement. Just always make sure you only accept values you expect, and sanitize your stuff. In case of this example, you’d use $sanitizer->pageName().
  3. Are you familiar with $input->get? You can simply accept a city argument on category pages and vice versa. On your category page, you list cities like so: foreach ($cities as $city) { echo "<a href='{$city->url}?category={$page->id}'>{$city->title}</a>"; } On the city page where that link leads, you accept the argument "category": $category = $pages->get($input->get['category']); Now you know the city and the category to search for. Refer to the docs for more info on $input. Note there are several other ways to solve your problem.
  4. There are multiple ways of doing what you seem to describe. Check out the fieldtypes repeater, multiplier, page, and pagetable, for example. Some of these are ProFields that you can license for little money. Which one is best suited depends on the kind of data you want to store. You can’t add the same field to a template multiple times. You either have to use one of the repeating fieldtypes that work similarly to image/file, so you can have multiple values per page, or create more fields. For example, it might make sense to have a field for a phone number and another for a fax or mobile number, instead of one repeating field where it might be difficult to tell which is which after the fact.
  5. Email and phone are extremely annoying in Firefox desktop as well. They’re very picky and don’t work well with standard keyboard commands. My first instinct was that the tab key takes you behind the @, instead it took me to the next field and threw out all my previous input. Then I tried End, which didn’t work at all. It never occurred to me that you have to type the @ yourself. Also pasting doesn’t work and neither does arrow-down to show the browser’s suggestions. Those are probably the most common ways people enter their email addresses. +1
  6. Your images field is probably set to Automatic because you use it for multiple images in another template, but for user profiles you limited it to 1, which means you don’t have to use →first(). You can also configure the field to always give you an array, regardless of the max-setting. Then you have to write →first() every time, but you’ll always know what you’re working with. Maybe a single image should throw a descriptive exception when accessed like a WireArray.
  7. No. If you really want to use this textfield approach, use muzzer’s technique and make sure every area is wrapped in pipe symbols, so you can select areas %= '|$area|'. However you should be aware that that’s not a good idea at all. If it’s at all possible to use pagefields, as LostKobrakai suggested, you should do that. Once you have set up your areas as pages, it will make everything much easier.
  8. I’m on my phone and it looks fantastic, but if you could somehow make it so the Safari interface expands when scrolling back up, as it does on most websites, iPhone users will surely appreciate it. Then again, I’m still on iOS 7, so maybe that isn’t an issue anymore with newer Safaris.
  9. Do you have any more information on this problem? Can you show the code? Is there anything in the logs? Btw the German keyboard has a key for the straight apostrophe, should be next to Ä (Shift+#). You’re using an acute accent which puts weird gaps into words. You should also use that apostrophe to delimit static strings in PHP.
  10. Nice, thank you for your continued effort! By the way, “actual” is a false friend. To mean “aktuell” you want something like “current” or “the latest”
  11. There is a way, and it works exactly as you described Only your syntax is slightly off. You need to pass an array like so (or prepare it beforehand): $SomePage->render('optional_non-default_template.php', array('recipient'=>'Mr. North')); Then on that page’s template you can simply call $options['recipient'] and it will === 'Mr. North'.
  12. I don’t have a custom example, but it’s always a good idea to check out the source code of the module itself. You’ll find the render() and processInput() functions particularly interesting. In the end though, you can pretty much do anything you want, as long as the name-attributes of your inputs match the ones processInput() expects. So if you want more control than the options array gives you, you may just write static mark up into your template file, or you may put in the effort and take the fieldtype’s configurable settings into account, depending on your needs.
  13. To be fair, the module is called Emo.
  14. https://processwire.com/blog/posts/processwire-2.5.7-core-updates/#field-template-context-now-available-for-any-field-property Sounds like this is being taken care of already
  15. Because you want a user to see a menu item if they have one or more, i. e. any of that item’s roles, you want to break out of your foreach as soon as the first matching role is found. Otherwise, any missing role will set $menuVis to false. That would be a good idea if you wanted a user to require all of the item’s roles, in which case you would have to break out of the loop at the first missing role, lest any further iteration sets $menuVis to true again. if($child->menu_roles->count()) { $menuVis = false; //Assume false in case the foreach doesn't find any matching roles and sets it true foreach($child->menu_roles as $cmr) { $cmrRole = wire('roles')->get("$cmr->name"); if (wire("user")->hasRole("$cmrRole")) { $menuVis = true; //has this role, so no need to check more roles break; } } } if($menuVis == false) continue;
  16. Doesn’t seem to happen for me. I’m also using the start and limit parameters and sorting by an integer field. This might have something to do with your DB configuration and thus not affect all PW sites equally. Perhaps posting your full selector string can shed some light on this, although I doubt anything short of using sort=random as a second parameter can explain this In any case, if you sort by something you expect to tie frequently, it’s definitely bad practice to not specify a second field. Databases do all kinds of magic and usually can’t guarantee tables to be read in a reliable order. For perfect consistency (pages can have identical titles as well), best sort by ID, which must be unique anyway.
  17. Be aware this makes the page visible for guests as well. I’m not actually sure if what you’re looking for is possible in PW out of the box.
  18. You could write a bunch of PHP using the ProcessWire-API into a template file and then just call it once. Or you could do it on the database with one line of SQL. ProcessWire’s tables are very clean and easy to understand. If you have access to PhpMyAdmin, I’d recommend doing it that way. It will be something like insert into field_mynewcheckbox (page_id, value) select page_id, value from field_myoldcheckbox (Treat this as pseudo code) edit: I should mention this basically clones all values of this field, which is okay in this case, since a checkbox only has 2 states. This is also assuming that you’re using the two checkboxes on all the same templates etc. Otherwise you may want to filter the Select a bit, or just use Craig’s code below.
  19. If you’re able to take a little time to learn basic HTML and PHP, I think ProcessWire will be a great choice for you. It is very beginner friendly in that sense. However, if you want to pick a ready made template and only add your own content, you will find the wealth of options much greater with other systems.There are so called site profiles for ProcessWire, which provide you with a ready-to-go starting point for your site. You can choose one during the installation. They’re a great resource for learning how to work with ProcessWire. Just open one of the template files and have a look. The thing is that HTML/CSS and PHP are entirely independent of ProcessWire, which is why you probably won’t find tutorials that teach you both at the same time. Your best bet will be to learn at least basic HTML and CSS from an independent resource (there are plenty in every possible format and medium). I wouldn’t bother with PHP and webservers just yet. In fact you can probably take your first PHP steps directly with ProcessWire. But HTML is pretty much a requirement first. After all, you will use PHP to generate HTML code. Just don’t be scared and start simple. Create a text file on your local computer and start copying some HTML tutorials.
  20. Sounds like you just need a couple of forms on your frontend. Maybe have a look at FormBuilder? How much experience do you have with HTML forms and ProcessWire’s API?
  21. I’m not fully certain what you are trying to do exactly. Have you seen this thread about deleting orphaned image files?
  22. Try changing it to: $b = "<img src='".$language->bandeira->url."' alt='"$language->title."' />"; You may have to use bandeira->first()->url, if your image field allows multiple images.
  23. Since users are already simply pages under Admin->Access->Users, you probably won’t need to create separate profile pages. You can simply add more fields to the user template. All fields you add there will also apppear in the module configuration of the core module “User Profile”, where you can select those you want individual users to modify themselves. If you still want to use separate pages, you can bind them to users by adding a page-field to the user template. Hope this helps.
  24. Can you show the code you use to make the AJAX call? To access PW you will want to create a page that uses a template in which the ajax request is handled. The request is sent to said page (perhaps /ajax/ or something), not just to the template file. edit: I missed that $input→post returns a WireInputData, so ProcessWire seems to be there. It’s probably still something to do with the request, although I don’t know Angular. Surely it’s not a GET?
  25. Well, as you can tell from the warnings, it seems like PHP’s safe mode is preventing the HTMLPurifier from accessing the file system. More info on Safe Mode: http://php.net/manual/en/ini.sect.safe-mode.php Since you haven’t changed anything, you should probably talk to your hosting provider about this. Maybe they changed the PHP settings? Seems odd that they would enable safe mode, since the docs already call it deprecated and “architecturally incorrect”. http://php.net/manual/en/features.safe-mode.php
×
×
  • Create New...