Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/30/2016 in all areas

  1. Great to hear! I've created an issue and suggested the fix.
    6 points
  2. Speed improvements with subselectors are amazing. Our setup went from timeout into pretty much instant when there were about 10 000 pages in both main and sub selectors.
    6 points
  3. This week we’ve got some great new optimized methods added to the $pages API variable, plus full link abstraction now built-in, new sub-selector upgrades, and more! http://processwire.com/blog/posts/processwire-3.0.6-brings-pages-upgrades-and-link-abstraction/
    5 points
  4. It shouldn't be hard to get the whole banner rotation thing up using PW's on-board functionalty. The only additional module necessary would be AdminCustomPages to view statistics. Here's how I'd do it: Create a bunch of templates for category and banner as well as categories and banners templates to group them together. The category template gets a view counter which we increment with every view of a banner through the category, and we'll use that counter to pick the next banner. The banner template gets a field for the category it belongs to, one for the URL to redirect to and, of course, the image field, optionally with size settings in the field configuration. Our "normal" templates get another page field in which we pick the banner category. We also add a "click" template to store each banner click with the remote IP. Thus we have the following templates with fields: banner_categories title field onlyWe create a banner categories page somewhere (it doesn't really matter where, can be under home). banner_category title (for the category selections) banner_cat_count (our counter) banners title field onlyLet's create one of these under home too. banner title (just for us) banner_image (image field, set to single image, size constraints in the field's config) banner_url (fieldtype URL, the address to redirect on click) banner_category (page field, single select, parent set to banner_categories page) click click_ip (text field)Our pages that should include banners get a new page field (single page, NullPage if empty) page_banner_category. Now we need two PHP templates: one to render the banner inside the page (let's name it "_banner_include.php") and one that does the counting and redirecting if a banner is clicked ("banner.php"). In banner.php, we simply add a click counter page under the banner page itself, then redirect to the configured URL: <?php $click = new Page(); $click->template = wire('templates')->get('click'); $click->name = 'click-' . time(); $click->parent = $page; $click->click_ip = $_SERVER["REMOTE_ADDR"]; $click->save(); $session->redirect($page->banner_url); In _banner_include.php, we increment the view counter for the category (we could also add a counter field to the banner template and increment it on the banner page), then use the counter value modulo the number of banners in the category to get the banner itself: <?php $banner = next_banner($page->page_banner_category); function next_banner($category) { global $pages; $banners = wire('pages')->find("template=banner, banner_category={$category}, include=hidden"); if( $banners->getTotal() == 0 ) return new NullPage(); $category->of(false); $category->banner_cat_count += 1; $category->save(); $category->of(true); return $banners->eq($category->banner_cat_count % $banners->getTotal()); } if( ! $banner instanceof NullPage ) { ?> <div class="banner"> <a href="<?= $banner->url ?>"><img src="<?= $banner->banner_image->url ?>"></a> </div> <?php } Now all we need in our regular pages' templates to render the banner: <?= $page->render("_banner_include.php"); ?> Getting an overview in the backend using AdminCustomPages should be quite easy too by just creating a custom page including a scipt that iterates over all the categories, reads the click counter, then iterates over each banner and counts the children (optionally limited by the timespan). A quick-and-dirty script (untested) to illustrate that: <?php foreach( wire('pages')->find("template=banner-category") as $cat ) { echo "<h1>{$cat->title}</h1>"; echo "<table><thead><tr><th>Banner</th><th>clicks</th></tr></thead>\n<tbody>\n"; foreach( wire('pages')->find("template=banner, banner_category={$cat}, sort=title") as $banner ) { $clicks = $banner->children->count(); echo "<tr><td>{$banner->title}</td><td>{$clicks}</td></tr>\n"; } echo "<tr><td colspan=2>{$cat->banner_cat_count} Views / {$clicks} clicks</td></tr>\n"; echo "</tbody>\n</table>\n"; } We could, of course, make things a little easier by grouping the banners under their category, and there's nothing major speaking against it. I used a different parent for the banners to have them all under the same URL, i.e. /banners/banner-name. All in all, it shouldn't take more than an hour to get things up and running this way.
    5 points
  5. SQL query changed from joins into using IN and NOT IN syntax.
    4 points
  6. I just added an "Upgrade Cleanup" option. Now you can easily cleanup all of the backups from the ProcessWire Upgrade module. It lets you review all the folders/files tagged for deletion and then deletes all with one click. It covers core wire folders, .htaccess and index.php backups, as well as all site module backups. I am also hoping to do some thorough testing of the entire module and get it ready for release fairly soon - is anyone out there using it regularly? Any comments/suggestions/issues? PS If you're not already using the PW Upgrade module be sure to make it one of your defaults to install on every site - it handles PW core and 3rd party site modules.
    3 points
  7. Does it work if you change line 412 in core/WireFileTools.php from this: } else if($options['defaultPath'] && strpos($filename, '/') !== 0) { to this: } else if($options['defaultPath'] && strpos($filename, '/') !== 0 && strpos($filename, ':') !== 1) { ? /edit/ This is addressed at pwired.
    3 points
  8. JqueryFileUpload This module is a ProcessWire implementation of the awesome Blueimp jQuery File Upload plugin. Server-side, the module provides a custom uploads' handler enabling you to perform various tasks with ease. The module is an interface of the feature-rich Ajax File Uploads widget provided by the jQuery File Upload plugin. The module is completely customisable and can be used both in the front- and backend (e.g. in a third-party module). Please read the README carefully and completely before using the module Release Status: Stable. Module Download: http://modules.processwire.com/modules/jquery-file-upload/ Issues tracker Project page: GitHub Security The module has been written with security in mind and makes no assumptions about any client-side validation. Instead, the module provides robust server-side validation of uploaded files. Server-side, no Ajax requests are honoured unless specifically set via configurable options server-side. This means that client-side requests to upload, delete and list files are not executed unless allowed server-side. By default, files are uploaded to a non-web-accessible (system) folder and files previously uploaded on the server are not sent back for display unless that setting is enabled. However, developers are still strongly advised to implement any other feasible measures to guard against malicious uploads, especially if allowing frontend uploading. For instance, developers can use native ProcessWire checks to limit access to the widget (e.g. only allowing uploads by registered/logged-in users). Demo A short video demo can be found here (and below )(CSS is WIP! ). In the backend, you can see it in action within the (upcoming) module Media Manager Features Fast Ajax uploads. Client and server-side validation. Client-side image resizing (highly configurable options). Beautiful touch-responsive image gallery preview. Audio and video previews pre-upload. Chunked and resumable file uploads (currently client-side only; server-side handling planned). Drag and drop support. Copy and paste support (Google Chrome only). Progress bars. Cross-domain uploads. Single or multiple uploads. Delete uploaded files. Documentation On GitHub. Have a look at the long list of available options. License Released under the MIT license @Credits: Sebastian Tschan @Thanks: Pete and BernhardB for the idea. Please test and provide feedback. Thanks!
    2 points
  9. There is no placeholder in your sprintf function, add %s. Also, the URL won't be clickable in this way. Plus you should use httpUrl instead to have an absolute URL in the email.
    2 points
  10. Thank you Ryan! You are churning out the awesomeness at an astounding rate. Thanks to Antti/Avoine for suggesting the nested sub-selector improvements, I'm looking forward to refactoring a few clunky queries once I can officially move to PW 3.
    2 points
  11. Update: Version 0.1.4 As per @cJonathan Lahijani suggestion, in ProcessMenuBuilder, I have moved the first tab 'Main' to become the third tab and renamed it to 'Settings'. I think it looks much nicer now, thanks @Jonathan. This is in dev branch only for now.
    1 point
  12. Hi, i'm asking myself, if it's possible to have an editor, who's usable for people without markdown knowlege, but saves the WYSIWYG stuff in markdown format. For instance one marks the text "Lorem Ipsum", chooses H2 in a dropdown and the text is displayed for him as H2, but the sourcecode in the background is ##Lorem Ipsum , which gets saved and outputed per markdown module. i fiddled a around with the markdown input formating and CKEditor as Input, until i learned that markdown will only format the output someone already tryed to do so?
    1 point
  13. OK, a bit OT.... I was finding it increasingly annoying writing README's for my modules in Markdown. It takes way too much time. I needed something that could convert HTML to markdown, the idea being to write in RTE, copy the source HTML and convert that to markdown. I briefly toyed with the idea of writing a personal module for this, then I found this thread which lead me to other things via Google. And now I've found it, a MS Word plugin for markdown, yeah!! Yes, I am not a fan of markdown and yes I like Word! ...a lot. Now I can type my README's and see the visual richness at the same time as I spell check, yeah! Writage (a Markdown plugin for MS Word. It uses Pandoc behind the scenes) Pandoc (brilliant universal converter) Other interesting stuff HTML To Markdown for PHP to-markdown </end OT>
    1 point
  14. I can confirm the same setup is very easy to count clicks + views...i need that for a project. Working good so far. Only difference is that i simple count clicks and views in a integer field without additional information - so it is "data economical" and i've no problem with saved IP's and so on... For manging the banner i use a PageTableExtended Field: I've a general settings about the amounth of ad slots on that page - and a flag option on every single page where a user can set ads to off for a single page. /** * Adsystem show Ads in several templates * * @var $limit (Int) set the limit of displayed ads ->look at anzeige_anzahl /settings/werbeanzeigen/ * @var $headline (string)set the headline of the ad list */ function renderAdsystem($headline = 'Anzeigenpartner') { //get all ad pages on basic setting - unpublished pages are not listed.... $limit = wire('pages')->get('1056')->anzeige_anzahl; //build add output $anzeigen = wire('pages')->find("template=part_ad, limit={$limit}, sort=random"); //render ads and collect them in $all_ads $all_ads = '<h4 class="subtitle">'.$headline.'<h4>'; foreach ($anzeigen as $anzeige) { $anzeige->of(false); $anzeige->anzeige_views += 1; $anzeige->save(array("quiet" => true, "uncacheAll" => false)); $anzeige->of(true); //get the right imagesize $anzeige_bild = $anzeige->anzeige_bild->size(260,120); //build ad link $all_ads .= '<a href="'.$anzeige->url.'" alt="'.$anzeige->title.'"><img class="anzeigen" src="'.$anzeige_bild->url.'" alt="'.$anzeige->title.'"></a>'; } //check if adds are off if ($limit == 0) { $out = ''; } else { $out = $all_ads; } return $out; } All is a page - so the adlink is a page for shure - and for pages we can count clicks == pageviews + redirect and views for every rendering that pageitem somewhere. Just as an addition to the great example from BitPoet! Thanks for that - so i'm tranquilised to find a way that a professional find, too - so it couldn't be that wrong Best regards mr-fan
    1 point
  15. Hi Nico If you use ProCache with your module and have your module handling Google Analytics insertion, the GA code is stripped out by ProCache when you tell ProCache to minify the HTML output. Any idea why this happens? I tweaked ProCache not to minify inline JS and it still seems to strip it out, so it's almost like your module is altering the markup and then ProCache is also altering the original markup and overriding your altered markup I think it's going to be something to do with the order they run in maybe, but not sure. Thought you'd be interested anyway!
    1 point
  16. @pwired Your issues seem different than Juergen's. In your case it might be a problem with the FileCompiler, which is new in PW3, looking for or trying to create certain files in site/assets/cache/FileCompiler/ It could be that the upgrade process from 2.X to 3.X does not take this into consideration.
    1 point
  17. It's matching a lot of stuff, WireArray::getItemThatMatches does need a lot of time and Wire::__get is called damn often, but these are all things to be expected. Also not every page is using all things which potentially could be slow.
    1 point
  18. I can confirm this. I've set up a new dev box over the last few days and included blackfire from the beginning and it just works so nicely. I've yet to figure out if the "debugging features" do also allow for steping through the code, but even the performance analysis is so much worth.
    1 point
  19. Sorry for raising this from the dead, but I've recently used it and it's absolutely marvelous. It will stay put on production servers unless you call it explicitly through the browser plugin, and it will profile anything you throw at it, PW, WP, frameworks, etc. Compared to xdebug, it's litterally miles ahead in my opinion. This is a must have.
    1 point
  20. I noticed that uikit is becoming popular lately. Even Ryan is fond of it. As far as I have played with it, I find it worth to invest time in. http://getuikit.com/ For small projects I always use pocketgrid. Here you find more in the forum: https://processwire.com/talk/topic/3791-things-to-read-about-css-frameworks/page-2 https://processwire.com/talk/topic/1576-css-template-framework/ https://processwire.com/docs/tutorials/installing-a-css-framework/ https://processwire.com/talk/topic/4572-pure-a-set-of-small-responsive-css-modules-that-you-can-use-in-every-web-project/
    1 point
  21. I am always used to plan something ahead in Chrome. If I want to add something, I just write the HTML markup with the correct id or class in the file, and in Chrome I start fiddling with the CSS directly. I will have to check the developer mode completely. For the IDE, I'm very happy editing with Emacs.
    1 point
  22. There is a lot of places this have been discussed in the forums. If you want to know what others are using you can check something like: https://processwire.com/talk/topic/1576-css-template-framework/ https://processwire.com/talk/topic/5948-dead-simple-grid/ ...or about anything here. On that materialize thing... Can't tell for sure, but it looks quite similar to bootstrap and is probably some kind of derivative. If use Sass anyway, I prefer Susy 2 as it is almost completely customiable.
    1 point
  23. If you are going to shamelessly self-promote, you should at least provide a link to Media Manager: https://processwire.com/talk/topic/11224-media-manager/
    1 point
  24. My excuse is that I needed it for Media Manager
    1 point
  25. out for this. Isn't there another way to upvote for processwire without spreading my private data around ? i alsos donut like.to spread my.privates a round withs tweetster u.can jus make throws away acct to uses.for this stuffs butt fecesbook tweetster and friendsters blocked in.my cuntry butt i stil haves myspaces butt no work w produt hunter butt at lest not blocked .i keep try to make work
    1 point
  26. I've toyed around with a number of options to achieve that for my ongoing pw-based forum project too, but I didn't get anywhere. So I've settled on including MarkItUp as message editor in the frontend and added a preview button that retrieves the formatted HTML for the markdown through ajax and displays it in a lightbox. I guess this might be a feasible approach for you too.
    1 point
  27. Kongodo summed it up well. I would suggest gathering your data from the outside world into conventional database table(s) outside of PW. Set them up so they are easy for you to fill and check over. Then write a module based on Ryan Cramer's module for importing from CSV files. Make it read from your table(s) instead of a file. You can put all your code for massaging the content right in the module. With liberal use of the UI modules have for settings you can use the same tool to make various kinds of pages from input data. Working with an external database can be pretty simple: protected function externalDbConnect(){ $this->extDb = new mysqli('localhost', 'xxxx', 'yyyy', 'zzzz'); } protected function queryCount($qry){ $result = $this->extDb->query($qry); return $result->num_rows; } protected function queryForFields($table){ $a = array(); $result = $this->extDb->query('SHOW COLUMNS FROM '.$table); while($row = $result->fetch_array(MYSQLI_ASSOC)) $a[] = $row['Field']; return $a; }
    1 point
  28. for shure: // mysqli will be depricated, so use PDO if you start with it $sql = "awesome query"; // $database variable is available in your templates. $database is the PDO way. $query = $database->prepare($sql); $query->execute(); Oké, stupid me: Welcome to ProcessWire greentea
    1 point
×
×
  • Create New...