Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/02/2018 in all areas

  1. Fieldtype Page IDs is a third party Fieldtype that, simply put, stores Page references as integers (Page IDs). This fieldtype was built as a quick and dirty workaround for Page Reference fields' inability handle self-references due to circular reference issues. A project I've been working on for a while now includes a combination of RepeaterMatrix content blocks and tagging/categorization system that would've resulted in a lot of duplicate pages (and plenty of unnecessary manual work for content editors) had I used built-in Page Reference fields, and thus a new Fieldtype felt like the most sensible approach. Fieldtype Page IDs was designed to be loosely compatible with Page References in order to make conversions between the two feasible, but it is quite limited feature wise: largely due to the fact that stored values are actually just integers with no connection to Pages whatsoever some advanced selectors and related features are not supported, and page values can't be directly accessed configuration settings are limited to the bare essentials (selector string and Inputfield class) only a handful of Inputfields (AsmSelect, Checkboxes, Text) are (currently) supported Anyway, in case you need to store Page IDs (and Page IDs only) and are happy with the limitations mentioned above, feel free to give this Fieldtype a try. It has been working fine for me in one particular project, but hasn't been tested that much, so please tread carefully – and let me know if you run into any issues. GitHub repository: https://github.com/teppokoivula/FieldtypePageIDs Modules directory: https://modules.processwire.com/modules/fieldtype-page-ids/
    9 points
  2. This latest version on the dev branch adds a new site profile to the core, adds useful new functions to our $mail API variable, and makes significant enhancements to our $sanitizer API variable: https://processwire.com/blog/posts/processwire-3.0.105-core-updates/
    7 points
  3. Hey @adrian today I had to move one repeaterfield with several items into a repeaterfield inside another repeater matrix on another page. I thought I'll have a look at your admin actions module, but it seems it does not support such a special task. I came up with this solution: // $page is the repeater matrix page (found by inspecting the repeater matrix item and looking for the id and then pasting this id manually in the page edit url $page->of(false); $page->quotes->removeAll(); $page->setAndSave('quotes', ''); // pages(123) is the page with the populated repeater foreach(pages(123)->quotes as $old) { $quote = $page->quotes->getNew(); $quote->title = $old->title; $quote->person = $old->person; $quote->body = $old->body; $quote->of(false); $quote->save(); $quote->image->add($old->getUnformatted('image')->first()->filename); $quote->save(); $page->quotes->add($quote); $page->save(); } Not too complicated - I thought I share it if anybody else has the need. Not sure if that would make sense as an action in your module? Guess the need is VERY limited... Thanks again for your great modules! In this case Admin Actions didn't do the job but with the help of tracy I moved the content within 10minutes ?
    2 points
  4. @adrian Thanks, I've fixed these. The uikit field with issue is solved by adding the fields (max limit and asm placeholder) after the Required field. @ottogal I wasn't able to find a CSS-only solution to the sticky menu + jump link issue you mentioned. Surely there's one but I've spent too much time on it without success so I let it go instead. I could add JS but that doesn't appeal to me. There's a new productivity tweak for the Delete and Trash pagelist actions: if ctrl key is pressed you can skip the confirmation step. I found it very handy to quickly get rid of test pages. (on the Trash action I mean the one added by AOS that is available for non-superusers). I'll release the update soon.
    2 points
  5. ConnectPageFields Allows the connecting of two related Page fields so that changing one updates the other. Purpose of module An example: suppose your website is about movies. You have a template "movie" with Page field "actors". For each movie you add the actors that appear in the movie. All good, but what if you want to find results like... the 10 actors who have appeared in the most movies actors who haven't appeared in any movies since 1990 You cannot retrieve these pages with a single efficient $pages->find() query, and must load a large PageArray into memory in order to iterate or filter it. For the sake of making these types of queries more efficient you could structure your templates/fields so that movies are added to actors instead, but this may be a less comfortable workflow and can run into equivalent problems (e.g. "find the 10 movies with the largest cast"). The solution is to have a two-way relationship so that movie pages have an "actors" Page field and actor pages have a "movies" Page field. This module will keep these two Page fields in sync so that adding "Ryan Gosling" to "Drive" automatically adds "Drive" to "Ryan Gosling". Also, you can select the same Page field in both Page field A and Page field B. For example, create a "Related" Page field for related pages. Choose "Related" for both fields in a pair in the module config. Now when you add "Orange buffoon" to Related for "Donald Trump", "Donald Trump" is automatically added to Related for "Orange buffoon". Usage Install the ConnectPageFields module. If you haven't already done so, create the two Page fields you want to connect and add them to templates. In the module config select the two Page fields in a "Connected field pair" row as Page field A and Page field B. You can add rows as needed using the "Add another row" button. Troubleshooting Make sure you have set the "Selectable Pages" settings for each Page field correctly: The settings for Page field A should allow pages using the template(s) that Page field B has been added to. The settings for Page field B should allow pages using the template(s) that Page field A has been added to. http://modules.processwire.com/modules/connect-page-fields/ https://github.com/Toutouwai/ConnectPageFields Module config: Demo showing how changing one Page field updates the other:
    1 point
  6. Hey @bernhard - I think it could be a very useful action actually. These are the sorts of things that I come across fairly regularly and an action makes it so much easier. Would you like to create an action and submit a PR?
    1 point
  7. Thanks for the suggestions, I'll look into these this coming week ? Me reading that:
    1 point
  8. The HTML required attribute seems like it would be a handy thing to use on all inputfields that play nicely with it, whenever that inputfield is required. Might as well give the user a notice before the form is submitted rather than after. The hook below does this, but as per the core option for InputfieldText it does not cover "required if" conditions: $wire->addHookBefore('Inputfield::render', function(HookEvent $event) { $inputfield = $event->object; $type = substr($inputfield->className, 10); // Only for inputfield types that play nicely with the HTML required attribute if(!in_array($type, ['Text', 'Email', 'Datetime', 'Textarea', 'Integer', 'Checkbox'])) return; // Only if the field is required and has no requiredIf condition if($inputfield->required && !$inputfield->requiredIf) $inputfield->attr('required', true); });
    1 point
  9. Yeah, and you can ignore things like "1 star of 5: didn't teach me how to make an facebook clone" in the comments for a 'Learn basic PHP' course. ^ this. I have anxiety which gets much worse without clear direction or when burning out spending hours upon hours on problems without breaks. This course has helped me massively to break up my learning and provided different techniques to use which has made programming fun again and much less stressful for me which is awesome. So glad @FrancisChung recommended this one.
    1 point
  10. I always do this: What grinds my gears is when hamburger menus are the only option on desktop sites (just for the sake of looking fancy), so I gotta click on it just to show the available options before I can choose something.
    1 point
  11. In the database, datetime fields have a time part that is set to the current time when saving a new value for a date only field. "today" is interpolated by PHP's strtotime function to 00:00:00 of today's date, so <= will only match articles posted exactly at midnight. You probably want to use $news_posts = $page->children("limit=10, news_date<tomorrow"); instead.
    1 point
  12. Sorry for the delay, we had some busy weeks. But we found the time to put the files on github. https://github.com/Typografics/PaymentMollie-PW3 I also made a topic on the modules forum:
    1 point
  13. You are absolutely right, implementing that forum from scratch is basically implementing stuff in PHP. If there is some interest, I indeed may write an in-depth blog entry, but for now I'll try to make it short (which probably does not work...). Let's start with a quick view on the five templates involved: forum-root well, this is the parent of everything. The template only contains the global welcome text but the associated php file enumerates any contained forum-group and creates the root layout. forum-group just a group around a couple of forums with its own descriptive bodytext forum-forum well, a forum containing the topics. The forum-forum nodes contain an additional "cache" for post and topic counts to provide a massive speedup when rendering forum-root. The counters are flagged with a timestamp, so they are updated on-the-fly only if required. forum-topic this node holds the post-list. In contrast to all other nodes which manage the content only by child-parent-relationship, this one has a page-table on the child node for the only purpose to see the thread also in admin. forum-post basically the post text with automated creation of title and name from current timestamp. Handling topic updates and user notifications was one of the first things implemented due to its expected complexity, but in the end it was rather easy and little efford with the right fields in place. topic-group, -forum and -topic nodes each has a page select field (holding PW user pages) which may be set or cleared by clicking on the grey wall to activate a "forum guard". Whenever there is a change beneath that node, the guard adds the topic to the per-user notification list (placed in the PW user template, which is more complex than usual this implementation). If there are pending notifications an additional button is displayed in the headline next to the user avatar: The user may check active notifications from that button and reading the topic will in turn clear that notification (remove the topic reference in the user's notification-list). Each user may choose to get informed by mail (standard WireMail) for pending notifications (html or text, various intervals, managed by LazyCron). The trick here is, that the user only get informed once per topic until he re-visited the forum to avoid flooding on active topics. Each visit is also recorded per-user to implement the updated-topic functionality. This is basically a topic/forum/group page select with the current timestamp in the PW user, updated topics are flagged with a bright lamp. https://forum.tom-productions.de/?f=test-forum&t=hallo-unglaublicher&p=1 Handling the post content is one of the more interesting and challenging features in this implementation. Mentions, for example, are detected when writing a post (regular @ syntax followed by the user name). This will simply add the post page to the user's notification list so it can be identified during regular processing. But there is more to explain in this screenshot. If someone replies to its own post, both are merged with that "Ergänzung" text beneath the ruler. That additional header is created during runtime from a data-ts field contained in the <hr> tag so it does survive even a later edit. While such an addition pushes the topic's modified timestamp, an edit doesn't. You may also note the phrase "externes Bild" next to an URL. This is a tribute to the european GDPR to not send the user's IP address to external servers without explicit grant. Clicking on that solid shield next to the cite icon will open a popup which has to be acknowledged. You may also notice the colored links in the user's signature, that's another point to avoid clicking on misleading links. If the link text contains the correct target server, its green, otherwise red (changed the signature for that screenshot). The color on the other hand does not qualify the linked content by any means... That's all done during runtime before actually displaying the post content along with replacing the usual emoticon shortcuts (learnt to love preg_replace_callback). Apropos Emoticons: To eliminate copyright issues I'm using regular Unicode emoticons which nicely pass through the PW engine and SQL, so emoticons will look differently depending on platform (Windows7 only shows black and white, for example). Apropos Signature: The signature actually is specified in markdown in an ordinary textarea field so I don't need to fiddle CKEditor into the LoginRegister module. Conversion into HTML is finally done using text formatter Markdown/Parsedown extra before the content has to pass my link and image filter. Well, there's so much more to tell (for example the CKEditor configuration), but that's for a later post... Ah, there is no magic behind the cite feature. It simply encloses the cited post into <blockquote> so the CKEditor opens with that block already filled.
    1 point
  14. Output Formatting is basicly what it says. When you attach a TextFormatter to a field, Clean text from the database goes through the TextFormatter & changing the text on output. So **bold** wil be changed to <strong>bold</strong> when you use it. (TextformatterMarkdown) Say if you save the page with data, you must be sure that the saved text is clean. You want to save **bold** to the database, and not <strong>bold</strong> (TextformatterMarkdown). Setting of(false) will put all Formatters off, so clean text storage is insured. offtopic: $page->setOutputFormatting(true|false) $page->getUnformatted("field")
    1 point
×
×
  • Create New...