Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by woop

  1. The plugin's description links to this page, so I thought I should point out that there's an error in the code example above (MyHook instead of MyFunc). See: https://processwire.com/api/modules/lazy-cron/ for updated information.
  2. yes. I would use a page for each image. can you describe the workflow further? Not sure what parts you want automated. the image uploading? how many images do you want to upload? how often?
  3. Stripe seems like an interesting alternative to PayPal. Pete worked on a module some time ago: https://processwire.com/talk/topic/4363-stripe-arrives-to-continental-europe/
  4. Just thought I'd share my git hook (post-receive) that I've been successfully using for a few months now to update my beta site and production site via git (no more ftp!). Might help someone else. As you can see, I only have the "site" folder under version control. But now when I'm thinking about it, site/templates should probably be enough. #!/bin/bash while read oldrev newrev ref do if [[ $ref =~ .*/master$ ]]; then echo -e "Master ref received. \e[42mDeploying master branch to production site...\e[0m" WORKTREE=../site # define your work tree, where you want to push the files cd $WORKTREE # navigate to the work tree GITDIR=../mysite.git # in relation to the "cd" command above # update the working tree git --work-tree=./ --git-dir=$GITDIR checkout -f master git --work-tree=./ --git-dir=$GITDIR clean -fd master # return to git directory cd $GITDIR else echo -e "Ref $ref received. \e[104mDeploying $ref branch to beta site\e[0m" WORKTREE=../beta/site cd $WORKTREE GITDIR=../../mysite.git # in relation to the "cd" command above # update the working tree git --work-tree=./ --git-dir=$GITDIR checkout -f stage git --work-tree=./ --git-dir=$GITDIR clean -fd stage # return to git directory cd $GITDIR fi done
  5. Hi again! Here's my Disqus import script! Some fields doesn't work correctly, but the basic parsing and import works fine. Will update this post as my code improves. Feel free to chip in! EDIT: Updated code, which runs fine now. Just successfully imported +16000 comments <?php # Heavily inspired by: http://www.binarytides.com/disqus-comments-importer-script-in-php/ ini_set('max_execution_time', 0); // unlimited execution time, because of large amount of comments ini_set('memory_limit', '512M'); $file = 'disquscomments.xml'; $doc = new DOMDocument(); $doc->load($file); $thread_list = array(); $threads = $doc->getElementsByTagName('thread'); foreach($threads as $thread) { if (!isset($thread->getElementsByTagName('link')->item(0)->textContent)) continue; $comment = array(); $comment['thread_id'] = $thread->getAttribute('dsq:id'); $comment['url'] = $thread->getElementsByTagName('link')->item(0)->textContent; $path = parse_url($comment['url'], PHP_URL_PATH); $path = preg_replace("/(\/){2,}/", "/", $path); // remove multiple slashes $path = $sanitizer->url($path); if ($pages->get($path)->id){ $comment['page_id'] = $pages->get($path)->id; } $thread_list[$comment['thread_id']] = $comment; } $post_list = array(); $posts = $doc->getElementsByTagName('post'); foreach($posts as $post) { $comment = array(); $comment['comment_id'] = $post->getAttribute('dsq:id'); $comment['thread_id'] = $post->getElementsByTagName('thread')->item(0)->getAttribute('dsq:id'); $comment['comment'] = $post->getElementsByTagName('message')->item(0)->nodeValue; $comment['created_at'] = $post->getElementsByTagName('createdAt')->item(0)->nodeValue; $comment['email'] = $post->getElementsByTagName('author')->item(0)->getElementsByTagName('email')->item(0)->nodeValue; $comment['name'] = $post->getElementsByTagName('author')->item(0)->getElementsByTagName('name')->item(0)->nodeValue; if ($post->getElementsByTagName('parent')->item(0)) { $comment['d_parent_id'] = $post->getElementsByTagName('parent')->item(0)->getAttribute('dsq:id'); } if (isset($thread_list[$comment['thread_id']]) && isset($thread_list[$comment['thread_id']]['page_id'])){ $thread = $thread_list[$comment['thread_id']]; $comment['page_id'] = $thread['page_id']; // the corresponding PW page's ID $post_list[$comment['comment_id']] = $comment; // only accept pages with pageids } } $postsadded = 0; foreach($post_list as $post){ if ($pages->get("disqus_id={$post['comment_id']}")->id) continue; //ignore already imported $c = new Page(); $c->setOutputFormatting(false); $c->template = $templates->get("mycomment"); $c->username = $post['name']; $c->title = "temporary title"; $c->publish_date = $post['created_at']; $c->disqus_id = $post['comment_id']; $c->body = $post['comment']; // If there's a parent comment, use this as parent if (isset($post['d_parent_id']) && isset($post_list[$post['d_parent_id']])){ $disqusparentID = $post_list[$post['d_parent_id']]; $savedParent = $pages->get("disqus_id={$disqusparentID['comment_id']}"); // must find already created page if ($savedParent->id){ $c->parent = $savedParent; } else { $c->parent = $page; // dump it here } } elseif (isset($post['page_id'])){ $c->parent = $post['page_id']; // root comment } else { continue; } $c->save(); $c->name = $c->id; $c->title = $c->id; $c->save(); $postsadded++; } echo "<br>#######STATS#########<br>"; echo "added +{$postsadded} comments<br>"; echo "total of threads in disquscomments.xml: ".$threads->length."<br>"; echo "total of posts in disquscomments.xml: ".$posts->length."<br>"; echo "total of posts imported: ".count($pages->find('template=mycomment'));
  6. I basically wrote my own comments system using regular pages. Works great and gives me full control of the content. The new Lister Pro is a great way to moderate them, too. Probably less lightweight than using the comments module, but I like to keep things consistent. I simply set the article as the parent page, and then sub-threads as children of other comments for that article. Makes it easy to manage using the admin. I'm currently writing a import script to get all my content from Disqus into this system, which is pretty straightforward thanks to the API.
  7. We recently had a lengthy discussion regarding issues like this. Ryan has provided an alternative profile/theme that makes it much easier to get things running. This might be included in future versions of PW, by default. See: https://processwire.com/talk/topic/7565-making-pw-more-userfriendly/?p=74425
  8. I think Ryan solved it nicely by adding underscore to the included files. It makes it easier to get an overview of your files when template files and head includes doesn't look the same in the file browser.
  9. it would be nice to have this module in the default profile, like you said. But if that goes against the philosophy of PW, maybe we could fit some of those messages into a small unobtrusive (?) icon instead?
  10. I think the rewrote looks really good. like diogo pointed out, experienced PHP devs will probably see the possibilities PW brings and use their own strategy. having the "direct output" as the default profile and then adding the "delayed output" version as an alternative seems like a great compromise (if you're ok with maintaining both).
  11. so good! I think the URL logic makes sense. here's some feedback during my brief testing on the lightning.pw site: I think the title with the info icon should stick stay even after you click it. Compare to Templates -> Filters, which can be expanded in a similar way. It feels more consistent to have it work the same. Maybe lose the punctation mark in each title, since PW adds "..." anyway External and internal links looks the same. It's hard to know where you'll end up when you click them. Not a major issue but maybe we could differentiate external links (to processwire.com, youtube etc) with a small icon. Or the have the titles say "Learn more on Processwire.com" etc. not sure. The "uninstall" button in the bottom right of each box feels redundant and maybe a bit repetitive? perhaps the info on the first screen is enough? Experienced users (that doesn't need the help) will probably know how to uninstall it anyway.
  12. Ryan, great work as always! I know the character in my PDF was a bit over the top but I don't think it's unlikely to think that people who've outgrown drupal/wordpress would have a similar experiences when first trying Processwire 2.5. The simplicity of PW's API combined with PW 2.2's "direct output" strategy is what tipped me over. It was so easy to get started I felt it was worth the effort trying to rebuild a better version of my site from scratch using PW. Haven't looked back since. The delayed output method is, in my honest opinion, a step backwards. It may be less scalable then the direct output method but coming from Drupal where it's common to put PHP snippets in the admin – it's a huge improvement and extremely intuitive. However, the new READ ME you just added will make this less of a problem Cheers!
  13. The learning curve would be even lower if there was no need for documentation for simple tasks at all. In my opinion any CMS should aim for such high usability standards that creating a simple site with pages, news/blog, forms, and gallery, based on a default install should be possible without having to learn anything that is beyond general content creation standards. Usability is not the same thing as a 1-click install. You will (and should) need to code your own gallery in PW. That's the whole point of PW and what makes it flexible. Processwire needs to get better at aiding you in the process of learning how to do this, though. That is what a user friendly CMS is about in my opinion: making it easy to do core content creation without having to study. Agreed. You should be able to create a template, add fields, attach a page and visit that page (with correct output rendered) without having to read through any documentation. However, it's not achieved using modules. It's achieved using helpful code examples and a well structured default theme (amongst other things previously mentioned)
  14. @joss Wordpress is no longer aimed towards "casual bloggers". It's used to power millions of sites ranging from personal blogs to full blown websites. It's chosen by developers and businesses around the world because of it's (perceived) ease of use and its large share of the market which results in better support. Processwire isn't truly "agnostic". You still have rules and boundaries which shapes the way you work. In Processwire, it's pages, templates and fields. In Drupal it's nodes, taxonomies, blocks and views. These tools has to be introduced in some way. External documentation should always be the last resort. It takes you away from the moment and makes you lose context. I think ProcessWire has the potential to be one of those CMS that "just makes sense" from the start. Just adding a small intro text when you first install it, like you suggest, would be a huge leap in the right direction. Coding isn't something unique to PW. The people who show interest in PW has probably already coded in another CMS by modifying a module/plugin or adding a bit of PHP to a view in Drupal. This has probably been a horrible experience and we need to make sure people understand how coding in PW is not the same thing as trying to hack a module someone else wrote. You'll get results faster in Wordpress, but then you have to tweak it in order to get it right. In PW, getting that initial result will take you some time but then it will turn out exactly like you wanted (and the underlying code makes sense, since you wrote it). I think the key to success is to make that initial learning curve as painless as possible.
  15. The walkthrough module is great. We just have to make sure we also answer the basic questions like "What is a field", "What is a template" and "What is a page". Creating a field is already very easy to do (it's just a basic form). The question is, why do you do it and how does it relate to a template and its pages? We've already covered this thousands of times in tutorials, video walkthroughs, faqs and forum posts – but we don't explain it in the actual user interface. couldn't get the module to work 100%, but I imagine the guided tour to be something like this Create new text field -> Create new template -> Add the same field you created in the first step, to your new template -> Create a page based on this template -> Point the user to the template file and describe how to add the field to the output of that template -> Visit the final page -> Recap all the steps in text and point to relevant documentation for further reading.
  16. Cool! I rewrote the default theme to use the old theme structure with head and foot includes instead of inits and main. I think this makes the setup more transparent and easier to follow for new users. I also added a lot more comments to explain what is going on. Here's an example from the sitemap.php file. Before: <?php // sitemap.php template file // Generate navigation that descends up to 4 levels into the tree. // See the _func.php for the renderNav() function definition. $content = renderNav($homepage, 4); After: <?php /* This is a template file. Pages based on the sitemap template will render using the code below. ProcessWire provides variables to every template. The variables makes it easy to find content, submit data and more. The most frequently used variables are $page and $pages. $page holds info about the current page and $pages is where you'll find all the other pages in your site. You can read more about ProcessWire's variables here: https://processwire.com/api/variables/ */ include_once("includes/head.php"); // Import the global html header include_once("includes/functions.php"); // Import custom functions from another document $homepage = $pages->get("/"); // Use the $pages variable to fetch the homepage echo $page->summary; // Echo the current page's summary field echo renderNav($homepage, 4); // Call our function from functions.php to render a sitemap include_once("includes/foot.php"); // Import the global html footer What do you think? Too much?
  17. Congratulations! I'll use this a lot when testing new ideas. A great tool for the PW community!
  18. Thanks for the feedback, everyone! I'm glad you like it. @Philipp thanks. Great summary. I very much agree with you in everything you said. Site profiles can be good, but we have to know where to draw the line. It's harder to keep everything consistent and maintainable when the user's installations can differ so much. @hdesigns Yes, it's a bit harsh. I'm sure the majority will have absolutely no problem getting through the installation. I'm just trying to identify the potential problems one might run into. Every problem, even the small ones, will add up and affect the overall experience and willingness in learning a completely new system. I don't think we need a .pdf that explains how to deal with the questions I bring up. These should be answered directly in the admin ui, the theme's structure, the preloaded content and the comments in the .php files. I rather help designing/writing these views than adding yet another source of documentation, to be honest. @steveB you are absolutely right regarding the seductive sale style. I'm an interaction designer for commercial products in my day to day job, which of course influences my analysis here. However, the "seductive" style is applied to keep people's interest through the boring parts of the process. It's about finding the lows and compensating by giving something back or reminding the user why they're here in the first place. It's generally very effective and often good for both parts (unless we stop being informative, as you pointed out). You're also right about the version control aspect of the read me file. Very good point, which of course applies to the more advanced users. I tried to write my .pdf through the perspective of a novice user. One that knows a bit of html/css/js and maybe have some experience with other cms's. Git and version control usually comes later. Again, I think Philipp's post is a very good summary of how to move forward addressing these issues.
  19. Interesting discussion! I definitely think Processwire could improve its usability but I don't think plugins is the way to do it. I just did a clean install of PW 2.5 and documented each step in the process. Here's a .pdf with 44 slides that covers the scenario of a new user's first contact with PW: http://cl.ly/0e3V2M3w1z1B ​comments appreciated
  20. Thanks for the clarification, Teppo! Could you elaborate a bit more on option 1. Not sure I understand how to go about.
  21. Thanks for the tip – I'll check that out later. The thing I'm finding most confusing is the way a comment is created. It seems like it's not an ordinary page/template, which means that I can't add new fields to it in the admin. I bet there's a good reason for this but it felt a bit un-processwirey to not being able to simply extend a comment template. I guess I'll have to hack the comment class instead, like described here: https://processwire.com/talk/topic/2092-additional-input-field-for-url-in-comment-form/ ?
  22. Thanks! I don't have the time to finish this right now (going on vacation). I did manage to put together a basic parser in case anyone else is interested. Feel free to continue from here. I'll put together a full migration script when I find more time $disquscomments = simplexml_load_file('disquscomments.xml'); # All threads foreach ($disquscomments->thread as $t){ echo $t->attributes("http://disqus.com/disqus-internals")['id']; echo $t->forum; echo $t->category->attributes("http://disqus.com/disqus-internals")['id']; echo $t->link; echo $t->title; echo $t->message; echo $t->createdAt; echo $t->author->email; echo $t->author->name; echo $t->author->isAnonymous; echo $t->author->username; echo $t->ipAdress; echo $t->isClosed; echo $t->isDeleted; echo "<hr>"; } # All comments foreach ($disquscomments->post as $c){ echo $c->attributes("http://disqus.com/disqus-internals")['id']; echo $c->id; echo $c->message; echo $c->createdAt; echo $c->isDeleted; echo $c->isSpam; echo $c->author->email; echo $c->author->name; echo $c->author->isAnonymous; echo $c->author->username; echo $c->ipAdress; echo $c->thread->attributes("http://disqus.com/disqus-internals")["id"]; echo $c->parent->attributes("http://disqus.com/disqus-internals")["id"]; echo "<hr>"; }
  23. Hi! Has anyone had success with importing comments from Disqus to Processwire? I'm thinking about migrating my disqus content since I need more control over form and logic. I get a large .xml export from Disqus but I'm not sure how to get this into Processwire. Seems like comments aren't available as pages, so I can't use to CSV to Pages plugin. Here's an excerpt from the export: <thread dsq:id="12312312312"> <id /> <forum>my-disqus-forum</forum> <category dsq:id="123123" /> <link>http://example.com/article/231</link> <title>Article title</title> <message /> <createdAt>2006-11-29T23:38:43Z</createdAt> <author> <email>john@doe.com</email> <name>John</name> <isAnonymous>false</isAnonymous> <username>Johnnyboy</username> </author> <ipAddress></ipAddress> <isClosed>false</isClosed> <isDeleted>false</isDeleted> </thread> Thanks for helping out!
  24. give mqdefault a try. doesn't get letterboxed for me
  25. Sure - but for these users it would be nice to still be able to use some kind of fingerprinting. Eg. solely relying on User Agent or in a combination with some other value. Would be better than nothing?
  • Create New...