Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/23/2019 in all areas

  1. Hey just bringing up as a point for discussion. I find in various areas of the admin there is quite a lot of reflowing of content and flash of unstyled content (FOUC). Examples are: the pages listing animation pushes the footer down the page every time, and this can also be seen on various pages where content doesn't load immediately (footer will fly down the page) basic pages with no fields – sit there and refresh a basic page a few times, you will see a flash of all content before tabs are created pages with lots of fields – progressive loading and rendering of different fields and groups causes lots of reflow, particularly loading wysiwyg and image fields modules eg lister-pro – loads the add new button initially on the left then it jumps to the top right as the lister loads, then columns reflow and resize as content loads in and classes are applied Whilst pw is very fast to render admin page html, to me the above makes it feel quite jarring and heavy. Generally speaking you want to aim for no reflow or FOUC whatsoever for a good user experience. I know there is a lot going on here and it is not a simple thing to manage an admin like this, but does anyone notice the same thing and have any ideas about how this can be optimised? Below are some relevant links. Minimising animations is the best place to start, although before anyone suggests it just using AdminOnSteroids to disable animations doesn't fix a lot of what I am talking about. https://developers.google.com/speed/docs/insights/browser-reflow https://gist.github.com/paulirish/5d52fb081b3570c81e3a
    7 points
  2. @Mikie - I completely agree - the PW admin interface is full of these jarring FOUCs (it's not just the UiKit theme either). I hope Ryan will give this some serious consideration going forward.
    6 points
  3. Thought I'd share this quickly as it helps me get to grips with whether I'm looking at the dev site or live site when working on any client project. Dev site only has AdminOnSteroids module. I add the below to sites/templates/admin/admin.css and add that url the admin css field in the module. Currently only works with default adminTheme. #masthead{ background: rgb(153, 12, 94) !important; } #logo:before{ content: 'DEV '; color: white; margin-right: 1em; vertical-align: middle; display: inline-block; font-size: 1em; letter-spacing: 0.05em; margin: -15px 0.6em 0em 0; } Simply adds a DEV string and changes the header color so I can see I'm on Dev not live. I guess you could do the opposite if you wanted adding content: "LIVE" instead in the CSS.
    5 points
  4. Thanks for the tips! Note that @adrian's Tracy Debugger has similar options – in the case that one is installed too –, just look for: Indicator type and Custom Indicator CSS in settings.
    3 points
  5. @nfil are you running a PHP version older than 7.0? It seems this shorthand syntax ("syntactical sugar") has only been added with PHP 7. line 49 is: $isTranslatable = $info['translatable'] ?? false; https://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op https://lornajane.net/posts/2015/new-in-php-7-null-coalesce-operator
    3 points
  6. You can do something similar for the frontend: body.dev::before { content: 'DEV'; display: block; position: fixed; bottom: 0; left: 0; color: white; background-color: red; padding: 3px; font-size: 2rem; z-index: 99999; } (If you add a body class .dev when in dev mode) similarly, you could add a few breakpoints, and display stuff like "sm", "m", "l", "xl" so you always know on which viewport you are, while debugging your frontend...
    3 points
  7. I think it will required a complete rewrite, based on some JS "framework" magic... Sure. While adding UIkit 3 to the mix was possible, it just added another layer of complexity. The current admin is a patchwork, although a good one, but there is room for improvement as always I think. Ryan likes proven tech, so I wish he took a closer look at JsViews by Boris Moore: https://www.jsviews.com/#samples/editable/submit 6+ years of constant development without breaking changes and reinventing the wheel, in this sense similar to ProcessWire's path, so I started using it too. It took me a while to stumble upon it by accident.
    2 points
  8. Does anyone have the perception the old admin is "snappier"? I'm using both and I get that feeling, could this be the reason?
    2 points
  9. After doing a fresh install of MySQL 5.7 on macOS High Sierra, the installer generates a temporary password for the root user. The problem is as soon the installer is finished, the given root password is already expired. Resulting in not being able to login as root to MySQL. It took me a while of reading, fiddling around, and trying all kinds of tips and examples on how to reset the root password. The following worked for me. And in the hope it an help somebody else, and for backup purposes, I'll leave it here. Open the following folder in a Terminal window: /usr/local/mysql/bin Type in (copy + paste) the following commands, where `xxxxxxxx` is the desired root password: ./mysql -u root -p --connect-expired-password SET PASSWORD FOR 'root'@'localhost' = PASSWORD('xxxxxxxx'); UPDATE user SET authentication_string='xxxxxxxx' WHERE User='root' The last line with the UPDATE command was necessary for me to finish the process.
    2 points
  10. The Page Hit Counter module for ProcessWire implements a simple page view counter in backend. Page views of visitors are automatically tracked on defined templates, with monitoring of multiple page views. This gives you a quick overview of how many visitors have read a news or a blog post, for example, without first having to open complex tools such as Google Analytics. This module quickly provides simple information, e.g. for editors. Or, for example, to sort certain news by most page views. For example for "Trending Topics". Works with ProCache and AdBlockers. With a lightweight tracking code of only ~320 bytes (gzipped). And no code changes necessary! In addition GDPR compliant, since no personal data or IP addresses are stored. Only session cookies are stored without information. In addition, there are some options, for example filtering IP addresses (for CronJobs) and filtering bots, spiders and crawlers. You can also configure the lifetime of the session cookies. Repeated page views are not counted during this period. It is also possible to exclude certain roles from tracking. For example, logged in editors who work on a page are not counted as page views. Sort by hits and access page views (hit value) Each trackable template has an additional field called phits. For example, you want to output all news sorted by the number of page views. // It is assumed that the template, e.g. with the name "news", has been configured for tracking. $news = $pages->find("template=news, sort=-phits"); To output the page views of a tracked page, use: echo $page->phits; Example: Reset counter per API $modules->get("PageHitCounter")->resetPageViews("template=whatever", false); Example: Tracking a page hit via API and jQuery If you want to track a template that does not represent a full page to automatically inject a tracking script, you can define allowed API templates in the module that you can track. Below is an example of how you can track a click on news tag using jQuery. This will allow you to find out which keywords are clicked the most. For example, you can sort and display a tag cloud by the number of hits. Suppose your keywords have the template "news_tag". The template "news_tag" was also configured in the Page Hit Counter Module as a trackable API template. Example PHP output of keywords / tags: // Required: the data attribute "data-pid" with the ID of the template to be tracked. echo $pages->find("template=news_tag, sort=-phits")->each("<a href='{url}' class='news_tag' data-pid='{id}'>{title}</a>"); Example Tracking Script with jQuery: /** * Required: Data attribute "data-pid" with the ID of the news tag template * Required: Send the POST request to the URL "location.pathname.replace(/\/?$/, '/') + 'phcv1'" * Required: The POST parameter "pid" with the ID of the template */ $(function(){ if($('a.news_tag').length > 0) { $('a.news_tag').each(function(){ var tPID = $(this).data("pid"); if(tPID) { $(this).on("click", function(){ $.post(location.pathname.replace(/\/?$/, '/') + 'phcv1', {pid: tPID}); }); } }); } }); So simply every click on a tag is counted. Including all checks as for automatic tracking. Like Bot Filtering, Session Lifetime, etc. Notice: Tracking with URL segments If the option "Allow URL Segments" is activated on a template, the hits are only counted if the base URL of the page is called. If you want the hit to be counted even when a segment is requested, you MUST configure the segments in the template configuration. How to do this can be found here. If you use dynamic segments, configure them as RegEx. There is currently no other option. The problem is that the Page Hit Counter hooked into the PageNotFound process. If URL segments are allowed but not defined, a 404 is never triggered. This means that the Page Hit Counter cannot be called. New since 2.0.0: Ignore URL segments If a template has URL segments configured, each hit on a different segment is counted as a new hit. Enable "Ignore URL segments" so that dynamic segments are not counted individually on the base template / page. New since 2.0.0: Use cookieless tracking (Experimental) Enable this option to not use individual cookies for tracking or if you have many different pages you want to track. The limit for cookies is 50 per domain for all cookies on the page. If the option is enabled, PHP session storage is used. Downside: you can't set the lifetime higher than configured in your PHP.ini and the session will be terminated as soon as the browser is closed. Upgrade note for 2.0.0 from previous versions! Version 2.0.0 requires an update in the database schema, so that additionally the date of the last access / hit on the page can be displayed ($page->lastPageHit). To make this possible, you have to do the update via the upgrade module, upload the ZIP itself and do an update directly via the backend AND DO A MODULE REFRESH DIRECTLY AFTER UPLOAD/UPDATE. If you do not do this, you will get an error that a column is missing in the database table. _______________________________________________________ Background: This module is the result of a customer requirement, where the editors are overwhelmed with analytics or no tracking tools were allowed to be used. However, a way had to be found to at least count page views in a simple form for evaluations. Furthermore, by using ProCache, a way had to be found to count views of a page without clearing the cache. _______________________________________________________ Pros Automatic Page View Tracking Lightweight tracking code, only ~320 bytes (gzipped) No code or frontend changes necessary Works with ProCache! Even if no PHP is executed on the cached page, the tracking works Works with browser AdBlockers No cache triggers (for example, ProCache) are triggered. The cache remains persistent GDPR compliant, session-based cookie only, no personal information Filtering of IPs and bots possible Exclude certain roles from tracking Ability to reset Page Views Works with all admin themes Counter database is created as write-optimized InnoDB API to track events for templates that are not viewable No dependencies on libraries, pure VanillaJS (Automatic tracking script) Works in all modern browsers Pages are sortable by hits Cons Only for ProcessWire version 3.0.80 or higher (Requires wireCount()) Only for PHP version 5.6.x or higher No support for Internet Explorer <= version 9 (Because of XMLHttpRequest()) No historical data, just simple summation (Because of GDPR) Segment URLs can only be counted if the segments are defined Planned Features / ToDos API access to hit values Since version 1.2.1 Possibility to sort the pages by hits (Request by @Zeka) Since version 1.2.0 Don't track logged in users with certain roles (Request by @wbmnfktr) Since version 1.1.0 Possibility to reset the counter for certain pages or templates (Request by @wbmnfktr) Since version 1.1.0 Better bot filter Since version 1.1.0 Disable session lifetime, don't store cookies to track every page view (Request by @matjazp) Since version 1.2.1 Option to hide the counter in the page tree (Request by @matjazp) Since version 1.2.1 Option to hide the counter in the page tree on certain templates Since version 1.2.1 API to track events for templates that are not viewable Since version 1.2.2 Cookieless tracking Since version 2.0.0 Show last hit Since version 2.0.0 Ignore URL segments (Request by @bernhard) Since version 2.0.0 Add hookable method after pageview was tracked (Request by @bernhard) Since version 2.0.0 Changelog 2.0.0 Feature request: Add hookable method after pageview was tracked (___pageViewTracked($pageID)) (Requested by @bernhard) Feature request: Ignore URL segments option (Requested by @bernhard) New: Cookieless tracking New: Show date of last hit Update: Botlist Enhancement: Documentation improvement 1.2.7 Feature request: make buildPageListHitCounter-Function public (Requested by @bernhard) 1.2.6 Bug-Fix: Set the counter of a cloned page to 0 Enhancement: The function for resetting counters is now available in the module as a public function to reset counters via own scripts on the API side (Request by @VeiJari) Enhancement: Documentation improvement API reset 1.2.5 Bug-Fix: When counting 404 hits, cookies are no longer set. The session lifetime is deactivated for the 404 page Enhancement: Documentation improvement regarding URL segments 1.2.4 Bug-Fix: Resetting the counters on system pages (e.g. 404) does not work (Reported by wbmnfktr) Bug-Fix: Tracking endpoint is logged as 404 if module "Jumplinks" is installed (Reported by wbmnfktr) Enhancement: Corrected few typos (Merged from Sergio #6 – THX!) 1.2.3 Bug-Fix: Tracking script triggers 404 if pages are configured without slash (#3) Reported by @maxf5 Enhancement: Reduction of the tracking script size if it's gzipped (~320 bytes) Enhancement: Documentation improvement Enhancement: Corrected few typos 1.2.2 New feature: API to track events for templates that are not viewable Enhancement: Documentation improvement 1.2.1 API access to hit values Use $page->phits Bug-Fix: No tracking on welcomepage (Reported by wbmnfktr; Thx to matjazp) Bug-Fix: Tracking script path on subfolders (Reported by matjazp) Bug-Fix: Tracking on pages with status "hidden" Enhancement: Change database engine to InnoDB for phits field Enhancement: Option to disable session lifetime set session lifetime to 0, no cookies Enhancement: Better installation check Enhancement: AJAX Request asyncron Enhancement: Reduction of the tracking script size by ~20% Enhancement: Option to hide the counter in the page tree You can output the counter with the field name "phits" Enhancement: Option to hide the counter in the page tree on certain templates Enhancement: Option for activate general IP validation Enhancement: Reduction of tracking overhead up to ~30ms Enhancement: Better bot list for detection 1.2.0 New feature: Sort pages by hits – New field phits Migrate old counter data to new field 1.1.0 New feature: Exclude tracking of certain roles New feature: Reset Page Views Better bot filter and detection 1.0.0 Initial release Notes By default, the page views are stored as INT in the database. This allows a maximum counter value of 4.2 billion views (4,294,967,295) per page. If you need more, change the type to BIGINT directly in the database. But I recommend to use Google Analytics or similar tools if you have such a large number of users. _______________________________________________________ Download GitHub: ProcessWire Page Hit Counter (Version 2.0.0) PW Module Directory: ProcessWire Page Hit Counter (Version 2.0.0) Install via ProcessWire (Classname): PageHitCounter _______________________________________________________ Update information If you have used version 1.2.1 from the DEV branch, please replace it completely with the new master version. Old stable version Download GitHub: ProcessWire Page Hit Counter (Version 1.2.7)
    1 point
  11. Hi @MilenKo, It's still rough, but feel free to read my notes on the different techniques for flexible page layouts https://docs.google.com/document/d/1peY-FUpevKgy87cKOxIVz8jwcv2-3c61zbiJr3QKO6c/edit?usp=sharing
    1 point
  12. I can't imagine the amount of work it would require coding a new admin. I'm guessing it would need a rewrite of all "major" Process modules right?
    1 point
  13. @Hurme - carefully read my explanation, I think it will fix your problem. If not, try posting the code you are using so that we can see what is wrong.
    1 point
  14. Hi @David Karich! Many thanks! I'll update, test and let you now ASAP.
    1 point
  15. @adrian - great news! Thanks for the support, it will be fine now..
    1 point
  16. General thoughts on this... I never installed Matomo into a subfolder on a ProcessWire website. Therefore I can't tell if this works out of the box or if ProcessWire tries to protect that folder in some way. I'd suggest installing matomo somewhere else - a subdomain for example. https://matomo.domain.tld/ - would probably be the easiest way here. After that tracking should work - unless you misconfigured Matomo or block tracking with DNT or the Ghostery extension. But... there is one thing I don't understand. You are saying "place the map in the template folders" - what map?
    1 point
  17. Yeah good point. The way to do it is simple. If javascript is deferred, add the classes like uk-grid etc and not just the data attribute. https://getuikit.com/docs/grid#usage
    1 point
  18. @elabx Also, v2 will support the optional trailing slash by default (configurable).
    1 point
  19. Ops! Didn't know that, thank you Robin! ?
    1 point
  20. Under normal circumstances, contributions to OSS help out with continued development – issue on my side is exactly that: slammed with work. With that said, there are several public holidays coming up (four-day weeks for two/three weeks), so I think I can slot in some time to get things going here and at maybe even put up a testing version of sorts next month. Further on down the line, when it's stable, we'd definitely need to look at getting someone onboard to assist with maintenance.
    1 point
  21. Hi All, Our new agency has started using PW for a couple of client projects. We are looking for a good all round developer(s) that also can do some front end HTML styling as needed, although 99% of the time that will be provided. We have two projects that need immediate work, and then likely will have ongoing needs, so looking to build a good relationship with one or two devs. You can read more about our agency here: https://www.gosling.media If interested, please submit the form here: http://gds.li/jobs Thanks!
    1 point
  22. Testing against the template object with the == "equal" operator is okay because it means "equal to after type juggling". So the template object is converted to a string for the comparison, and thanks to Template::__toString() the the string value of a template object is its name. When a page is first created (via admin) the only populated fields are Title and Name. So Page Reference fields are no different to any other field - they are empty until they are populated and saved in Page Edit. Maybe you want to hook Pages::published instead?
    1 point
  23. Quietly and without interruption this week, our whole website (and all subdomains) moved from a single static server to a load-balanced multi-server environment, giving us even more horsepower and redundancy than before— https://processwire.com/blog/posts/processwire-hosting-upgrades/
    1 point
  24. Super cool, congratulations on the upgraded infrastructure. I definitely would like to read more details about how you two setup ProcessWire in that environment. That would make for a good, enterprise-y tutorial here on the page too.
    1 point
  25. @tthom_pw - thanks for the updates. Looks like this is going to be an ongoing problem, so I have separated it out into its own module: http://modules.processwire.com/modules/process-terminal/ It can be run standalone, or via the Terminal panel in Tracy. Hopefully this will help to make it available if you run your own server / VPS, but not cause problems for those Tracy users on shared hosting.
    1 point
  26. Thank you @Wanze for this great module. Only one thing to mention: From the point of security it is not recommended to add the generator metatag (or any other information to help hackers to know something about the system). So it would be great to add a setting checkbox to disable the rendering of this metatag. I know I can render each metatag separately but using your render method ($page->seo->render()) would be much more comfortable ?. Best regards Jürgen
    1 point
  27. yeah for selecting icons there is a version of FieldtypeFontIconPicker floating around somewhere (possibly not the one in the directory) that works really well, will gave to dig that one up.. Edit - this is the one i use for icons, thanks to @OLSA
    1 point
  28. Just do it like this: $mail->mailHTML('alex@gmail.com', 'Hello', '<html><body><h1>Message Body</h1></body></html> without redefining $mail
    1 point
  29. Thanks for the feedback guys, this was a can of worms situation. I came to realize I also needed a frontend login form and I leveraged the homepage being viewable by all to accomplish this. I wanted to to have csrf protection in my form so I extended the ProcessLogin core module (https://gist.github.com/jdart/6545755) and called the module in the home template: #home.php echo $modules->get('SpexLogin')->execute(); if (!$user->isLoggedin()) return; Hopefully that will be helpful for someone. Maybe
    1 point
  30. Just curious - you say that you want to make the title field unique, but in your code you are trying to set the value of the invoice_number field. This should do what you want, assuming you actually want to set the title field. <?php class MarkupTitleField extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Markup Title Field', 'version' => 100, 'summary' => 'Set the title field to predefined value', 'singular' => true, 'autoload' => true, ); } public function init() { // add before-hook to the inputfield render method $this->addHookBefore("Inputfield::render", $this, "renderField"); } public function renderField(HookEvent $event) { // // get the current field $field = $event->object; if(($field->name == 'title' || $field->name == '_pw_page_name') && $field->value == '' ) { $last_page_id = wire('pages')->get("include=all,sort=-id")->id; $id = date("Y") . "/" . ($last_page_id+1); // example for a possible id value $field->set('value', $id); } } } Edited code to get the id of the page that is about to be created. Not sure if this is completely robust. You might want to consider a different unique identifier.
    1 point
×
×
  • Create New...