Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/09/2017 in all areas

  1. i have a theme engine module that i use which is part of a suite of modules that together, provide a frontend, or 'markup' api. The Theme Engine handles things like the body classes and is basically a wrapper module for a collection of functions/methods helpful for optimizing front end development. It includes helpers for webfonts and facilitates the handling of the site assets, enabling each template to add dependencies (js or css files, or inline scripts/styles), as well as acting as a wrapper for ProCache whereby it allows the developer to enable/disable ProCache minification as needed. For example, superusers may disable minification and the module will output the individual assets with a url paramter appended to prevent caching. It also provides a simple 'hook' system where the developer can add containers to the main template, into which templates can 'inject' markup, similar to Wordpress do_action. The Meta Engine reads settings from a settings module where the admins can enter the primary settings for the site, such as site title, copyright year and holder, publisher, social media links, contact information and more and provides an easy API to access those settings, as well as formatting for convenience. It also allows for individual templates to add and modify items to the header and footer, such as prefetch/prerender, next/prev, schema, open graph tags, custom favicon sets, and any custom markup. other members of the suite are a Blog Engine, and Events/Calendar Engine.
    6 points
  2. Hi Sérgio and Robin, thanks a lot for helping out. So the Connect Page Fields module seems to be interesting for the page reference approach – I'll check that out later today. For now, I took the repeater approach, and your three bullets were essential in achieving the goal, @Robin S. That's how I do it: 1. I search for date repeaters by treating them as template (by putting "_repeater" before the field name); I can now sort and limit the array to my tasting 2. I set "check_access=0" so that all users can see the results 3. I get field data from the page the repeater is living on by using the getForpage() method. $allEvents = $pages->find("template=repeater_event_repeater_datetime, event_datetime>today, sort=event_datetime, limit=14, check_access=0"); foreach ($allEvents as $event): echo "<h4>$event->event_date</h4>"; echo "<h5>{$event->getForpage()->event_title}</h5>"; echo "<p>{$event->getForpage()->event_desc}</p>"; endforeach; So far, that works great. Since there are some tricks involved I didn't know before, I'll keep checking, if there are any "side effects".
    4 points
  3. I also think a Page Reference field in conjunction with Connect Page Fields would be a good way to go. But not sure that you need a tree structure for the 'date' pages that is broken down into year, month, etc as per @Sérgio's suggestion. You could just have a single 'dates' parent and each 'date' page has a date field (you could create a pseudo-year/month/day structure for your event listings via URL segments if needed). In your 'event' page you select an existing date page if one exists or create a new date page as needed. The date pages are not children of the event pages but are connected to them via the two-way connection provided by Connect Page Fields. Edit: one issue with this approach might be that as time goes on you could get a large number of date pages cluttering up the inputfield, and you couldn't do something like limit these to only future dates in the Page Reference field settings or else if you edited an old event the selected pages would be invalid. Maybe the autocomplete inputfield would be a good solution. Alternatively, if you went with the Repeater approach you would do something like this: Find all repeater 'date' pages by template, sorted by date (you may need check_access=0). Foreach those date pages, getting the event pages associated with the date with getForPage(). If you wanted only a single date heading when their are multiple events on that date, in the foreach you would only output the date heading if it is different from the previous date heading.
    4 points
  4. For simple json outputs, you can use WireArray::explode and json_encode() or wireEncodeJSON() methods https://processwire.com/api/ref/wire-array/explode/ $myPages = $pages->find('template=basic-page'); // extract required fields into plain array $data = $myPages->explode(['title', 'created']); echo wireEncodeJSON($data);
    3 points
  5. the problem is that you have an array, but the items in the array are \ProcessWire\Page objects, so those can't directly map to a json encode. you probably need to cycle through the pages you want and create the array manually. Alternately you could have a look at the GraphQL module, which i think some devs are using to get json data to the frontend.
    3 points
  6. You could try to use grayscale() method of PageImage Manipulator module
    2 points
  7. on the page where you want to output the form, you can just conditionally load that markup from a .php, .inc, or .html file, depending on what your needs are. for example: <?php if($page->name == 'my-special-page') { // html version $form = file_get_contents($config->paths->templates . 'forms/my-form.html'); // OR wireRender $form = wireRenderFile($config->paths->templates . 'forms/my-form.php'); echo $form; // or include($config->paths->templates . 'forms/my-form.php'); }
    2 points
  8. most of the functions were previously in helper files and called procedurally, there is nothing too complicated about any of the functions; i just finally figured it was time to put them all into a module so that i could have a config screen and not worry about field naming between sites, because the config screen lets the module's methods be field-agnostic (for example in the blog engine, you would tell it what field is used for date, what the posts index page is, post index template etc)... I will probably put it on GitHub once it has been tested more in some varied environments. You can find a lot of these types of functions in other modules, depending on your specific needs, or don't even use a module for it, a lot of developers just put each thing into a partial and then include or wireRenderFile them all in the main template. the events engine that i'm using is just helpers for front end, so primarily deals with date formatting, handling feeds, URL segments for things like archive or month/year based results (/calendar/year/2016/), categories and tags if those are used, media (images/audio/video), related events, and schema.. recurring events are usually handled with either a multiplier for a date field, a table, or a page table, depending on the needs of the site. The Elliott Carter events listing uses a page table for recurring events because each event recurrence can actually be in a different location (for example a tour).
    2 points
  9. @MadeMyDay can you check my issue report https://github.com/MadeMyDay/PageTableExtended/issues/25 ? I have a fix and an exchangement, using and testing module with these changes.
    2 points
  10. Yes, you are right, I have tested it, and I also get fields in tabs shown as collapsed fieldset. There is similar topic opened by @gebeer I don't know if it is feature or bug, so maybe somebody from more experienced members will clarify it.
    2 points
  11. Hi @Mustafa Online 1. User is a template, so you can add your custom fields to it. You have to choose "Show system templates" in the template manager. 2. Take a look at the latest blog post from Ryan where he cover how markup regions work on the current master branch http://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/
    2 points
  12. That sounds interesting - could you say a bit more about that? Does your module have support for recurring events? Variations to recurring events? And does it have a calendar interface in admin? PW really needs a good calendar/events module.
    2 points
  13. All fields in PW are custom fields. And you can't save content to a page without an actual field added to the page's template to hold that content (in your module you are only dealing with inputfields which themselves do not save their content to the DB). If you like you can add tags to your fields to create groups of fields within the fields list and keep things tidy. As @Macrura said, currently the only way to add a group of fields to a template in the form of a single unit is to create a repeater with those fields and limit it to a single repeater item. Or if you prefer, a PageTable or Profields Table in conjunction with Limit PageTable or Limit Table. Another approach that I sometimes take (if the project is well planned out in advance) is first create a template with the fields/fieldsets that will be used on all templates, and then I duplicate that template as the starting point for each additional template.
    2 points
  14. It might be interesting to have a module with general functions for the many common problems that we find here every day. Something similar to what Ryan did with the uikit file. I know that just could be a simple file for include like _func.php, but I like much more the module format because it's more easy to include it directly from the repository, easy locate the last version (updated, enhanced and fixed) As a plus maybe you can configure which features to include before you download it..
    2 points
  15. Little admin helper module: Using this module you can view all template cache settings at once. E.g. cache status, cache time (configurable). Furthermore it adds the functionality to clear the entire template cache or just the template cache for a given template. Note that this may cause a temporary delay for one or more requests while pages are re-cached. GitHub: https://github.com/justb3a/processwire-templatecacheoverview
    2 points
  16. Not necessarily. I had a similar error last week. What happens in my setup is that I run my site locally, but connect to a database on a real live server, so I use an IP address rather than 'localhost'. In order to connect from my local account to a real server, I have to whitelist my home IP address in my hosting account to allow remote access to the database. So what happened was that my ISP had changed my home IP address, the whitelist didn't match, therefore every one of my local sites gave me an error like the above. The answer was to login to my hosting control panel, add my IP address (literally looked up 'whatsmyip' in Google) to the whitelist and sites all worked straight away. Long shot but I thought it was worth mentioning that it's not always the credentials in config.php that are the problem.
    1 point
  17. Great thread, will be bookmarking this one.
    1 point
  18. I tested this and can confirm. It's quite a weird bug - I suggest you open a GitHub issue for it. A few more details based on my tests: It isn't related to adding another searched field in the ProcessPageSearch module settings - the bug also occurs when only the title field is searched. It occurs only when searching for a string that is part of a word and does not start at the beginning of a word. For example, if I have a page titled "My amazing page" then... "maz" will match the page (2 or 3 character searches work) "mazi" will not match the page (4 or more characters not at the start of a word do not work) "amazin" will match the page (any number of characters will work so long as they start from the beginning of a word) Only pages are affected - the bug does not affect field, template or module results within the admin search.
    1 point
  19. Hi @ridgedale It looks like namespace issue. Try to add namespace Processwire; to the top of your blog-post.php file
    1 point
  20. Those cannot really be compared well on the surface. ProcessWire is first and foremost a cms, codeigniter is a framework. If you want to use ProcessWire just as a framework you certainly can, but be prepared that it won't be the full batteries included experience. You'll need to add things on your own, when they're not part of the core pw framework. Also PW might be quite opinionated in places, where it's optimized for it's usecase (e.g. routing), which might not be the most intuitive coming from the framework world.
    1 point
  21. Thanks, interesting discussion in that first GitHub issue. It's the second GitHub issue that got me thinking about this in the first place. I understand that the current implementation only checks against the inputs in Page Edit, but that neglects the cases where a page may be created/populated/published via the API, which is an equally valid way to publish content. The way I think of the 'required fields' feature is that the fields are 'strongly recommended' rather than strictly required since it is possible to leave required fields empty in many different ways. But the feature should provide the information that a field has been marked as 'required' for this circumstance (template overrides, 'required if' settings, etc), and that information should be available from the API as well as Page Edit. Will look into this some more and consider placing a GitHub request.
    1 point
  22. I prefer the second approach, where the dates are what organize the events, so you can have something like this on the tree: Events --- Calendar ------ 2017 ---------- January (with page field to reference all events. And using https://modules.processwire.com/modules/connect-page-fields/ will help a lot) ---------- February... ------ 2018 --- Event 01 (with page field to reference all dates. And using https://modules.processwire.com/modules/connect-page-fields/ will help a lot) --- Event 02 ... ---- So you can have URLS like: List all events of 2017 – example.com/calendar/2017 Show an event – example.com/event-title (the URL should not show the date as the event can happen anytime)
    1 point
  23. @Alxndre' it definitely can. I can add a get() function that would return the entire output from last.fm into a WireData object, and then people could use that however they please. The render() function is written for me specifically, so it probably makes sense to give it a lot more flexibility than it currently has.
    1 point
  24. Hello, I'm a little confused by your description of the problem, but I don't think you have your URL segments set up correctly. In what follows, I am assuming you have edited the URL tab of the template for your page to turn on URL segment processing and you have something entered in the "Which URL segments do you want to allow?" field. I'm guessing that you want to have the first segment be an action - either edit or new - and the second segment to be a numeric id. If that is the case and you want PW to enforce the first segment to be either 'edit' or 'new' then you need to use a regular expression as documented here to match the actual URL you are supplying. More specifically, could you try... regex:^new/[0-9]+ regex:^edit/[0-9]+ Another approach may be to leave that field totally blank and do all the checking yourself, in which case I think macrura's code should work.
    1 point
  25. if you only want to process requests where both segments exits, then you would want to check for both. this is a simple example: if($input->urlSegment3) throw new Wire404Exception(); if($input->urlSegment1 == 'edit') { if (strlen($input->urlSegment2)) { // process the 2nd segment here } else { throw new Wire404Exception(); } } if($input->urlSegment1 == 'new') { // process request for new if (strlen($input->urlSegment2)) { throw new Wire404Exception(); } }
    1 point
  26. Got to disagree - I learnt a great deal, and I'm sure many others will appreciate having our hands held in a thorough and thoughtful way. Very much looking forward to the next one!
    1 point
  27. More likely than this, you just have one or more of... wrong database name wrong database username wrong password for that username ...in /site/config.php Your host should have some control panel (cPanel, Plesk, etc) where you can... check the database name check the database username reset the password for that username ...and then update /site/config.php accordingly. Edit: sorry, I spoke too soon. The error message for wrong db user/pass is slightly different. So it must be either wrong database name (hopefully) or no database at all (oh dear ). P.S. I know it's not much help now but as @cstevensjr mentioned these two modules are essentials for every PW installation IMO: http://modules.processwire.com/modules/process-database-backups/ http://modules.processwire.com/modules/cronjob-database-backup/
    1 point
  28. You could potentially also use just CSS for this: :nth-child(3n+0) This would select all elements where an index is a multiple of 3.
    1 point
  29. Just a repeat of part of a message above so hopefully more of you will see it: I am going to be mostly offline for the next 2 months, starting right now It's going to be strange being away from PW and the forums for so long. Hopefully if anyone has any issues with this (or any of my other modules), some of you who are more experienced might be able to help, or at least let those users know that I am away and will take care of things when I return. Cheers all!
    1 point
  30. Thank you so much! You're all very helpful. Really appreciate it. thanks, Ray
    1 point
  31. Some more links you might also find useful: Multiple templates or parents for users front-end system to handle logins, password resets and changing passwords (old but should still help you a lot if you want to implement it on your own without Front-End User module) @adrian's Some User related actions @adrian' Tracy Debugger with loooots of developer tools, such as User Switcher Panel lots of other info in the forum Hope this helps too.
    1 point
  32. Additionally, if you look at the link on the user template that says: To configure what fields a user can edit in their profile, see the profile module settings. You will be able to choose which fields are editable by users themselves. Like so: When users log in, their profile will be editable like:
    1 point
  33. Go to Setup/Templates: You should now be able to add any additional fields that you need.
    1 point
×
×
  • Create New...