Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/23/2018 in all areas

  1. The tree selection is probably not possible without some serious coding. You can get a long way though by using what's already built into PW. I'd do it like this: Create your repeater field (lets call it "quotes") with the field for the quote text (I'll call it "quote") and add it to a template Create pages with that template and add a few quotes Add a field of type "Page Reference" (let's call it "quotelink"), set it to "Single Page or Null Page" On the Input tab for that field, select "Custom format (multiple fields) ..." in the "Label field" box, and in the "Custom page label format" input enter "{custlabel}" (we will fill that virtual property later) Expand the "Custom PHP Code" option in the "Selectable pages" section, copy the code there to site/ready.php and adapt it to walk through the persons and add all quote repeater items to the output. In that code, populate the "custlabel" property for each repeater item so the displayed text makes sense (e.g. by prefixing the first 80 characters of the quote with the person's name). Here's an example: <?php $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'quotes') { $out = new PageArray(); $persons = $event->pages->find('template=person'); foreach($persons as $person) { foreach($person->quotes as $quoteitem) { $quoteitem->custlabel = $person->fullname . ": " . substr($quoteitem->quote, 0, 80); $out->add($quoteitem); } } $event->return = $out; } }); Add the quotelink field to a template Now you should be able to add a page with that template and select an arbitrary quote in your quotelink field In your template code, output $page->quotelink->quote
    2 points
  2. 2 points
  3. When "Use HTML Purifier" is enabled for a CKEditor field any data-* attributes are stripped out. This happens regardless of the CKEditor ACF settings, and is pretty annoying considering how frequently data attributes are used/needed these days. I'd like to keep HTML Purifier activated but I want to change the configuration to allow specific data attributes. I know how to do this via addAttribute() - as mentioned here - and I can get this working if I directly edit MarkupHTMLPurifier::init() and clear the HTML Purifier cached files from /site/assets/cache/. public function init() { $this->settings->set('Cache.SerializerPath', $this->getCachePath()); $this->settings->set('Attr.AllowedRel', array('nofollow')); $this->settings->set('HTML.DefinitionID', 'html5-definitions'); $this->settings->set('HTML.DefinitionRev', 1); if($def = $this->settings->maybeGetRawHTMLDefinition()) { $def->addElement('figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'); $def->addElement('figcaption', 'Inline', 'Flow', 'Common'); // Added line below to allow data-ext attribute on 'a' elements $def->addAttribute('a', 'data-ext', 'Text'); } } But how can I change the configuration like this without modifying a core file? I want to set the configuration from a custom module. I don't see any hookable methods in MarkupHTMLPurifier but surely it must be configurable somehow. Does anyone know a way to do this?
    1 point
  4. Because it is simply amazing, has an improved user experience, is more lightweight, better looking and has nicer features than version 4. Almost everybody will profit. Please consider voting at github for this feature: https://github.com/processwire/processwire-requests/issues/217
    1 point
  5. $pages->find() returns a PageArray, and you can't get the URL of a PageArray. I think you want $pages->get() or $pages->findOne(). I recommend checking that a real page is returned before trying to get its URL. $p = $pages->findOne("template=categories-template, artcategories=2"); if($p->id) { // Page was found, output its URL, etc } else { // No page found, so deal with this somehow }
    1 point
  6. I just noticed that feature earlier today and enabled it! Whats cool also is I can insert a grid inside my accordion so I can do columns inside my accordions! Just tested it out.
    1 point
  7. @horst Site A is 3.0.107 and Site B is 3.0.110, and yes, I encountered the parent/child issue which is why I did it step by step. @adrian yes, the templates do have multiple field types, including some new ones including fieldset page. Maybe that's where the problem lay? Will take a look at ProcessMigrator next time. Thanks for the tip
    1 point
  8. I'm not really supporting it anymore because there are too many new fieldtypes to keep up with, but I still find this https://github.com/adrianbj/ProcessMigrator much easier and more reliable than the built in approach. Be sure to use the backup option because I know there are a few situations where it can do some weird things.
    1 point
  9. Which PW-version are Site A & Site B? I have used fields & templates export & import a lot, but without ex-/importing pages. I don't have had any issues so far with the templates ex-/import feature. Only if there are templates in family-children relation that need both imported together in a new site, it needs multiple import steps, as in the first run, the family settings can not be set because wether parent nor childrens are known in the system.
    1 point
  10. Actually it would be pretty easy, just add .tracy-collapsed { display: block; }. You can even do it without Js by adding a hidden checkbox somewhere above all containers and use something like this: input:checked ~ [selector for an element in the same level] .tracy-collapsed { display: block; } Plus you can wrap the input in a label and format that it as an icon. Update: wrapping the input in a label won't work (the CSS sibling combinator "~" cannot target the desired element), but adding a "for" and an "id" to the label and the input is OK. However, in this case the CSS solution is not applicable because once all nodes are expanded you can't manually collapse individual nodes.
    1 point
  11. Hi @adrian, What do you think about adding a "Expand/Collapse All" button for dumps? This button would expand/collapse all nested elements within a dump would be useful in situations where you are dumping a massive nested object and you want to use the browser's find tool to look for a specific string of text.
    1 point
  12. I knew that request was coming ? I have added all this to the latest version, including the click again on the tab to collapse. Please test and let me know if the behavior is what you are looking for.
    1 point
  13. I like this, but I think when you switch back to the first tab the dump should be expanded. Because in clicking the tab you are saying "show me this tab content", and if you are actually wanting to just reduce the height of the dump container you would click to collapse the dump on the current tab. Maybe a simplified way of handling this would be that clicking any tab a) shows that tab's content and b) toggles the collapsed state of the dump. So dumps in all tabs would be loaded collapsed by default, but clicking a tab also toggles open a collapsed dump so has the same effect as this latest update. It would also allow for an alternative way to collapse the dump on the current tab (i.e. clicking the active tab collapses/opens that dump depending on its current state).
    1 point
  14. Oh and I also made the dump in the additional tabs open (not collapsed) by default. My thinking on this is that if you dump lots of items, you don't want the default tab to be open by default because it could make for too much scrolling, but for the additional tabs, if you click on them then it's obvious you want to see the content so you shouldn't need to click again to expand the dump. Let me know if you guys don't like this behavior and if you have a preferred approach. See how below I can quickly scroll through to the dump I am looking for (because the default Debug Info tab content is collapsed), but when I switch to the Iterator or Full Object tabs, these are not collapsed.
    1 point
  15. I'd much rather be in a swimming pool with these temperatures outside, alas.... work ? Has anyone ever built Gantt charts with PW? The idea is to visualize somehow who is responsible for which task, when working in a team (e.g. we as agency, client, and a sub-contractor). You have some sort of timeline (week-numbers), and can see who is supposed to work on which tasks from date A to date B. There can be time-overlaps, of course. Is a Gantt chart the established way to go for such things? Or are there other types of charts / graphics that I'm not aware of? So far I came across these JS libraries: https://jsganttimproved.github.io/jsgantt-improved/ https://developers.google.com/chart/interactive/docs/gallery/ganttchart https://frappe.io/gantt If somebody has experience with such tools, I'd happy to hear your opinions. If you've done something like this with data coming from PW, how did you do it? (not asking for a full-fledged tutorial or even code-snippets, just some pointers). I guess you'd setup something like Pro Table, with text and datepicker fields, then create XML/JSON/JS vars from that.
    1 point
  16. I have used a lot of project management tools over the years, and I will say, I do like Monday. I built something (utilizing pw) based off the idea just as a test to my abilities. Unfortunately, I had something go wrong with the db so I had to get a fresh copy up and running. I made a page reference field (projects) for the user template and on the front end you could assign the user to the project (ajax call then selected the appropriate page in the user template). From there, the project page showed all tasks added to it with dates. Ill see if I can resurrect the app and take some screenshots.
    1 point
  17. We use Forecast for these kind of planning. You might get some inspiration from there. It could be possible with PW, but I wouldn't reinvent the wheel when there are other tools.
    1 point
  18. I used a much simpler and faster method utilizing the pagefile class. My link looks like this: // Sorry for smarty language. but thats what I used {if $page->files|@count > 0} {foreach $page->files as $file} <p> {if $file->description} {$file->description} {else} {$file->name} {/if} <br> <a href="download/{$file->name}" class="link-icon">Download</a> | {$file->filesizeStr} </p> {*{/if}*} {/foreach} {/if} and then in my _init.php I used the following code if ($input->urlSegment1 == 'download') { $download_options = array( // boolean: halt program execution after file send 'exit' => true, // boolean|null: whether file should force download (null=let content-type header decide) 'forceDownload' => true, // string: filename you want the download to show on the user's computer, or blank to use existing. 'downloadFilename' => '', ); session_write_close(); if ($input->urlSegment2) { $pagefile = $page->files[$input->urlSegment2]; if($pagefile){ wireSendFile($pagefile->filename, $download_options); } } } EDIT: The downside when implementing this in the _init.php is, that you can´t send a Wire404Exception, because this file gets included (prepended) and PHP doesn´t like exeptions in included files. If you paste this code into one of your templates you could add trowing a Wire404Exception.
    1 point
  19. Git is a version control system and not a backup system. It's meant to handle source code and not user content. There are dozens of better ways to backup a whole site.
    1 point
×
×
  • Create New...