Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/05/2014 in Posts

  1. I don't have a migration script, because I've implemented this before starting the project But should not be hard, I would do a command line script, bootstrap ProcessWire and then code something like this: <?php // Bootstrap Pw // Make function wireMove, function mostly copied from wireCopy function function wireMove($src, $dst) { if(substr($src, -1) != '/') $src .= '/'; if(substr($dst, -1) != '/') $dst .= '/'; $dir = opendir($src); if(!$dir) return false; if(!wireMkdir($dst, true)) return false; while(false !== ($file = readdir($dir))) { if($file == '.' || $file == '..') continue; rename($src . $file, $dst . $file); $chmodFile = wire('config')->chmodFile; if($chmodFile) @chmod($dst . $file, octdec($chmodFile)); } closedir($dir); return true; } // Start migration - Loop your pages // You could split by templates and use limit/start to get this done in multiple iterations. // Limit depends on your server memory $pages = wire('pages')->find('template=shibby,limit=2000'); foreach ($pages as $page) { $old_path = wire('config')->paths->files . $page->id . '/'; $new_path = PagefilesManager::makeCustomPath($page); if (wireMove($old_path, $new_path)) { @unlink($old_path); } } Please only use on a copy of your installation, there will for sure be bugs as I've written it in the browser. You will need to make some modifications, but maybe it helps you as a starting point. Cheers
    4 points
  2. Sorry, me again. This works too and may best option with page arrays where you have an id. if("{$a1->sort('id')}" == "{$a2->sort('id')}") echo "identical"; Sort them by id first and put into quotes to make them both a string, if string is same they were identical. To go further, you could extend the PageArray with a new method. This can be done with a simple hook. For example in your templates init: wire()->addHook("PageArray::compare", null, function($event){ $a1 = $event->object; $a2 = $event->arguments(0); $event->return = "{$a1->sort('id')}" == "{$a2->sort('id')}"; }); Then you can use it everywhere in your templates like this if($a1->compare($a2)) echo "identical"; If you the hook to an autoload module like the HelloWorld.module you could use this method throughout PW.
    3 points
  3. Hey diogo - thanks for the clipmenu link - that looks pretty cool - I might be able to retire jumpcut finally An alternative to unarchiver that you might find worth a look is keka (http://www.kekaosx.com/)
    2 points
  4. I have a feeling you are hitting up against mod_security here, because there is no logical reason why some markup in a field should cause that error, unless something was modifying the submission. mod_security can be pesky in that it doesn't like certain combinations of markup in POST vars, especially <script> tags. One thing you could try is converting the script portion to a Hanna code, though mod_security might still give you trouble... so you could trick it by using a PHP Hanna code that does something like this: echo "<"; echo "script"; echo "async src='...' charset='utf-8'></"; echo "script"; echo ">";
    2 points
  5. Joss, I have done the three tutorials that you have on the Wiki... Doing these tuts was so worthwhile. The quick experience of bouncing around Pages, Setup, Templates, Fields and their sub menus really establishes a working familiarity of PW in short order. I am quite impressed so far! The Ajax user experience with the Admin is very cool and clean. I guess "clean" is the main word that I would describe PW. I like "clean" in website design overall and I appreciate it in the CMS backend experience as well. Coming from MODx, my main CMS of choice, I see quite a lot of commonality, which I think is a good thing. Even though I am not a PHP guy I can see the direct advantage of using purer PHP syntax over the special sub language that MODx uses in its snippet TPL system. Overall what I like about the PW admin system versus the MODx Manager is that there is just less of it. The same goes for the project support forums. I was initially drawn to MODx because the weight of the forum was so much less and more direct than say Drupal and Joomla for example. Since then MODx has become more complex to navigate, due mainly to the Evo and Revo development branch split. This causes some frustration with tracking down issue searches as much of the search engine links are either outdated or irrelevant in a way. I think many new "clean" CMS platforms suffer from this issue: over time the signal to noise ratio becomes a problem. The sites I have built so far have been mostly basic. Brochure sites, sites with nicely presented web photo galleries, streamlined blog or news lists, sites with private areas for registered web users (one with a system that allows only registered web users to post from the front end), etc. MODx really does not have a really good ecommerce/ shopping cart solution. I have not built a shopping cart site yet, but I want to. One of the things I would like to do is offer custom sites to real estate agents that are looking for a more personal portal that relies less on the mothership MLS system. I know building real estate sites can be a major endeavor. One of the professional hats I wear is doing real estate photography. I used to also build custom sites for each house listing but these sites were built using static XHTML with no database or connection to private MLS components. The next step for me is to take an existing MODx site that I have built and recreate it locally using PW. This should be an interesting self assignment... Thanks again... Max
    2 points
  6. count(array_diff($array_1->explode('id'), $array_2->explode('id')))
    2 points
  7. Hi, Would anyone be interested in creating a custom fieldtype where images are uploaded to an Amazon S3 bucket instead of the /site/assets/ folder? Thanks
    1 point
  8. Currently datetime can only be used for dates which has unix timestamp 0 or above. I noticed this when tried to use datetime field as birthday-field. I guess this would be pretty easy fix to allow pre-1970 dates also? Using signed integer field on database and allow negative values to be saved.
    1 point
  9. Yes! A page field with multiple options, it's an PageArray. $pageArray->implode() is one utility to deal with it. Or just use on of the array methods you also see on cheatsheet. Others useful things are $page->pagefieldmulti->first()->title; Translates to: "currentPage->thepagefieldpagearray->thefirstinthearray->itstitle" Or in a foreach foreach($page->pagefieldmulti as $selected) echo $selected->title; Or to search and check for if a certain option is selected if($page->pagefieldmulti->has(1001)) echo "option page with ID 1001 is selected"; has($page) return true if the PageArray of the field contains the page you give it. $page->pagefieldmulti->has($someotherpage); Since the options of a page field are also pages, it may get clearer if you try to think of it as a array of pages. Many methods accepts various things like a string or object or int of an ID maybe even a path like "/some/path/to/a/page". Just play and experiment with it and see what works.
    1 point
  10. You can't actually get Windows 7 any more unless you buy OEM (technically voiding your license straight away). They stopped manufacturing retail discs late last year so expect Windows 8 to be the only option before long for Windows users. Not really surprising since Windows 9 is rumoured to be making an appearance late next year (note I used the word "rumoured" - I don't tend to trust many of these so-called news sites and their "reliable sources").
    1 point
  11. wire('ModuleName') is not a syntax that ProcessWire uses. You can just retrieve API variables from wire(), like pages, page, user, session, etc. To retrieve a module, you would use $modules->get('ModuleName'); It's true that some autoload modules might set their own API variables that can be accessed with wire(), but most don't. One example of an autoload module that does that is LanguageSupport.module, which sets a 'languages' API variable that can be accessed via wire('languages').
    1 point
  12. One more trick I learned: ctrl+f3 (or ctrl+fn+f3) to use the dock with the keyboard and the same with f2 for the top bar. I must say that Gnome is much more intuitive and faster to learn for keyboard freaks than macOS. I'm making an honest effort here, since this will be my production machine for a long time (hopefully), but I keep thinking that the Gnome team is doing a hell of a job in Gnome 3.
    1 point
  13. That's funny, I posted about manjaro linux 2 weeks before radek https://processwire.com/talk/topic/5736-export-profile/?view=findpost&p=56061 Anyway, in the mean time, I moved away from zorin, pclinuxos and manjaro linux. Always hunting for a linux distro that matches closer the ease, look and feel of xp and 7. Linux Mint Cinnamon "petra" distro. It's Ubuntu done better. Allows the much-needed level of personalization on the user interface. It has everything either out of the box or installable for the default user: email (web or client), skype, text, pdf, pictures, music, movies, etc. There's good money these months in either downgrading from 8 to 7 or upgrading xp to 7 or linux.
    1 point
  14. Works too (with WireArray/PageArray) the trick is to add the two arrays together, PW will remove dublicates. So you can compare count after "merging", if result is different they're not identical. $orig = clone($a1); if($a1->add($a2)->count == $orig->count) $is = "identical"; Edit: hmm, too soon. small correction, needs a clone to keep original array in memory
    1 point
  15. (let's make it even more awkward for apeisa ) Sevarf2, a very similar question was asked here https://processwire.com/talk/topic/5961-filesystem-limit-32000-reached/
    1 point
  16. Thanks guys! Here are some things that I found already: https://www.foundapp.com/ (wow! looks for files in the disk, gmail, evernote, dropbox, just name it...) http://evernote.com/skitch/ http://www.clipmenu.com/ (seems to be better than jumpcut) https://skyfonts.com/ http://lifehacker.com/182657/how-to-turn-mac-os-x-dashboard-off (great!! ) https://onedrive.live.com/about/en-us/download/ (srsly, the only from the "big ones" that lets you choose the folders to sync) http://wakaba.c3.cx/s/apps/unarchiver http://kapeli.com/dash (lots of documentation for languages) http://koala-app.com/ ( gui compiler for preprocessing languages) http://www.allvu.com/index.php/products/startninja.html (very important!!) http://gimp.lisanet.de/Website/Download.html (try to make "color to alpha" in photoshop ) http://www.ampps.com/ http://www.vagrantup.com/ Ok, enough! By the way, Atom is looking pretty nice
    1 point
  17. Thanks to Radek for the mention of Manjaro Linux - it has helped me greatly. One of my colleagues at work had managed to get CryptoLocker on to her Vista desktop machine, so it needed urgent and drastic action. I installed Manjaro XFCE Edition and was well impressed by everything about it. Given that her department only need web browsing, email and to be able to open pdfs and the occasional Word file, it can do all of that straight out of the box, in a very Windows-like interface. And it runs much quicker than Vista and isn't threatened by viruses/trojans/malware etc to the same degree. So long as she doesn't have any insurmountable problems over the coming week, I will probably migrate several Windows pcs to Manjaro this time next week.
    1 point
  18. // could be this. if(count(array_diff($array_1, $array_2)) === 0)) { echo "identical" } Others will come up with other clever ideas I think It don't need to sort(), edited the post don't take this as an example,
    1 point
  19. Cannot embed Form Builder on a secondary language page? If you are using Form Builder in an multi-language environment, using LanguageSupportPageNames, you’ll have to make sure that the page "Form Builder", which is created automatically for you (and not to be confused with the Form Builder settings), also has an active translated "name". See screenshot:
    1 point
  20. Here are my first couple of sites using PW, critique appreciated! Artists agency Photographer Thanks!
    1 point
  21. Now that, I could not tell you - I have no access to form builder code and have never seen the module outside of the video demo. It would make sense to include a file with this sort of thing wrapped into a function/hook so as to keep the code you're adding separate from the module, for updating/upgrading purposes. Can't sleep... Assuming you would like to add it as a hooked method you could do something simple like: // Attach the hook in the FormBuilder Class $this->pages->addHookAfter('save', $this, 'hookAfterPageSave'); //Define what you want to do after the page is saved function hookAfterPageSave($event) { // argument(0) is the current page on the save $event $anEditablePage = $event->arguments(0); // add the page to editable_pages field (if in FormBuilder Class) $this->user->editable_pages->add($anEditablePage); } This would do essentially the same thing but the FormBuilder class, (or whatever it may be called), would run this method on page save. Look here: http://processwire.com/api/hooks/ for details on how hooks work. Again, the code is coming out of my 3am brain: so no warranty that any of it works.
    1 point
  22. Great to hear you're making progress. The Page Edit Per User adds a new field to every users' page; it's name is editable_pages. This is a Page Field and behaves like any other so to add a value to it when the user creates a page with the form-builder you could do something like: // Get user that made the page $owner = $page->createdUser; // If this is the same user: (Should be on page creation, but anyway) if($user == $owner){ // Turn off outputting formatting for user's page $user->of(false); // Add this current page to the editable_pages field $user->editable_pages->add($page); // Don't forget to save the user's page $user->save(); // Turn output formatting back on $user->of(true); } Just remember that the page created by the using the form builder must have been saved before you can add it to the user's editable_pages field. For clarity purposes: Users in PW are Pages. So accessing the user's fields would be like any other page's field. I haven't used the module but I'm pretty sure you could dynamically add pages to this field with the API as shown in the pseudo-code. Keep at it, you'll get it. BTW: I saw this in the Modules Section: http://modules.processwire.com/modules/schedule-pages/ and thought you might be interested in checking it out, does pretty much what I was demonstrating a couple of posts up.
    1 point
  23. When the switch from Evo to Revo happened, lot's of folks were looking around. Revolutions backend was slow, there were numeral bugs and documentation was scarce. And there you had that new kid in town called ProcessWire with lots of similarities between them. (a reason why so many switched if you asked me) In my opinion ProcessWire is a better experience for the developer and the site editor. Then you're forced to use PHP, not some kind of `pet keeping` safety language. This insures you that learn the most used language of the web, knowledge what you can use everywhere, not only in the ProcessWire world.
    1 point
  24. I concur with letting a payment gateway handle the card processing, PCI compliance is a big deal and a lot of gateways have API's that are easy to implement. In your case, PayPal's API has the IPN (instant payment notification) messaging service that is free for merchant accounts. It sends POST data to the page you specify so you could just point to a page you've created in PW and handle account/page creation after a successful payment has been made. It's done like this: https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/ As far as making the deletion of pages automatic, you could try the LazyCron module : http://modules.processwire.com/modules/lazy-cron/ You can test against the creation of the page by using $page->created, it returns a Unix timestamp of the date/time the page was initially created. You can store the anticipated delete time by adding 24 hrs to the $page->created value // LazyCron function on template page function deletingThePage(HookEvent $e) { // Maybe have a checkbox field == 1 to indicate if payment was processed by Paypal // Find all pages with unpaid statuses $unpaidPages = $pages->find("paymentCheckbox=0"); // iterate the results foreach($unpaidPages as $k){ // When the page was created $timestamp = $k->created; // $timestamp + 1 day $deleteTime = strtotime('+1 day', $timestamp); // If the time to delete the page has been met or exceeded if($deleteTime <= time(){ // Delete the page $k->delete; } } } // Add a hook to the function. Check every hour wire()->addHook('LazyCron::everyHour', null, 'deletingThePage'); All pseudo-code - absolutely no promises that any of that works as I've never used the LazyCron module. From what you've listed as requirements, it sounds like you're almost there. Is the PW API the part giving you a hard time or the implementation of using payment gateway API's?
    1 point
  25. Well then, ensure that the Language Support - Fields Module is installed. Then, go to Setup -> Fields -> Body and change the type from Textarea to Textarea Language. That should make the field so you can edit it, but without TinyMCE working. I don't have the most experience with the Language Support stuff so maybe someone else can chime in.
    1 point
  26. Hi Guys.. Started cleaning up my Mac and thought I would have a look at MAMP and see if there was an update. Looks like there is a whole new version out! New price is 39 Euro. For most of us here, I suspect, the upgrade from Pro 2.x costs 19 Euro Just sharing... Cheers
    1 point
  27. Yes...an mp3 is just another filetype to the browser just like .pdf, .doc, .zip, .exe.....It just needs to be told what to do with it
    1 point
  28. Actually, you can do this on the dev branch. Lets assume that cities are children of countries and that is reflected in your page structure (i.e. /countries/france/paris/). Create your 2 page fields (country and city), and configure 'country' as a single page field with "parent" set to "/countries/". Next, for the "city" field configuration, use the "Custom selector to find selectable pages", present on the "input" tab. In that field, enter "parent=page.country". Save and try it out. This works with select, selectMultiple and asmSelect fields (and possibly others), though not yet with checkboxes, radios or PageListSelect.
    1 point
  29. Updated to support negative values in the timestamp, and committed. It had to do with validation rather than the DB field type. We're using a MySQL datetime field for storage, so that isn't bound to the limits of timestamps. We're using timestamps just on the PHP side for sortability, sanitization and abstraction from a defined date format.
    1 point
  30. Yep, that would be good solution. Other thing that people do is to have more deeper structure: /1/1001/image.jpg /1/1002/another_image.jpg ... /2/2001/filedump.zip /2/2002/image.gif ... /10/10201/file2.jpg /11/11390/fileX.zip ... /23/231021/file3.jpg ... /191/1912621/scalesforovermillionpages.jpg ... etc Changing file structure might be hard thing to do, but it would prevent scaling issues with pages where you host large amount of files and use pages as containers for them. Deeper folder structure combined with "folders created when first file uploaded" would be best solution, I think.
    1 point
  31. I think it makes sense for us to not keep around empty directories. I'm planning to make an update that will provide a config option to disable automatic directory creation, limiting the creation to when a file needs to go there. If all seems good after trying that out for awhile, we'll probably make it a default.
    1 point
  32. The profile page actually does use the user template, but it only lets the user edit the fields you designate. You can let them edit any fields you've added the user template. First add them to the user template. Then go to Modules > Process > User Profile, and check the boxes for the fields you want the user to be able to edit on the profile screen.
    1 point
×
×
  • Create New...