Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/18/2017 in all areas

  1. Hey there! https://magenta.pt/en/ This is my latest release. A company that does digital textile printing. In this one I went way beyond just designing and building the site. I designed the logo and illustrations, shot the video in the homepage and the samples in the gallery as well. I have some tweaks planned after having tested the site with real people, such as adding a visual cue to scroll down on some pages. These will come in later, after gathering all input and planning the update. Technically this follows my usual recipe. Repeaters for building pages in a modular way (see the slideshows in the middle of the text in the services page), AIOM, MarkupSEO, Sitemap... The gallery is hand-built with a custom zooming engine that lets users drag with a finger on touch devices, or reacts to the mouse's position on desktops. Could be smarter loading the images, but for now there are only a handful, so I didn't bother for now and will revise on the 1.1 update. There's also a blog section that is currently hidden until they have enough content to launch it. Hope you like it. EDIT: Here's the case-study on my portfolio: https://supertiny.agency/en/folio/magenta/
    8 points
  2. @SamC it's really as simple as that: https://processwire.com/blog/posts/new-ajax-driven-inputs-conditional-hooks-template-family-settings-and-more/#new-conditional-hooks Update 2022: $wire->addHookAfter('Pages::saved', function(HookEvent $event) { $page = $event->arguments('page'); bd('page saved'); bd($event, 'event'); bd($event->object, 'event->object'); bd($event->arguments(), 'event->arguments'); }); in the beginning it can be a little confusing when to use event->object, event->arguments and event->return but with the help of tracy you can quickly bring light into the dark: add the code above to the tracy console, set the radio on the right to load it on "ready" (same as placing the code in the site/ready.php file) and save any page: $event->arguments('page') is the same as using $event->arguments(0) that you will see very often and in the tracy dump you see that 0 is simply the key for the first argument in that hookevent. you can also collapse the "data" property of the hookevent and you would see the same: You can also use your IDE to quickly find what the HookEvent is returning/containing in which hook. Let's take the common saveReady hook as an example: We know that the hook is attached as Pages::saveReady (eg because we have read that somewhere) That means that the hook is part of the "Pages" class, which is located at "/wire/core/Pages.php" - that's easy to find out using CTRL+P in VSCode: Searching for "___saveReady" lets us find the corresponding method: Now we see, that we have ONE "arguments", being Page $page - this means $event->arguments(0) would return the page being ready for saving $event->object would be the class, here "Pages" $event->return is the return value of that method, here $data (line 1739) Edit: There's some additional explanations in this post: https://processwire.com/talk/topic/27248-pagestrashtemplatefoo-vs-pagestemplatefootrash/?do=findComment&comment=224659 #search afraid of hooks
    7 points
  3. via page save hook would be the only reliable way. via some javascript would be the more user-friendly way. $(document).on('change', '#Inputfield_yourdatefield', function(e) { var yourdate = $(e.target).val(); var yourotherdate = ...; if(yourdate < yourotherdate) { alert('yourdate must be higher than ...'); // reset field $(e.target).val(''); } }); doing both would be the best don't think there's a built in way...
    4 points
  4. @tpr Thank you for this great module. Note to self: When your site is doing something fabulous and you can't remember for the life of you how you did it, check AOS first
    4 points
  5. In the end, the client opted for Canvas. Thanks @psy for the suggestion and also thanks to everyone who responded.
    3 points
  6. When you can find a setting in admin and you want to know what the property name will be in API, a handy trick is to hover the collapse toggle of the setting. When $config->debug = true you will see the name of the input appear, and 99% (all?) of the time that will be the property name in the API. And Tracy will give you the whole shebang:
    3 points
  7. Sorry @bernhard, the forum won't let me like your reply more than once. I learned a couple of new things from your response. Kudos sir!
    2 points
  8. An extra +1 for using the the Console panel's code injection feature for testing hooks
    2 points
  9. Thanks all for the reports and being patient. I have managed to get back to this and fix issues within Repeater and RepeaterMatrix. Also added ___markupValue() for formatted output ie in Lister.
    2 points
  10. not at all, sounds like this could be a great companion! at the moment I think I will also release the datatables module as open source. I've never worked with d3 but the company I'm writing my thesis at does some crazy stuff with it maybe a dedicated "d3 preview" thread would be nice? I really enjoy the discussion and the input here
    2 points
  11. Hi. Just so you know, I have been working (on the side, slow pace) on a free data visualisation module based on d3. It might or might not include a data cleanup tool (like Pivot Tables in Excel). It's a hobby project. Will this conflict with your plans for your datatables module?
    2 points
  12. DEPRECATED - this module will not see any updates. I'm short before releasing RockGrid as commercial module. If you are interested contact me via PM this is a preview of a module that i'm working on for quite a long time. I needed it for an intranet office management application that i'm still working on. It makes it very easy to create very customized Datatables using the awesome jquery datatables plugin (www.datatables.net) Download - sorry, removed as it changes too frequently; closed alpha - contact me if you think you can contribute Remarks: The module is intended to be used on the backend. Loading styles is at the moment only done via adding files to the $config->styles/scripts arrays. Also the communicaton to javascript is done via the $config->js() method that is built into the admin and would have to be implemented manually on frontend use. But it would not be difficult of course Installation: Nothing special here, just download + install edit: removed some parts, because i made a complete rewrite of the module (and may not have been the last one)! [...] removed Why i created this module: of course i know @Soma s module but i needed a lot more features and the newer datatables version. also i like to define all the columns as objects and have everything on one place. lister & markupadmindatatable: nice for basic tables but lacks of features to modify the appearance of the cell values (like rendering icons, background colors and so on) datatables provides a great frontend API for filtering, showing/hiding columns, getting data, modifying it... it also plays well together with frontend charts like google chart api in this case: todo / roadmap: reload only one row add filters to all columns (in future also dropdowns, smaller than, bigger than, Regex, ...) make it possible to add table on frontend pages make buttons look like pw buttons make it possible to set settings globally and only for one table provide easy way of colorbars (percentage, red/green), maybe at different positions (left, top, right, bottom) provide easy way of adding action items (edit, show, link etc - visible or onhover) make own layout for tables (topleft, topright, bottom etc to make it easy to create extensions and show messages) privide way of simple javascript plugins (like I already have for row sums etc) provide easy way of handling actions for all selected items (delete selected, update selected...) provide easy way of reloading data (--> easy when using ajax source) easy way of showing/hiding columns excel/csv/clipboard export GUI for table setup processmodule to show different tables (lister replacement)
    1 point
  13. Several options. Admin custom files module. AdminOnSteroids has this option too I think. And finally my favourite way: via hook (several possibilities here again)
    1 point
  14. Thanks! Use the code you find there with caution, it doesn't always follow the best practices Plus unfortunately your quote is also valid when changing a word in it: When your site is doing something weird and you can't remember for the life of you how you did it, check AOS first
    1 point
  15. actually that's a good point because requesting the data from the server is one thing whereas presenting it is another. at datatables you have cell renderers that render your values differently in different situations. so your datefield would ideally be an integer (making it sortable) and be DISPLAYED in the table as a formatted string (using moment.js). so you would not need to format the date via sql because that is done on the client maybe that's why i was not really eager about it and you thought it would be more important. but having a findObject/Array method in the core would justify that feature to some extend. regarding the datatables there will also be an option for defining php functions (see here https://processwire.com/talk/topic/15524-preview-rockdatatables/?do=findComment&comment=158061 ). $table->data( $pages->find('template=item'), [ ['col_name1', 'label of this column', function() { return $this->page->title; }], ... So that would make it really simple to setup tables - you would not have to know or write anything related to SQL. You could just use php's date('Ymd', $page->yourdatefield) function. So all the SQL options are really only meant to be used for complex tables. I think every developer working with that kind of complex tables should not be afraid of using some (very simple btw) sql queries thanks for all your input!
    1 point
  16. In the page tree, go to Admin > Blog and EDIT and it should look like this:
    1 point
  17. But you know SQL - I am trying to think of the devs that don't and are used to the PW API. Remember you not only need to know SQL, but you also need a good understanding of the PW database tables structure with the names of the tables and that content is stored in the "data" field. To this end, I would suggest: 'myfield' => 'YEAR()' I'd love to see that converted to: SELECT YEAR(data) AS year FROM field_myfield WHERE pages_id = p.id AS myfield so take the name of the function and lowercase it and return it as "year" for the key/property in the array/object. I think this could be really useful.
    1 point
  18. Don't think that would be a good idea because if you want to query repeaters or the like you can concat strings from subqueries and so on with my route. Maybe we could add a check wheter the statement begins with SELECT or not. If it begins with SELECT it takes the whole query, if not it creates the query for you... 'myfield' => 'YEAR(data)' --> (SELECT YEAR(data) FROM field_myfield WHERE pages_id = p.id) AS myfield 'myfield' => 'SELECT ... FROM ... WHERE ...' --> (SELECT ... FROM ... WHERE ...) AS myfield Not sure how often one would need this short syntax? But also no problem to implement...
    1 point
  19. @bernhard - I haven't looked into the best way to incorporate it yet, but before I forget, I think it would be great to be able to add mysql functions to these new $pages methods. For example, it would be great to be able to directly get the YEAR from a datetime field using YEAR(datetime) AS year. Lots of other options of course, but that should give you an idea of what I am thinking.
    1 point
  20. Great work @bernhard ! The only suggestion that comes on top of my head is maybe some built-in default charts? Also, you could look at the features list of other commercial data table products out in the market, (not just for PHP/JS but other areas like .NET etc) and see if there's anything interesting features you would want to incorporate into yours. Companies I can think of are : Infragistics, Telerik, DevExpress, Syncfusion etc. https://js.devexpress.com/ https://www.telerik.com/kendo-ui/grid https://www.infragistics.com/products/ignite-ui/grids-and-lists/data-grid https://www.syncfusion.com/products/javascript/ejgrid As for whether it becomes free or paid version, I'd certainly be happy to pay for it if I had a use case for it and it was within the budget constraints. It certainly could win clients over if you could show them your CMS has reporting capabilities that others may or may not have.
    1 point
  21. It seems to me that a good definition of a ''Modern Site Profile'' should be: an mix of the UIKit Site Profile and Multilingual Profile. Multilingual: of course, does not need further explanations why this profile is important for many of us. UIKit : for those who ask them selves about the hype around UIKit, I suggest a very basic test: Take a tablet, a smartphone, or any device with a touch screen, and then, go on the documentation page of each of the majors CSS frameworks: -Bootstrap -Foundation -UIkit Try EACH function, like it is supposed to work on a touch screen device: with the help of your ...finger. At the end, I am pretty sure you will understand why UIKit is a good choice for PW: Because IT WORKS. (No more: expand..ooops... retract....Re expand...ooopss keep the finger too long on the item...f...k...try again.... @£¦@@$....will plug a mouse....) Everything works. It could be UIKit 2. Married with PW, It is way enough to make a terrific couple. And.... Santa is coming...
    1 point
  22. I watched that video posted in another thread, and afterwards made sure that all my sites were running on PHP 7.1 It seems to have made a significant improvement to performance.
    1 point
  23. @Federico, I'm not sure I completely understand your question, but if you want to know what inputfield type is used for a Page Reference field you can get that from the "inputfield" property. The type setting in admin: Getting the type via InputfieldPage using the API: // $inputfield is InputfieldPage object $inputfield = $pages(1234)->getInputfield('YOUR_PAGE_REFERENCE_FIELD'); // $type is 'InputfieldSelect' $type = $inputfield->inputfield; P.S. Are you using Tracy Debugger? Things are a lot easier once you start using this module. You can dump an object (e.g. an inputfield) and explore all its properties.
    1 point
  24. PHP 5.6 (and even 7.0) no longer receive active support (both versions receive only security support). You should use PHP 7.1 (matured) or 7.2 (recently released). I tend to wait a little while after major releases (anything can happen), so I’m currently sticking with 7.1 – probably until around March next year (birthday time, hehe). Refer: https://secure.php.net/supported-versions.php
    1 point
  25. http://blog.zend.com/2017/01/10/the-state-of-php-in-2017/ Yes definitely go for 7.x
    1 point
  26. I've been working with different CMS's for quite a few years now but there was always one thing that bugged me, I never knew how the CMS takes a url and resolves a page ID from it. I knew it was to do with the "slug" but what i couldn't figure out is when it came to sub pages, as the slug only refers to the page itself not the parent pages in the url e.g /parent-page/sub-page. The main two CMS's i've worked with are Wordpress and ProcessWire, ProcessWire always has the upper hand when it comes to speed, even a large PW site is tens of milliseconds faster than a fresh Wordpress install. With the resolution of urls to pages being (probably) the most used query in a CMS i thought i'd investigate the two different approaches. Both ProcessWire and Wordpress split the urls by forward slash to extract the slugs /about/people/ => ['about', 'people'], however ProcessWire takes a completely different approach when it comes to resolving a page ID from these slugs. ProcessWire uses this query: SELECT pages.id,pages.parent_id,pages.templates_id FROM `pages` JOIN pages AS parent2 ON (pages.parent_id=parent2.id AND (parent2.name='about')) JOIN pages AS rootparent ON (parent2.parent_id=rootparent.id AND rootparent.id=1) WHERE pages.name='people' AND (pages.status<9999999) GROUP BY pages.id LIMIT 0,1; Resulting in a single item of the page in question including the page's template id. For urls with more parts it looks as though ProcessWire creates more JOINS to essentially walk back up the hierarchy and fully resolve the ID of the correct page. Wordpress on the other hand takes a different approach: SELECT ID, post_name, post_parent, post_type FROM wp_posts WHERE post_name IN ('about','people') AND post_type IN ('page','attachment'); More elegant looking however it returns a list of potential items. So requires a loop within PHP to walk the hierarchy tree and determine the correct page ID. Both queries once cached by MySQL took 19-21ms to return, ProcessWire looks as though it uses this to it's advantage by returning the correct page ID straight from the MySQL cache and doesn't require the extra looping step afterwards. Interesting to see the different approaches to the same problems.
    1 point
  27. Processwire is a decoupled system. The front end is totally up to you, that's why processwire is loved by so many people. But about forms, if you go through this thread a couple of times, you will be making forms real quick: https://processwire.com/talk/topic/2089-create-simple-forms-using-api/
    1 point
  28. And the paid ones at: https://pixelarity.com/ Very nice designs but not used any myself though.
    1 point
  29. got some very good news on this (it feels like christmas for myself, because this made me some headache over the last months and the solution is quite simple and solves a lot of problems). I did some performance tests on a table with more than 10.000 rows and got the following results here on my local test environment (laragon + i7 @ 2ghz). rendering the table with javascript test-data works instantly (using deferrender option, did not try without) rendering the table with data coming from pw pages and 5 different fields takes around 16s single-language setup without caching takes around 5s to load multi-language setup without caching around 8s with markup cache enabled 180ms the screenshot shows a multi language table with 10.000 rows and 12 fields that loaded in 9,1s when building the cache. thats some really nice results, because it will make the setup even easier and it will even work with multilanguage wich I didn't know how to tackle before. my goal always was to stay on the client side, because there you have all the power of datatables: you have a powerful API to filter, sort etc the table and this plays perfectly well together with other clientside libraries like chart.js; my testcase showed that the search and sorting was also very snappy so I think it's definitely doable! It will be the first project after my master thesis and I may have something ready around 03/2018 I don't think that's a proper way to do this. I think there are only the 2 options: Release it for free (donations are always possible and welcome of course) without any support, documentation etc. or release it as pro module and provide proper support and docs. maybe @kongondo or @apeisa can share some of their experiences with us (or at least with me in a PM)?
    1 point
  30. Thanks @adrian. I'll have a look. I currently have up to PHP 7.0. It seems I'll need an app that enables me to easily switch versions. I've tried several in the past but none of them worked well so I settled for UwAMP which does have its issues to.
    1 point
  31. Hi @jaro, I've been having a look at the Repeater issue and the BreakRepeaterFields demonstration. Interestingly, the issue is not that fields are copied from one repeater to another. It is that the module interferes with the listing of fields when the repeater field settings are viewed in ProcessField, causing the fields of one repeater to appear in the AsmSelect of another repeater. So if you check the database the fields associated with each repeater is actually correct despite the incorrect listing shown in ProcessField. But if the user then saves the field in ProcessField it is at this point that the associated fields become incorrect. Could you explain why the module needs to hook ProcessPageView::finished? This method fires on every page view, front-end and back-end. But most of these page views will have no connection to field settings or template settings changing. Instead of hooking this method, couldn't you hook only methods that are related to field and template settings? So some method in ProcessField and ProcessTemplate? And also, the module is looping over all fields on every page view. Could you focus in on just the field that is being edited? So when field1 is edited in ProcessField, just export the data for field1 rather than looping over every field. This would avoid the situation where the data for repeater2 becomes involved when editing repeater1. I should say that I've just had a brief look at the issue so far, so there might be good reasons why the module does what it does.
    1 point
  32. Thank you so much, everybody. I discovered the culprit which is me... I studied the module and the first this it checks is the presence of the <html> tag... and it was missing! Go figure! After all these years making websites!!!! I am ashamed... ;-) Thank you again!
    1 point
×
×
  • Create New...