Leaderboard
Popular Content
Showing content with the highest reputation on 10/19/2016 in all areas
-
$designers_person = $pages->find("parent=/designers/, designers_lastname!=''")->each(function($designer){ $designer->custom_sort = $designer->designers_lastname; }); $designers_group = $pages->find("parent=/designers/, designers_lastname=''")->each(function($collective){ $collective->custom_sort = $collective->title; });; $all = $designers_person->add($designers_group)->sort('custom_sort');5 points
-
A bit similar to @arjen's approach: Duplicate the field as yourfield_replacement labelled "Your Field Label Replacement" and add it to the page's template Add a new datetime field replace_after labelled "Replace field at" to the template In site/ready.php, check if $page->replace_after <= current timestamp and $page->yourfield_replacement has content If yes: replace $page->yourfield with the content of $page->yourfield_replacement, empty $page->yourfield_replacement and save page This way, editors can edit new content in the added field and schedule replacement whenever they want. The replacement will happen the first time the page in question is accessed at or after the date+time in $page->replace_after. You can make it a little more elaborate and safe by adding a checkbox to activate the replacement logic and reset it after successful replacement to avoid accidential replacements, which are likely to happen when editors hit "save" after changing the replacement content without having adapted the replace date first.4 points
-
Thought I'd show some work in progress modules. Subscribers https://github.com/benbyford/Subscribers has functions for logging in new users, added with new subscriber role bulk export the subscriber users to comma delineated SubscriberList (submodule) module adds an admin page to view your subscribers and page through them, or export WireMailChimp https://github.com/benbyford/WireMailChimp (though I need to change the name on github) Implements https://github.com/drewm/mailchimp-api adds any user save to a mailchimp list settings for API and List id only adds users that have a checked email_subscribe field to true3 points
-
I don't use ProCache (yet, since all the PW sites were highly dynamic ones and speed wasn't an issue so far), so I can't speak from experience, but with ProCache I'd likely set up a script in a (system) cron job instead of a ready.php snippet and interate through all pages with a selector like "replacement_active=1, replacement_date<=$now", then perform the replace as above and save. I believe ProCache should update the cache on its own after page save (correct me if I'm wrong).3 points
-
I would do it like this: Duplicate field "field_name_new" and assign to template. Let client place content in "field_name_new". Create a PHP script (i.e. /public_html/update_field.php) Bootstrap ProcessWire Get the page Copy the value of "field_name_new" to "field_name" (setAndSave method) Remove the "field_name_new" field from template and delete field Schedule a cron job which triggers http://yourdomain.com/update_field.php3 points
-
@BitPoet the whole page thing definitely trips me up. I'll take a look at that module. I've also received an official document of authorisation from my wife to invest in the profields plugin, end of the month. (I'm the boss, as long as she allows me to be.) Thanks for your input!3 points
-
Still very fresh, but I thought... what the hell... spread the PW love and give you guys a first look... https://music-room.com This was a huge project. Still lots of debugging to do, but early feedback most welcome! Don't look at the code (particularly the js)... it's a bit of a garbled mess! Ha ha! Need to, ahem, refine it over the coming weeks and months. Haven't made the jump to PW3 yet as I'm using a few modules which don't work out of the box. Thanks again to Ryan for everything. Also, big thanks to Antti for his wonderful PadLoper module. Cheers and happy browsing! Douglas.2 points
-
An article from April describing a strategy for deploying PW using Robo task manager http://antonioandra.de/articles/deploying-processwire-with-robo/2 points
-
2 points
-
I've done some more digging. The field with SimpleMDE definitely needs to be refreshed, but it is possible to just "init" that field if we hook into the correct triggered events. I've tested this with Textarea fields using SimpleMDE as their Inputfield: If the field is closed; or if the field is within a Fieldset that is closed; or if the field is on a tab that is not visible on page load... The following code fixes all of those cases: /** * Init for Processwire * These items could be added if fullscreen or sidebyside would work on PW * Note that fullscreen mode is not working right on Reno theme */ var initSimpleMDE = function() { var thisID = $(this).attr('id'); var visible = $(this).is(":visible"); if(visible && $(this).data('simplemde-made') !== 'true') { $(this).attr('data-simpleMDE-made', 'true'); // console.log($(this).data()); var simplemde = new SimpleMDE({ element: document.getElementById(thisID), toolbar: ["bold", "italic", "heading", "|", "quote", "unordered-list", "ordered-list", "|", "link", "image", "|", "preview", "side-by-side", "fullscreen", "|", "table", "horizontal-rule", "code", "|", "guide" ], spellChecker: false, promptURLs: true, // forceSync: true, }); } } /** * Init the field on page load */ $(window).load(function(){ $('.InputfieldSimpleMDEField').each(initSimpleMDE); }); /** * Re-init for fields that are now visible due to: * - opening a tab with a hidden field, making it visible * - opening an accordion with a hidden field, making it visible * - opening a field that was closed */ $(document).on('wiretabclick reloaded opened', function() { // console.log("got here"); $('.InputfieldSimpleMDEField').each(initSimpleMDE); });2 points
-
Done did it: public function init() { $this->addHookAfter('Page::render', $this, 'styling'); $this->addHookAfter('Page::render', $this, 'filterFieldFields'); } protected function styling(HookEvent $event) { $page = $event->object; $edid = $this->pages->get($this->input->get->id); if(!($page->process = 'ProcessPageEdit' && $edid->template = 'importupdate')) return; $css = wire('config')->urls->ImportUpdateUltimate . 'ass/edit_importupdate.css'; $event->return = str_replace("</head>", "<link rel='stylesheet' type='text/css' href='{$css}'/>\n</head>", $event->return); } protected function filterFieldFields(Hookevent $event) { $page = $event->object; $edid = $this->pages->get($this->input->get->id); if(!($page->process = 'ProcessPageEdit' && $edid->template = 'importupdate')) return; if($edid->iu_template) $tpl = wire('templates')->get((int) $edid->iu_template[0]); else $tpl = null; $fields = []; if($tpl != null) { foreach ($tpl->fields as $f) { $fields[] = $f->id; } $fstring = '[' . implode(',',$fields) . ']'; } else $fstring = '[]'; $js = <<<EOT <script> $(document).ready(function(){ var arr = $fstring; var def = '<option value=""></option>'; if (arr.length) { $('#Inputfield_iu_match option').each(templateFieldOptions); $('#wrap_Inputfield_iu_fieldmap select option').each(templateFieldOptions); $('#_Inputfield_iu_maptab').click(function() { $('#wrap_Inputfield_iu_fieldmap select option').each(templateFieldOptions); }); } else { clearFieldOptions(); } $('#wrap_Inputfield_iu_template .asmListItemRemove').click(clearFieldOptions); function templateFieldOptions() { var val = parseInt(this.value); //console.log(typeof(val)); if (!arr.includes(val) && val>0) { //console.log(val); $(this).prop('selected',false); $(this).prop('disabled',true).remove(); } } function clearFieldOptions() { $('#Inputfield_iu_match').html(def); $('#wrap_Inputfield_iu_fieldmap select').each(function() { $(this).html(def); }); } }); </script> EOT; $event->return = str_replace("</body>", "{$js}</body>", $event->return); }2 points
-
@lenoir Maybe, as a simple way, you also can add a select field near to the croppable image field and let the user select which format he want to be displayed on that page on the frontend.2 points
-
Was looking at something similar today. In my case I'm using this approach http://processwire-recipes.com/recipes/duplicate-content-between-fields/ to copy info between fields.2 points
-
Is /usr/bin/php in fact a client sapi build? Is there a /usr/bin/php-cli (or php5-cli) binary on the live system that you can call from cron instead?2 points
-
It's actually still on the list, but there were a lot of other things that took priority. While I did incorporate some of the changes mentioned above, I'm currently not happy with the behavior in the page list, so this needs some extensive and careful tinkering. Currently, changing online/offline status from the page list reloads the tree each time, which is too time consuming. Since it's in use in production in an ever-growing intranet page, that will become urgent sooner or later, so chances are high I can fit the overhaul in before Christmas.2 points
-
2 points
-
Hi all, to open a certain page for editing you can use $session->redirect($mypage->editURL); But what when you would like to open the Children tab of that page instead? Just change it to $session->redirect($mypage->editURL . '#ProcessPageEditChildren'); I found it hovering over that tab: The status line shows the additional "#ProcessPageEditChildren". Perhaps this could be useful for some of you...1 point
-
In PW you have pages, fields and templates. Each page can have multiple fields (text, textarea, checkboxes etc.), these fields are not assigned directly to the page but rather to a template. So you create the fields, create the template and assign the fields to the template. When you create a page you can choose a template, this way you tell the page to use the fields assigned to that template. The templates you create also need (need only if the template is used in front-end) a template file in /site/templates/ directory, so that when you access a page in the front-end PW uses that template file to display content. Do read some of the tutorials, as they explain this better: https://processwire.com/docs/tutorials/but-what-if-i-dont-know-how-to-code/ Don't know where you read about the bootstrap thing, but it can refer to two things bootstrap the css framework or this bootstrapping. OOP means Object Oriented Programming and PW is written using this way of programming.1 point
-
It doesn't have a shopping cart--at least not that I'm aware of. Most of the reservation page is custom forms / code and such. We have been expanding and tweaking the reservation form for over 6 years and it is available in English, Spanish, and Portuguese. Also, Ryan gets a ton of email so he doesn't always respond. To get his attention I usually have to send him text messages. Not sure about padlooper...I've never heard that word. I'm happy to answer other questions. Jan CTO Tripsite.com1 point
-
Another fix is to append a script tag and call an init function. That would be more reliable imo.1 point
-
Interesting stuff, Max. Am looking for some sort of e-commerce solution down the road. Will take a look when I have to cross that bridge.1 point
-
The module adds two image fields to the language template, one for published and one for unpublished status.1 point
-
Hi Horst, thank you for the hint. Yes with repeater_slider_repeater it works like a charm.1 point
-
ProcessWire 2.7.x and below to be exact. I’ve never installed PW 2.8.x, but I read that it is 3.x without the ProcessWire namespace.1 point
-
Dealing with images in the admin has been completely refactored: https://processwire.com/blog/posts/major-images-field-upgrade/ So now we have "Default image grid mode" instead.1 point
-
Indeed strange. To me this is a must-have when dealing with multi language sites. Right now there is not really a way to overview all languages from the PageTree. Great! In case you need any testing please let me know.1 point
-
@Mackski Hi, You might want to check out these:1 point
-
1 point
-
@blommie: I'm not sure JsonNativeField is going to fit your bill. While it supports an arbitrary number of entries, those are key => value pairs, much like regular fields with a name and value. You might want to look at the ChosenSelect Inputfield, which behaves as a tagging field and allows creating new "tags" (which are actually PW pages behind the scenes with the tag value as the title) on the fly if you enter a new name. Repeater and Page field types don't need you to have the pages used in them to already be present in the system. A page is just an entry in a table in the database, and if you use repeaters, the template configuration for these pages is even done behind the scene when you define the repeater field's parts (fields). If you're coming from other systems, the concept of using "full-blown" pages for simple data might seem a bit much, but because PW keeps things simple under the hood, it actually doesn't get much leaner database-wise.1 point
-
I tested your issue in PW 2.7.2 and I can't reproduce it. Toggling back and forth between a default view of Rows and Grid updates as expected when the field is inside a repeater. You could consider upgrading to PW3 where images may be deleted from all thumbnail views. Or if you must stay with PW 2.7.2 you could try this module from @BitPoet.1 point
-
1 point
-
@DarkwaveSurfer, Please see post: post_small_image only works when the second parameter of renderPosts() is true (like in your case, so it should work...hmmm). Try removing the post_large_image from the options if you are using post_small_image. I haven't looked at the module in a while so I'll need to re-educate myself with some of the options . Have you tried post_small_image => 2? That should display (IIRC) the featured image after the post title.1 point
-
I believe that was in Processwire 2.x. It's not in 3.x.1 point
-
I don't think that's going to work. For starters, you can't use the "Custom PHP" option with Autocomplete. See the field description: Also, the type of dependent select you need only works for select inputfields. You could try having the second Page field use a select inputfield and use this as the "Custom selector": template=committee_event, committee_draft=page.committee_draft, include=all Not sure if dependent selects work with the first inputfield being anything other than a select, but it's worth a try. Edit: it doesn't work - both fields using this type of dependency must use a Select, Select Multiple or AsmSelect.1 point
-
yes, you can create the shopify_embed field for example, a textarea (can use plain or ACE Extended). Then for each product you have you just need to grab the code and paste in that field. then you can just echo the embed code... <?php echo $product->shopify_embed; ?>1 point
-
1 point
-
I am also a big fan of the Dash App, so I made a Docset request, but the developer wrote, that it only has 7 upvotes so far and he wouldn't include docsets if there is not much more request. But maybe somebody knows how to generate a Docset and could contribute it to the user-contributed-docsets. Regards, Andreas1 point
-
First of all I would like to say: Great job @Jonathan Lahijani for bringing CMS Critic back to ProcessWire. I first discovered PW through CMS Critic, so I'm thankful, that they awarded 2014 ProcessWire as Best Free PHP CMS. But I recently wondered, that a so-called "CMS review" site hasn't covered the release of PW3 at all? Is there any particular reason for this or am I just missing something? Regards, Andreas1 point
-
So there's good news and bad news, as I'm almost done testing. The good news is that I'll be able to wrap up the content nesting code some time tonight. The bad news is that fixing the problem of subject lines > 76 characters is basically impossible, since PHP's mail() function messes up all attempts at wrapping the subject header, mb_encode_mimeheader or not, on my system. This is likely a Windows oddity, but it's reproducible across PHP versions. Strike the bad part, fooled myself there. So chances are high there'll be a working, thoroughly tested git branch by this time tomorrow.1 point
-
Besides Repeater and PageTable, there are Table and Multiplier in the ProFields package that can be used for repeating content. But for a simple repeatable text string you could just use a textarea field and explode() on newline to get an array of values. $values = explode("\n", str_replace("\r", '', $page->my_textarea));1 point
-
These subpages named home, etc, didn't they have a template called repeater_slider_repeater ? I'm not totally sure, but to a great extend, that the repeater items always have a template name with prefixed repeater_1 point
-
1 point
-
I know that using a repeater for such an input looks like a bit convoluted solution, because a repeater is designed to handle more than one field "during input", but if you only assign one filed to the Repeater you use, then you can get a similar behavior. With a little bit of admin CSS hacking, you might even be able to tweak it to make its UI less "verbose" (on the repeater field's Details tab settings you can even set its items to be "always open"). Note, that without ajax loading, you might not want to create more than 40-60 items for performance reasons (depending on your server config), see: This has been improved with the “ajax option” though: https://processwire.com/blog/posts/more-repeaters-repeater-matrix-and-new-field-rendering/1 point
-
Hi! I just pushed a new bunch of updates for PW 3.0.36 and drafted a new release. We are slowly reaching 100 % Any fixes or additions are welcome! Have a nice weekend!1 point
-
good to know about versioning thank you! and the expiration I'll check a little later thanks for spotting this..1 point
-
I'm experimenting with admin columns and so far so good! I've used Admin Template Columns which served well for years but I always felt there should be an easier way to accomplish this. ATC uses two fieldsets so you have to drag 4 asm fields in your templates to set columns. Plus if you need custom column width then you'll need to percentages at two fieldsets' settings. My current solution uses only one field (FieltypeText actually, but it doesn't matter) so to separate columns I only need to put this field in the list where I need a column break. Custom width can be set by editing the field's width and both column's widths will be calculated. I'll need to polish a few things but I like it's simplicity (and that there's one less module to install).1 point
-
I've been tweaking this a bit to work in sync with active/inactive statuses, added reasonable default behaviors for trying to access pages in non-viewable languages and made ui interaction a bit smoother, so the code has grown quite a bit. I still need to tidy it up a bit, adapt the installer/uninstall methods, add comments to the code and such and do some testing with the latest PW versions. Once I've found the time for that, it shouldn't be long until I can release a production-ready version, which should be towards the end of January.1 point
-
I like the idea. I have been looking for proper way to version control PW sites recently, and have not ended with a clear decision for myself. Of course "it depends on a project". But we can come up with a tutorial helping make the choices. What to version in git I never tried initialising a git repo in templates folder, as Ryan suggested here. Custom modules and now site/ready.php should go to version control, as well as config.php. For me the choiсe is either to version the whole installation or only the /site folder. As I usually modify the .htaccess I am leaning to the former. The next thing is what to ignore. Some think you should ignore /wire, some think it is worth having it in the repo. If we could (I mean If I knew how to) install the needed version of PW core as a dependency via composer or include it in a similar way automatically after deployment / git checkout, it would be better to leave /wire off. But for simplicity it could be better not to exclude it as it is quite small. That definately should be excluded is some part of site/assets. If the site is a big one, excluding site/assets/files is a must. But for a small near to static it is probably worthless. You should probably ignore these almost every time not to mess with constantly changing data: site/assets/cache site/assets/sessions site/assets/logs I found no reason not to include all modules to the VCS. Deployment Speaking about deployment, I do not like the idea to deploy every time I commit (which seems to be the case if using git-hooks, if I am getting it right). There are other ways for deployment with git, but I an intrigued by doing it with something like this or this (both are capistrano-like deployment tools in php). Anyway, I do not seem to find a way to easily deploy database changes. Maybe in the case of semi-static sites it is possible to dump a database and restore in with git-hooks (or to include a sql dump from sites/assets/backup/database to the revision and manually restore it), but it probably will never work with subscription sites and rich-content sites managed by clients. The only way to keep track of changes made to the database via PW GUI (admin) I came up with is keeping a journal. I made a folder where I include subfolders related to git commits with JSON export files for fields, templates and forms, which should be imported. Pages are just described in .txt as I know of no way to export them to something like JSON. It would be awesome to have something like the things discussed here available not to do it manually. Hope it is somehow useful. I would be delighted to hear how others do it, as I am certainly only an amateur in all this stuff.1 point
-
Some best practices in the Docs or Tutorials section about keeping processwire installations version controlled, could be helpful. So, what's the best way to handle modules and templates. Submodules, subtrees or just one bloating site-repository. Also deployment, with git-hooks (or whatever to recommend), could be mentioned there. Any thoughts on this?1 point