Leaderboard
Popular Content
Showing content with the highest reputation on 11/04/2016 in all areas
-
New master and dev versions released, more coverage of what you can do with the new Functions API, plus a couple useful tips and tricks. https://processwire.com/blog/posts/processwire-3.0.40-core-updates/10 points
-
I started changing over my default site profile that I use as a base for new projects to use the functions API and region() function. Then I realised that neither of these will suit me because the functions can't be interpolated in strings the way variables can. I much prefer string interpolation over concatenation - I find it more concise and easier to read. The main attraction to me was the IDE code completion. Pasting the following at the top of each template file does the trick and isn't much hassle. namespace ProcessWire; /** * ProcessWire API variables * * @var $page Page * @var $pages Pages * @var $modules Modules * @var $user User * @var $users Users * @var $permissions Permissions * @var $roles Roles * @var $input WireInput * @var $sanitizer Sanitizer * @var $session Session * @var $log WireLog * @var $cache WireCache * @var $datetime WireDateTime * @var $files WireFileTools * @var $mail WireMail * @var $config Config * @var $database WireDatabasePDO * @var $fields Fields * @var $templates Templates * @var $languages Languages * @var $wire ProcessWire * @var $procache \ProCache **/ A similar thing can be done for region variables to avoid IDE 'undefined variable' notices. /** * Template region variables * * @var $headline * @var $content * etc **/ I've set these up as a file template in PhpStorm so they appear automatically for each new PHP file created in the project.8 points
-
The Function wireClassExists() is described as follows: ProcessWire namespace aware version of PHP's class_exists() function The function returns the expected value, without a defined namespace <?php class bar extends Roles { } // namespace aware function var_dump(wireClassExists('bar')); // return false var_dump(wireClassExists('\bar')); // return true // not namespace aware function var_dump(class_exists('bar')); // return true and with defined namespace <?php namespace ProcessWire; class bar extends Roles { } // namespace aware function var_dump(wireClassExists('bar')); // return true var_dump(wireClassExists('\bar')); // return false // not namespace aware function var_dump(class_exists('bar')); // return false6 points
-
This seemed like a fun challenge so I put together a little proof-of-concept module. For this to work you need to do a couple of things: 1. Correct a bug in InputfieldPageTable.js - hopefully will be fixed in the core soon. In the meantime you can copy the InputfieldPageTable directory to /site/modules/ and change line 18 of InputfieldPageTable.js to: Edit: sorry, I was wrong about this 2. Include "template" or "template.label" in "Table fields to display in admin" for your PageTable field. A screenshot of the module config: Download v0.0.3: LimitPageTable.zip6 points
-
wow thanks guys for SOTW (news 128) , had completely missed that somehow! Also forgot to mention the credits page https://www.elliottcarter.com/credits/ where thanks to all forum members, and a few folks who really made this project possible during it's development and helped me on the forum, and also just by their modules and/or advice, @ryan, @LostKobrakai, @Martijn Geerts, @adrian, @teppo, @netcarver, @horst, @kongondo, @Soma (and at some point i still have to figure out how you make those cool images with the screenshots/devices, always have trouble with that...)5 points
-
additionally to what @adrian said, it is possible to define those both templates in the admin, one plural and one singular, to build a family out of them. But if you like, you can use one template file for both. If you have created an advertisements.php under site/templates/, create the plural template first. When creating the singular template, select ceate a template without template file in the first screen, (write your singular template name into the input box, without the fileextension). Save, open again and head to the tab [files]. There you select to use an alternative template file, your plural template file. Now you have two templates for easy sort between parent and children, and one templatefile that renders your markup. If you want to render it the same, do nothing special. If you want to render parent and children different, you can check the template name like // this block is skipped by child pages if("advertisements" == $page->temlate) { // chek for plural / parent template // do your stuff ... return; // end template file processing here for all parent pages } // do your stuff for child pages (single template pages) here, ... ...4 points
-
Ok... I actually figured it out. I just found this page which helped.... https://processwire.com/api/ref/page-array/add/ Here's what I ended up with.... $p = new Page(); $p->template = "basic-page"; $p->parent = "/api-generated-pages/"; $p->title = $randomTitle; $p->pageoptions->add(array(1023,1026)); $p->save(); Fortunately I had read a few threads looking for the solution and that is what helped me add the array in to add multiple pages into the page field at once. Hope it helps someone else! Have a great weekend everyone!4 points
-
Maybe my module Cronjob Database Backup could help. This module has an option to delete all backups except a predefined number of last backups to keep (via Module settings). Also some other useful options. Try out, feedback welcome. http://modules.processwire.com/modules/cronjob-database-backup/3 points
-
Hi, I'm excited -- this feature now has found its way into the recent code base Thank you @Robin S for the initial nudge and @ryan for adapting this. https://github.com/processwire/processwire/pull/18#issuecomment-2581868243 points
-
Interesting question! I give a like for it. OT: I always would use namespaced template files for new projects now. (Skipping all filecompiler interaction for template files)2 points
-
@Ivan Gretsky...not yet, sorry. Hopefully I will brighten your life once again soon-ish...2 points
-
Indeed it will - but the plate has been filled once again, and haven't had a chance to do the refactoring mentioned on the roadmap before I continue with features. The composer issue kinda messed things up for me. Sorry for the delays...2 points
-
Okay I figured it's probably my fault but couldn't try it until today.. So @Ivan Gretsky's recipe is working fine..some might already know, but for the shared files/dirs to work you need to set up the correct file structure within shared directory, so you're shared folder needs to look like this -shared -site -assets -config.php2 points
-
The usual approach would be an "advertisements" (plural) template for the parent page and an "advertisement" (singular) for the child pages - that will give you the most flexibility in controlling the Family settings so that all child pages must be of that advertisement template when created. There are other approaches, but this will be the simplest/most flexible while you are learning the ropes!2 points
-
Something like this? : Of course, the selectors and the fields must be adjusted, but as far as I understand your issue, this one should also work when dealing with dates. BTW, welcome to the forum2 points
-
There is no need for processwire:symlink task. Just use the built in deploy:shared task instead: <?php /** * Deployer ProcessWire Recipe * Version 0.0.1 */ require_once __DIR__ . '/common.php'; // ProcessWire shared dirs set('shared_dirs', ['site/assets']); // ProcessWire shared files set('shared_files', ['site/config.php']); /** * Main task */ task('deploy', [ 'deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:symlink', 'cleanup' ])->desc('Deploy your project'); after('deploy', 'success'); And not sure config file has to be shared. Of course it is bad practice to store you db credentials in the VCS, but this file is quite essential for the PW site.2 points
-
Thanks to a new "community" member I just started using git and deployer for my main project happygaia.com it's soo nice and clean and million times faster to publish a new feature, fix or whatever..I'm still in development or more bug fixing phase so I haven't actually deployed to live stage yet but local to staging works like a breeze so far I already separated processwire deploy logic from project stuff to start a dedicated processwire recipe which looks like this so far <?php /** * Deployer ProcessWire Recipe * Version 0.0.1 */ require_once __DIR__ . '/common.php'; // ProcessWire shared dirs set('shared_dirs', ['site/assets']); // ProcessWire shared files set('shared_files', ['site/config.php']); /** * Symlinking assets and config.php from Deployers shared folder * * @note You have to put those files manually into shared folder before first deploy * To run this task automatically, please add below line to your deploy.php file * <code>after('deploy:symlink', 'processwire:symlink');</code> */ task('processwire:symlink', function() { run("ln -s {{deploy_path}}/shared/assets {{release_path}}/site/assets"); run("ln -s {{deploy_path}}/shared/config.php {{release_path}}/site/config.php"); })->desc('symlinking assets and config.php from shared folder'); /** * Main task */ task('deploy', [ 'deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:symlink', 'cleanup' ])->desc('Deploy your project'); after('deploy', 'success'); As you might note the processwire:symlink task won't run automatically, you either call it manually or like mentioned in the phpdoc you hook into the deploy task and put it e.g. after deploy:symlink Reason for processwire:symlink is that at least happygaias assets folder is quite huge and it's not part of my git repo so it's not being deployed each time instead it gets automatically symlinked from deployers shared folder Side note: Images (for now) only being updated from live page so no need to upload in deployment process.. Nearly forgot to mention that it's not only about assets folder but site/config.php, too. So config.php is not part of my git repo so I place it in deployers shared folder once and it get's symlinked (like with assets) The plan right now is to "just" keep databse of live site intact (more or less) after I switch live to new version it'll update because of new pw version and module versions of course and I have to tweak some minor changes, manually e.g. exporting/importing templates but that's fine for now I might look into AutoExportTemplatesAndFields module soon as it sounds really nice I still have to figure some deployer things out, but as mentioned it seems to work fine for now Okido that's all for now, questions, comments, feedback everything is welcome and appreciated Uh it would be nice to get more ideas and testing whatever for the recipe so I could post it to the deployer repo soon ;-)1 point
-
Croppable Image 3 for PW 3.0.20+ Module Version 1.2.0 Sponsored by http://dreikon.de/, many thanks Timo & Niko! You can get it in the modules directory! Please refer to the readme on github for instructions. - + - + - + - + - + - + - + - + - + - NEWS - 2020/03/19 - + - + - + - + - + - + - + - + - + - There is a new Version in the pipe, that supports WebP too: - + - + - + - + - + - + - + - + - + - NEWS - 2020/03/19 - + - + - + - + - + - + - + - + - + - ------------------------------------------------------------------------- Updating from prior versions: Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step: In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates. ------------------------------------------------------------------------- For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here. -------------------------------------------------------------------------1 point
-
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 true1 point
-
COMPOSER ELLIOTT CARTER (December 11, 1908 - November 5, 2012) is internationally recognized as one of the most influential American voices in classical music, and a leading figure of modernism in the 20th and 21st centuries. https://www.elliottcarter.com/ This site was launched some months ago, and was one of the larger projects I completed so far. It took about 4 month to build. (PW 2.7.3) This was the first project I used the wireRenderFile() pattern on, and it consequently allowed me to reuse a lot of output code, as well as do a lot of markup/object caching with wirecache. The site uses DataTables for all of the major listing pages, Works, Discography and Events, allowing users to filter and search with no page reload. This probably has the most advanced caching setup that I've done so far, and one example of how it works is on the discography page: https://www.elliottcarter.com/discography/ That page has to hold all 264 albums (json object which is rendered by dataTables), and each album takes a bit of processing to render (formatting of works, artists etc.). The json for each album's list view is wirecached individually and is generated on visits to the individual album pages, so that they never get generated all at once when visiting the discography page. The complete json object containing all of the albums is also wirecached, then the final page is pro-cached. The album covers are lazy loaded so as to not affect page size or load speed. The selects on the left are also all wirecached as page or regular arrays. This results in a 1.6s page load time and a page size of 1.12 MB. Without the data being wirecached the load time is around 9 seconds to generate the page, probably longer if it had to regenerate all 264 albums, but the album info never changes, so they are permanently cached unless someone edits one. Also should note that since there is so much use of wirecache, @Soma's Clear Cache Admin was pretty much indispensable for managing all of the caches. Other features of the site include extensive use of Schema.org microdata, an events submission system, and a lot of custom stuff in the admin for managing the content, such as automated fetching of album covers from Amazon, converting formbuilder submissions into events, a custom admin dashboard etc.. There are probably 60 modules in use overall, but these in particular saved the day: MenuBuilder AdminCustomFiles AdminPageFieldEditLinks All the Selectize modules URL checker PrevNextTabs WireMailMailgun SetupPageName Changelog AdminCustomPages Twitter Feed Social Share Buttons RSS Enhanced Chosen Select Runtime Markup Batch Child Editor Tracy Debugger As well as all of the pro modules (ProFields, FormBuilder, ListerPro, and ProCache). More info, screen shots etc will be gradually posted here...1 point
-
1 point
-
@szabesz you'll need to remove the line that I added to block attempts to scan Wordpress, or you won't be able to login: RedirectMatch 403 (?i)(wp-admin|wp-content|wp-login) But you can basically copy and paste from from the code from the original site: https://perishablepress.com/6g/1 point
-
Is it possible to add check boxes in order to select multiple backup files and delete them all at once, rather than having to click each one, then Delete? Also it would be helpful to make the Restore process more distinct from Deleting. I must have inadvertently clicked the wrong button once and restored a backup unintentionally, wiping out a day's work. My mistake of course. I obviously wasn't paying close enough attention.1 point
-
1 point
-
<?php // in mytemplate.php echo "Roles:" . wireClassExists('Roles') . "<br>"; // expecting true echo "foo:" . wireClassExists('foo') ."<br>"; // expecting false class bar extends Roles { } echo "bar: " . wireClassExists('bar') ."<br>"; //expecting true Output: Roles:1 foo: bar: If I add namespace ProcessWire in mytemplate.php, then the result is as expected, class bar exists: <?php namespace ProcessWire; // in mytemplate.php echo "Roles:" . wireClassExists('Roles') . "<br>"; // expecting true echo "foo:" . wireClassExists('foo') ."<br>"; // expecting false class bar extends Roles { } echo "bar: " . wireClassExists('bar') ."<br>"; //expecting true Output: Roles:1 foo: bar: 1 This is how it should be?1 point
-
Thx, kixe. I wrongly expected that wireClassExists('bar') would always return true, with or without namespace. Because this is not the case, this is why DynamicRoles module (and possible others?) doesn't work on PW3 unless you add namespace.1 point
-
1 point
-
1 point
-
When you're on a development system, enable display_errors and html_errors and set error_reporting to E_ALL in php.ini. This way, you'll get a sensible output for most errors. If you still end up with an internal server error and your http server's error log isn't cluing you in, you can try bootstrapping PW from the command line and rendering the page that causes the error from there. <?php // Needs to reside in PW's main directory where index.php is, otherwise // the path to index.php needs to be passed to include(). include('index.php'); echo $pages->get('/your/faulty/page/')->render(); In your example, you use the Page::render function. Admittedly, it's a bit unfortunate that there isn't a more detailed description linked in the 3.x API docs for $page/Page. The (optional) first argument to that function is either the name of a field on the page (in which case it searches for a field template with a matching name) or the name / path (relative to the templates directory) of the PHP template to use. The '/' you pass here apparently doesn't do what you think. <?php $contact = $pages->get('/contact/'); /* retrieve contact page*/ // Renders output using the template file assigned in the backend // that $contact uses: $contactRendered = $contact->render(); // Or: use a different PHP file than the template's default, // relative to site/templates. This call will look for a PHP // template site/templates/contact_simple.php $contactRendered = $contact->render('contact_simple.php'); echo $contactRendered; /* output rendered contact page here */ ?> One little thing that makes development infinitely easier in the long run is to always be as explicit as possible when you name your variables. Try to avoid generic names like $getPages (unless you're really writing a generic function that deals with all kinds of pages), make them descriptive about what they contain and let singular and plurals forms tell you whether they hold a single instance or multiple. I've adapted the snippet of code accordingly.1 point
-
I haven't used the Wordpress hana plugin, but maybe this is what you are looking for: http://wpmarketing.org/forum/forum/wp-plugin-hana-code-insert1 point
-
I think you're in the wrong place - this is the support forum for ProcessWire, not Wordpress! ProcessWire also has a hanna code plugin - I think that is your confusion, but since you are here, maybe you should stay1 point
-
No - just go to your PW Access > Roles menu and assign the relevant hanna permissions to the appropriate roles. I just re-read your question and see that you actually only want the codes editable by the administrator role. By this do you mean the PW superuser role? By default, only the superuser should be able to view/edit hanna codes.1 point
-
@Juergen Sorry for being off-topic, but if you like UIkit, you should look out for UIkit 3. I am excited.1 point
-
Just to complete this … My provider told me "there is no error on our side" always. About 5 weeks ago the provider moved to a new location and all my data were transferred (don't know exactly how) and for the last couple weeks I had no problems1 point
-
Another possible approach would be to add the condition in the head of the calculator template file, include the result template when met and return, otherwise proceed as normal. calculator.php: <?php if($input->get->firstvalue && $input->get->secondvalue ) { include('_result.php'); return; } ?> /* The regular calculator template follows here */ This way, you don't have any "strange magic" that swaps templates and that you'll have to search for when you re-visit the code in three years time1 point
-
Just pinging @Mike Rockett who develops the Jumplinks module which is a much more feature-rich version of the Redirects module. I know he is working on a new version of JL - perhaps multi-language will make it in?1 point
-
Quick update guys. Frontend module is ready. I have to update the docs first before releasing it though as with anything frontend, there are security implications if the module is not properly set up. Hence, the need to first prep the docs. Will talk more about how it works later but setting up the selects is quite easy. These are defined in a process module in the backend (think Menu Builder) with caching and validation right out of the box. Hope to release next week.1 point
-
I may be alone with this but I feel more productive without CSS frameworks. A small grid is OK but the rest is better to be custom. There is always something I need differently done and then the framework only hinders me.1 point
-
1 minor "issue" some modules are double listed. i guess that comes from the "new modules" tab, that shows recently installed modules. maybe you can exclude them in the list? feature suggestion (thank you for the docs-links btw): i think it should be possible to have an index on top of your github readme linking to each submodule via #mysubmodule. i suggest placing only ONE link to the docs beside the main headline (as shown in my screenshot in my previous post) and then the user could click on the relevant item and images would already be loaded and the github issue should not be an issue any more. the current help-icon could be replaced by a link icon, linking to the section of the module config, where we can define the detailed options for this submodule. do you get me? i find myself a lot enabling/disabling submodules and then having a "hard time" to find the options for that submodule. thank you for this great module1 point
-
My opinion is that there always should be a verbose, but obvious way to do things. And a cool shortcut way like the +. The verbose obvious and native to PHP way would probably be the 3rd argument. With variables we just do .=, which is a language native construction and easy to understand by anybody, not only someone like @horst , me or anyone who loves PW and reads every blog post.1 point
-
Nothing special. Just to use session based message. Again something to complain about. Sorry for this Good to have the option to limit the cookie consent to a special path/ tree. But in this case the banner shouldn't be shown for pages not residing under this tree. It would also be nice to store the page id and not the path, to stay multilanguage compatible and to avoid problems if the page name has been changed. A page-field (instead of text) would be the simplest solution here.1 point
-
It is always important to eat your own dog food. It is interesting how coming to site design with PHPStorm at hands can change the whole API paradigm at once) As now we have at least 3 ways to call an API variable it would be incredibly important to have a detailed explanation about how to take a decision what to choose. Most of us used to use $page, but newcomers starting with demo profile will be using page(), and we are not even touching on wire() and $wire. It seems like @ryan is more into the function interface (you wouldn't be inventing it other way, would you). Please consider making an article about when to choose what, if you got time. I really like the regions functionality, but the + at the beginning and at the end seems magical and probably goes against the initial functional interface intention to have closer IDE integration. I do not think this could be advised by IDE (or am I missing something?) Is there or should there be other more convenient way to append and prepend to regions?1 point
-
Done! Please let me know if you have any problems and also be sure to "Like" @Can's post over here: https://processwire.com/talk/topic/5825-multi-language-support-for-module-config-fields/?do=findComment&comment=131595 because he showed me how to add ML module config settings.1 point
-
I just pushed fixes for the issue identified by @Zahari Majini Please update to v0.2.0 or later if you want to use this field in repeaters.1 point
-
As far as I tested it, this GitHub pull request should fix the bug when using the module with PW 3.0.32+: https://github.com/kongondo/MenuBuilder/pull/301 point
-
There's also something similar in the core. If you look here https://processwire.com/blog/posts/new-module-configuration-options/#using-an-array-to-define-module-configuration you'll see that module configuration inputfields can be defined by an array. This is also possible for custom created forms, as it's mentioned to the end of the text.1 point
-
Hi guys, Been "kicking the tyres" on some UI tweaks to the PW image fields and modal windows. Many of these are in-progress designs and to be straight, none of the designs are entirely resolved. At this stage, I thought I'd throw them up (poor choice of words!) and maybe someone can take them further or offer some fresh eyes. I'm not a developer so making these a reality is impossible for me. They're flat designs. Why? PW is an amazing experience for editors. It's just so elegant and beautifully realised (especially with Reno Theme) that often, my training sessions with clients are very brief. One area which does cause friction though has always been concerned images, image fields and image modals. Especially with the latest image modules, I think a lot of inconsistency has crept into the UI. Hopefully these designs can help improve things a bit. A tiny part of the design work is influenced by a similar idea I had for MODX but which never progressed. 1A. Current Image Modal Editor has clicked 'Add image' icon in CK editor. Issues: I believe the Upload Image button can be better placed. It's not clear to users that they have a choice of two actions (Select an Image OR Upload one) To help solve this, I thought we could: Place available images under a Choose tab Create another tab titled Upload Rename modal to just Image (from Select Image) tweak slightly the Images on page path to be less prominent The following image illustrates the result. Clicking the Upload tab would result in: In the above image I've created toggle-able accordians for Drag and Drop and Manual upload. This follows closely the UI an editor is presented with when choosing Insert Link within CK Editor. IE Link to URL, Select Page and Select File and the extra Attributes tab. So overall, it's more consistent. 1B. Alternative to above - combined Select and Drag/Drop I thought it might be worth exploring what modal would look like with no tabs and a single UI for both Selecting an image and Drag/Dropping. 1C. The Image field I then moved onto looking at the Image field in PW. So currently it looks like this (below) for a simple image field called Image Gallery. So although the current Image field works great, I wondered if there was a way to simplify it by Making the drag/drop more visual and obvious Moving the Choose Files button and removing the No file chosen text and the file types allowed Here's the result. Admittedly, this treatment adds more height to the overall field. Here's how it looks when images are uploading (slightly smaller plus icon and "drag and drop..." text. To be honest, I can't recall what other changes I made there! And here's a proposed layout for when there are multiple images. This includes image titles grid layout mouse-over for edit and delete options/buttons 2. Cropping Next thing I looked at was cropping. Native cropping introduced recently is one of my clients favourite features and time-savers and I wondered if things could be improved a little. So heres the current layout (this may have changed further recently) And here's my proposal. Changes are: Width, height and X and Y fields are moved below the image Apply and Cancel placed bottom right of the image Save Crop should be titled Apply. I think that's less confusing as in some instances there are so many Save options Save and Replace should be greyed out further In addition to this, I thought it'd be neat if we had the free-form cropping function introduced by Ryan combined with some kind of list of pre-sets (displayed on right hand side). Forgive the croptions label (Crop + Options pun - I was tired!) The benfit of this I think is that Modules such as CoppableImage and native Crop would be unified in a single UI. Presets (on right) could be a few out-of-the-box presets which come natively. Croptions houses any crop ratios defined in image modules. if CopppableImage isn't installed, they just don't display.. That's it. I wish I'd more time to work on this but it's at the stage where it's ready for some initial thoughts. Hope you guys like.1 point
-
Hi, I'm using PW 2.16.8 and I have a different behaviour from previous versions when I import users as CSV file using "Import Pages from CSV" Ryan module. With older versions of PW (I don't know which one, but not so old), after succesfully import users as children of a page created by me, if I saved all this users pages from API, automatically they were moved under the proper admin->access->users page parent. Now this doesn't work and I tried to change the parent from API but seems that template "user" doesn't allow this. Do you have any advice to solve this problem? Thank you. P.S. In the attached file you can see a small key that appears after import, aside the page name, but I think this only due to the user template attached.1 point
-
i had a site that was experiencing that error, once i upgraded core and all modules, i have not had any further errors;1 point