Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/16/2018 in all areas

  1. Likewise IE/Edge is for downloading a browser, WP.com is for spreading the word about the best CMSes ?
    5 points
  2. Same here: I think they are really great! It makes the setup so much cleaner and more readable and also more flexible. For example I'm using a region "scriptsbottom" at the end of my <body> and whenever an included section needs some javascript I just write the markup and append the script to that region: // _main.php <region id="header"></region> [...] <script><region id="scriptsbottom"></region></script> // slider.php <section id="header">... my great slider markup ...</section> <region pw-append="scriptsbottom"> $('#slider').init(); </region> IMHO this is much more readable than using delayed output with php variables and then "messing" around with $config->scriptsbottom .= '$(\'#slider ... ' (doing some crazy escaping or ob_get_clean() or the like.
    4 points
  3. https://jeevanism.wordpress.com/2018/03/24/processwire-cms-a-review/ On a WP.com blog no less
    3 points
  4. I've been searching for a CSS-only solution for a while to reveal a scroll-to-top link only after scrolling down the page, but no luck. Today I figured out that it's possible with position: sticky. The beauty of this is that you don't need to check the scroll position in a scroll event (+ in document ready, window resize), which makes it really lightweight. Update: added "html { scroll-behavior: smooth; }" and now there's animated scroll (Firefox 58+, Chrome 63+). It seems that Js is not required anymore to this feature. CodePen demo
    2 points
  5. Hi, Double check that you are not sending the email to a domain out of your control. Double check your SPAM folder If you use a Google account, you have to disable a security option on your account Read this thread and get back to us
    2 points
  6. @bernhard - I have a temporary solution for you. Replace https://github.com/adrianbj/TracyDebugger/blob/93fe130026244fe727e5553b82183a85b78e2c9f/tracy-master/src/Tracy/Dumper.php#L460 with: return count((array) $obj->__debugInfo()) ? $obj->__debugInfo() : (array) $obj; There are other ways this could be achieved, but since this is modifying the Tracy core, I am going to ask them what they think is the best approach. Let me know if it works as expected for you.
    2 points
  7. Hi @adrian_gp, Welcome to the forums. Let's say you have a category 'Technology' whose URL is /categories/technology/. In the template file of the template CategoriePage, you can do this: // @note: we set a limit here. You can use pagination if you have many posts $posts = $pages->find("template=BlogPost, limit=10, categories=$page"); $out = ''; // category title $out .= "<h2>{$page->title}</h2>"; // found posts in this category if($posts->count) { foreach($posts as $post) { $out .= "<h3><a href='{$post->url}'>{$post->title}</a></h3>" . "<p>{$post->summary}</p>";// assuming you have a summary field } // no posts in this category yet else $out .= "<p>No posts found in this category</p>"; echo $out; Quickly typed in the browser, check for errors, just an example. Btw, there are blog profiles and a Blog module you can look at for more examples.
    2 points
  8. I've adjusted the CSS so now the scrolltop link doesn't extend the page height if the page has small amount of content. That is, if there is not enough content to scroll the scrrolltop link doesn't show up and the page doesn't get any vertical scrollbar. In older browsers the scrolltop link shows up fixed even in this case but that's a minor thing imo. I've updated the example to have content toggle button so it's easy to see.
    2 points
  9. The example you are referring to was not markup regions, but region() function calls. They are very different things. I think Horst may have thought I was talking about region() functions since the terminology is similar. Though I can also recommend region() / wireRegion() function calls (even if I don't often use them myself), as they are also quite useful, and I would certainly be happy to inherit a project using them. Depending on your code editor used to edit site files, they may be preferable to traditional delayed output. What you've described is not consistent with markup regions. You mentioned you would never use them, but I recommend enjoying some time with them before coming to that conclusion because I think you may view them as something different than what they are. Just like in any other methodology, it's your decision as to how you delegate front-end or back-end code, markup regions dictate nothing about that. Markup regions merely designate the target for markup, and are not really any different than delayed or direct output in that respect, other than that it's a little bit simpler to use, and a little more flexible in practice. Markup regions do not use class attributes. You can use id attributes if you want, but using pw-id attributes is independent of whatever is used in the markup. Of course, everyone prefers different methodologies, not to mention different projects have different needs, so there is no one-size-fits-all. PW supports a lot of different options, use whatever works best for your context.
    2 points
  10. I had the same thought initially when Markup Regions were introduced, but after thinking about it some more I don't know that this amounts a good reason not to use something. Because you could actually say the same thing about most aspects of the PW API and therefore never start with PW in the first place. Take $files->render() for example. If you're coming in cold knowing nothing about PW you're not going to instantly understand how this works, what variables will be in scope, etc. You have to take a bit of time to become familiar with the method, read the documentation, test things out. So really no different to Markup Regions. Once you read the introduction and try out Markup Regions it starts to make sense very quickly. Personally, I think Markup Regions are a fantastic feature and I have used them on every new site since they were introduced.
    2 points
  11. As threatened in the Pub sub forum in the "What are you currently building?" thread, I've toyed around with Collabora CODE and built file editing capabilities for office documents (Libre-/OpenOffice formats and MS Office as well as a few really old file types) into a PW module. If you are running OwnCloud or NextCloud, you'll perhaps be familiar with the Collabora app for this purpose. LoolEditor Edit office files directly in ProcessWire Edit your docx, odt, pptx, xlsx or whatever office files you have stored in your file fields directly from ProcessWire's page editor. Upload, click the edit icon, make your changes and save. Can be enabled per field, even in template context. Currently supports opening and saving of office documents. Locking functionality is in development. See the README on GitHub for installation instructions. You should be reasonably experienced with configuring HTTPS and running docker images to get things set up quickly. Pull requests are welcome! Here is a short demonstration:
    1 point
  12. Sorry for the delay, folks – been a bit busy lately, but I'm now slowly trying to work my way through your reports Version 2.1.6 includes a couple of fixes related to this one: Revision tables are now vertically scrollable. This isn't necessarily a perfect solution, but at least the UI is now usable even if the inputfield itself is very narrow. I've also added some UI hints to signal if/when scrolling is expected. InputfieldColumnWidths() is triggered after showing/hiding a revision table, so the first thing mentioned here should be fixed now (hopefully). I couldn't reproduce the 1px overlap. Might've already fixed that one, or perhaps I just wasn't able to recreate the setup needed, but I'll get back to that if it's still an issue. The absolute positioning thing I kind of covered in my previous post (I'd prefer to avoid that), and the panel thing is exactly as mentioned above: they seem to require an URL, which is then opened in an iframe, and that would be a bit problematic (to say the least) for my use case here.
    1 point
  13. Great work TPR, I wrote some JS code to do this a while back, and it wasn't pretty ... at all. Thanks for this
    1 point
  14. If you have ImageMagick installed on the server, you can use/adapt this little module by @Robin S: Examples of what's possible to implement yourself: https://stackoverflow.com/questions/32873690/color-overlay-with-opacity-using-imagemagick-in-rails/#answer-33100788
    1 point
  15. I think your files shouldn't be compiled (or at least the compiled files not used) at all. Does moving the namespace declaration to the very first line of your php files change anything? How you specify the include files' paths might also be relevant if you use different approaches in your class files and templates.
    1 point
  16. Can't you just use some css to achieve this? https://css-tricks.com/almanac/properties/b/background-blend-mode/
    1 point
  17. Have you tried adding /*NoCompile*/ to the require_once() inside Master_Order.class.php?
    1 point
  18. https://github.com/nette/tracy/issues/292
    1 point
  19. thx, this works looking forward to hearing their feedback!
    1 point
  20. Maybe - I'll see what can be done, but to make it a little easier, can you let me know what variable in RockSqlFinder you are dumping, and where?
    1 point
  21. Hey @bernhard - I think it should already work that way: So I am wondering if it's due to your class extending a PW class that does implement __debugInfo() Could you please let me know what you trying to dump in your module so I can reproduce what you are seeing.
    1 point
  22. I've created a module based almost entirely on this module, and my problem occurs both with my new module and the original. So even though CKE Insert Links has been incorporated into AOS, this seems the best place to post. My new module allows users to insert links from a list of page names. It is little more than the original module with some renaming of functions and variables, and getting a list of pages rather than a list of attached files; then the menu is displayed in a CKE dialog rather than from the toolbar. My new module and CKE Insert Links work fine in Firefox for all users, and work in Chrome for superusers. But they fail in Chrome (and Edge on early testing) if the user is not a superuser. The failure manifests itself with CKE Insert Links as the menu showing "No files for this page", and in my module with the equivalent error message. I have debugged as far as finding that the problem seems to be with the $.getJSON() function in plugin.js, which is failing to return anything. In the code below, if(data.length) is evaluating to false. Note that the new code is very close to the original module, with functions and variables renamed. function addReferencesDialogMenu(page_id) { // Adds data for dialog menu to DOM $('#link-references-dialog').remove(); var ajax_url = config.urls.admin + 'module/edit?name=CkeLinkRefsDialog&pid=' + page_id; var $list = $('<ul></ul>'); $.getJSON(ajax_url).done(function(data) { if(data.length) { $.each(data, function(index, value) { $list.append( $('<li title="' + value.description + '">' + value.insertionvalues + '</li>') ); }); } else { $list.append( $('<li title="' + config.CkeLinkRefsDialog.no_references_text + '">' + config.CkeLinkRefsDialog.no_references_text + '</li>') ); //$list.append( $('<li class="no-references" title="' + config.CkeLinkRefsDialog.no_references_text + '">NO DATA</li>') ); } }); $('body').append( $('<div id="link-references-dialog"></div>').append($list) ); } The AJAX response section of the .module file is as follows. Again, just like the original, except the middle section that gets page info instead of attached-file info. public function ajaxResponse(HookEvent $event) { // Must be AJAX request, must be for this module, must include pid GET variable if(!$this->config->ajax || $this->input->get->name !== $this->className() || !$this->input->get->pid) return; $page = $this->pages->get( (int) $this->input->get->pid ); if(!$page->editable) return; $event->replace = true; $event->cancelHooks = true; $result = array(); // Get all relevant pages $referencePages = wire('pages')->find('template=reference'); // Build array of page info for menu foreach($referencePages as $refPage) { $pageUrl = $refPage->url; $pageTitle = $refPage->title; $pageTitleArr = explode("|", str_replace("). ",")|",$pageTitle)); $result[] = array( 'description'=> $this->truncate($pageTitle, 60), 'insertionvalues' => $pageTitleArr[0]."|".$pageUrl ); } $event->return = json_encode($result); } I am unable to understand how or why superuser permissions (or absence of such permissions) have any effect. Any help gratefully received!
    1 point
  23. Hey @adrian, what do you think of adding a check if debugInfo is available for the requested object and if not, set it to "false" automatically? I'm working on my RockFinder module and wanted to debug my subclass. This was the result: Switching "debugInfo" to false I get this: Which is of course much more helpful. Luckily I remembered about that because we were talking about it here, but if someone missed that it could be quite hard to find out what is going on and why the information does not show up... Also it is quite annoying to always set ['debugInfo' => false] for every quick d($myobject)
    1 point
  24. I ? markup regions. I found Processwire arround a year ago when they where introduced and used MUR exclusively since. I use it like a template engine with layouts like this: //1. Append file app/index.php > Append file, init, loads Component() & Snippet() Methods app/theme/componen.php /snippet.php // 2. ProcessWire Template, extends layout Template.php > extends markup regions, can define layout or false // Template uses Components and Snipptes: src/components/component/component.php /component-varian.php /component.js > compiled by gulp /component.scss > compiled by gulp src/snippets/snippet/snippet.php src/snippets/snippet/snippet-varian.php /snippet.js > compiled by gulp /snippet.scss > compiled by gulp // 3.1 Layout app/layouts.php > Prependfile Handles include of layout: // 3.2 Load markup region layout src/layouts/default.php > Markup Regions /Template.php > Markup Regions Example Template, can assign a $page->layout variable or set it to false. I use custom Component and Snippet methods to render Parts that I use multiple times: <div id='pw-author' pw-remove></div> <div id='pw-header' pw-replace> <?= Component('header', 'profile') ?> // loads src/components/header/profile.php </div> <!-- Adding class to main --> <div id='pw-main' class="uk-padding-remove-bottom" pw-append></div> <div id='pw-body' pw-append> <?= Component('profile', 'page'); ?> // loads src/components/profile/profile-page.php <?= Snippet('buttons', 'logout'); ?> // loads src/snippets/buttons/profile-logout.php </div> <div id="pw-more" pw-remove></div> <div id="pw-aside" pw-remove></div> Prependfile: app/layout.php > this file loads a layout, if there is a layout file with the same name as the Template or a set $pages->layout variable: $layout = isset($page->layout) ? Wire('config')->paths->templates."src/layouts/$page->layout.php" : Wire('config')->paths->templates."src/layouts/{$page->template->name}.php"; $default = Wire('config')->paths->templates.'src/layouts/default.php'; switch (true) { // layout like Page-Template exists case is_file($layout): include $layout; break; // default template case is_file($default): include $default; break; default: return "<div class='uk-alert uk-alert-danger'>could not find layout. Searched for $layout / $default.</div>"; break; } Component Function: app/template/component.php – components should never be nested, can contain snippets (css & js namespaced) namespace ProcessWire; function Component($component, $variation = '', $vars = []) { if (is_array($variation)) { $vars = $variation; $filename = $component; } else { $filename = $variation ? $component.'-'.$variation : $component; } $file = Wire('config')->paths->templates."src/components/$component/$filename.php"; if (is_file($file)) { $vars['skin'] = isset($vars['skin']) ? $vars['skin'] : ''; $vars['class'] = isset($vars['class']) ? $vars['class'] : ''; $out = wireRenderFile($file, $vars); return $out; } wire('log')->error('Could not find '.$file); return null; } Snippet function: app/theme/snippet.php – can be used inside components (css & js namespaced) namespace ProcessWire; function Snippet($name, $file = null, $vars = []) { if (is_array($file)) { $vars = $file; $file = $name; } else { $file = $file ? $name.'-'.$file : $name; } $file = Wire('config')->paths->templates."src/snippets/$name/$file.php"; if (is_file($file)) { return wireRenderFile($file, $vars); } return "<div class='uk-alert uk-alert-danger'>could not find $file.</div>"; }
    1 point
  25. As always a fast and efficient reply. I never thought of looking for a release notes module, but it is a great addition. Thanks guys!
    1 point
  26. Since starting my journey to actually learn programming, css is off the menu (but struggling to ignore the PW forum!). So with that in mind, a framework will be very handy indeed. I haven't got time to learn grid right now, nor would I use it anyway, too early days for me.
    1 point
  27. The CSS Grid vs Bootstrap (or any other CSS framework/library) question does not make too much sense anyway Just because now we have CSS Grid it does not mean that it provides all the stuff a heavy weight CSS framework gives us. We are comparing apples to oranges... CSS Grid solves one particular – albeit long standing – issue, that's all there is to it.
    1 point
  28. I've just started using MarkupRegions and I think they are fantastic. It is basically identical to the Delayed Output strategy but you are able to focus on the markup instead of various php variables. Definitely give it a try before you write it off.
    1 point
  29. Bit of a bump. Ther Api-Docs are great and it is useful that they are built on the dockblocks but that still really limits how far they can go. A site that allows us to bring the core API-Docs, plus the fantastic blogs, tutorials, guides and forum posts would be perfect. All this information is so spread out at the moment its terrible compared to competing platforms.
    1 point
  30. There are so many ways to skin a cat in Javascript, especially considering how far Javascript has came in recent years. You really don't need jQuery at all. It is also good to learn the Javascript core as to expand your skill set as well as remove a dependency on your project. Some of the posts here are way out of date and verbose. Native Fetch is much better than XMLHttpRequest, and there are some polyfills online if you need IE11 support. fetch('../my-url/', { method: 'post', body: JSON.stringify({ test: response.test }) }).then(response => { return response.json(); }).then(json => { document.querySelector('#output').innerHTML = json.test; }); Read more here: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API And there are a bunch of good basic examples here: https://github.com/mdn/fetch-examples/tree/master/fetch-json
    1 point
  31. I'm just glad that one has a choice with ProcessWire. We are not mandated to use a particular way of website building. It's always good to read about the distinctly different uses of the platform.
    1 point
  32. Quick update and version bump to 0.1.0 I updated the module to use the standard ProcessWire variation suffixes. Instead of image.0x200.optim.jpg, optimized images will now be named image.0x200-optim.jpg. Deleting images in the admin or via the API will delete any optimized variations as before, but the process is a lot more straightforward now. I also added a public method $image->removeOptimizedVariations() that does exactly what it says it does.
    1 point
  33. It just so happens that you can bootstrap processwire into scripts. I have used this several times and it is just one of the many awesome features. https://processwire.com/api/include/ Normally, I house specials scripts outside the template folder (like you have done) and just include processwire's index like: <?php include("/path/to/processwire/index.php"); ?>
    1 point
  34. Thanks for sharing your video @Jonathan Lahijani! In case your interested, I added your technique to my "Techniques for flexible page layouts in Processwire" document https://docs.google.com/document/d/1peY-FUpevKgy87cKOxIVz8jwcv2-3c61zbiJr3QKO6c/edit?usp=sharing
    1 point
  35. First of all, a persistent login is always a balance between user-friendliness and security aspects. There are two related $config settings. /** * Use session fingerprint? * * Should login sessions be tied to IP and user agent? * IP fingerprinting may be problematic on dynamic IPs. * Below are the possible values: * * 0 or false: Fingerprint off * 1 or true: Fingerprint on with default/recommended setting (currently 10). * 2: Fingerprint only the remote IP * 4: Fingerprint only the forwarded/client IP (can be spoofed) * 8: Fingerprint only the useragent * 10: Fingerprint the remote IP and useragent (default) * 12: Fingerprint the forwarded/client IP and useragent * 14: Fingerprint the remote IP, forwarded/client IP and useragent (all). * * @var int * */ $config->sessionFingerprint = 1; /** * Session expiration seconds * * How many seconds of inactivity before session expires * * @var int * */ $config->sessionExpireSeconds = 86400; The easiest way would be to force a log out, if ProcessProfile or ProcessPageEdit is requested and show the default login screen. You could compare the current user-agent, IP or duration of the session with current session data. This can be different from default (more lazy) $config settings.
    1 point
  36. This is the one I have always liked: http://jeffreysambells.com/2012/10/25/human-readable-filesize-php But I would also vote for an option to automatically calculate the number of decimal places / significant figures.
    1 point
  37. I've not tried seddass's solution, but it looks right on. I'm using some of his code in my example too. So here's another option, which is to piggyback onto the MarkupPagerNav module, even though you aren't dealing with pages. <?php // get the images you are going to display $items_per_page = 4; $start = ($input->pageNum - 1) * $items_per_page; $total = count($page->images); $images = $page->images->slice($start, $items_per_page); // make this to give MarkupPagerNav what it needs $a = new PageArray(); // add in some generic placeholder pages foreach($images as $unused) $a->add(new Page()); // tell the PageArray some details it needs for pagination // (something that PW usually does internally, for pages it loads) $a->setTotal($total); $a->setLimit($items_per_page); $a->setStart($start); // output your images foreach($images as $p) { $img = $p->img; echo "<img src='{$img->url}' alt='{$img->description}' />"; } // output the pagination navigation echo $a->renderPager(); Btw, an images field on a page isn't going to scale infinitely. At some point, you are going to find it difficult to manage, sort, etc. So I would still place some limits on yourself for the max number of images you are going to attach to a single page.
    1 point
  38. Been looking at the issue, as i have this being used on 3 sites; none of the sites are displaying events anymore, clients not too happy ()... The module itself though is doing it's job, so nothing wrong with the module; rather, the feeds are returning an empty array; we can only assume that this is something to do with Facebook new security, however even looking through the app settings and documentation, can't see how to debug this through facebook.. UPDATE: I saw this announcement here https://www.codeofaninja.com/2011/07/display-facebook-events-to-your-website.html Guess we're waiting for FB at this point...
    0 points
×
×
  • Create New...