Jump to content

Leaderboard

Popular Content

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

  1. Hello everyone, i just registered on the pw site, and wanna say im really impressed with processwire, it's an amazing piece of software. Thank for making it! I'm a web designer/front end developer and processwire can easily become my first cms of choise for all my projects. Also have to say, this registration process on the site was so frustrating, and reason is the "security question". I was trying and trying and trying, and getting the same error (invalid question answer or so...). Question are like: "Processwire has modules like ProCache and FormBuilder. Type in one of them." Its clear that one have to write ProCache or FormBuilder , but its not stated that it should be all lowercase, so its confusing and causing errors, i had like 20 before i figured, or its just that im a bit "slow".
    5 points
  2. Hi and welcome @lokomotivan. Regarding the security question in the register process of the IP.board software, I will point our forums admin to that. I'm not aware that these questions are belong to the registration process, maybe this was sometimes added after I have registered here. But one thing is sure, I personally would have entered it also in the correct spelling multiple times!
    3 points
  3. Set a different session name for every PW instance. From config.php: /** * Session name * * Default session name as used in session cookie. You may wish to change this if running * multiple ProcessWire installations on the same server. By giving each installation a unique * session name, you can stay logged into multiple installations at once. * * #notes Note that changing this will automatically logout any current sessions. * @var string * */ $config->sessionName = 'wire';
    3 points
  4. 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
  5. Just bumping this thread - I have updated the title and first post to now refer to PW 3.0. It would be great to start seeing the modules directory full of modules tagged as compatible with 3.0 before it is declared stable and released. Hopefully 3.x will attract a new round of developers looking to see what PW is all about - we don't want it to look like our modules aren't being updated. Even though we all know that in most cases older modules still work in newer versions of PW - this is often not the case with other CMS's.
    2 points
  6. 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
    2 points
  7. I have mentioned Lost Grid before. Recently Cory Simmons transferred the project to Peter Ramsing: https://github.com/peterramsing/lost From the roadmap: Looks like Cory can't stop creating new grids, though https://github.com/posthumans/postcss-ant-grid
    2 points
  8. 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.
    2 points
  9. This is a simple module to prevent guest users and search engines from accessing to your site. Primarily it is designed for use during site development. Modules directory: http://modules.processwire.com/modules/protected-mode/ Github: https://github.com/adrianbj/ProtectedMode Install and check the "Protected Mode" checkbox Create a user with only the guest role and give the login details to your clients/testers. Of course existing admin users can use their personal logins still. There are some similarities with Pete's excellent Maintenance Mode module, but the reason I built this, rather than using Maintenance Mode is: I didn't want the "Maintenance Mode" badge showing up on the site since this is for development before a site has ever been live and I didn't want the client seeing that badge. I didn't want users redirected to the PW login page because I didn't want visitors to see the PW login page. I know the module has the option to redirect to a custom page, which you could use to make a front-end login form, but that seemed more complex than I needed (and I think other PW devs might also need). Because of the way this module replaces Page::render with the login form, visitors can be sent to any page on the site, and once they login that page will reload with its full content - no messing around finding the page again, and no need for sending page ids through the login process to redirect back. This module also lets you configure the message that is displayed along with the login form, and also apply some css to style the login form. Hope you guys find it useful.
    1 point
  10. You can detect whether the current page was loaded from ajax by checking the value of $config->ajax from your template file: <?php if($config->ajax) { // page was requested from ajax } Following that, you will likely want to render the page differently to accommodate whatever you are doing from the javascript side. For instance, you might want do one of these: 1. Deliver alternate or reduced markup when loaded from ajax 2. Deliver a JSON or XML string for parsing from javascript Below are examples of each of these scenarios. 1. Deliver alternate or reduced markup when loaded from ajax You might find checking for ajax helpful when you want portions of pages to load in your site without re-rendering the entire page for each request. As a simple example, we'll use the default ProcessWire site and make it repopulate it's #bodycopy area when you click a page in the top navigation. (To use this example, you'll need the default ProcessWire site templates, though you can easily adapt the example to another situation.) To accomplish this, we'll update our main page template to only include the header and footer markup if the page is NOT being loaded from ajax: /site/templates/page.php <?php if(!$config->ajax) include("./head.inc"); echo $page->body; if(!$config->ajax) include("./foot.inc"); Next we'll update the top navigation to do ajax loads of the pages when the client has javascript (and leave as-is when they don't). Paste this javascript snippet before the closing </head> tag in the header markup file: /site/templates/head.inc: <script type="text/javascript"> $(document).ready(function() { $("#topnav a").click(function() { $("#topnav a.on").removeClass('on'); // unhighlight selected nav item... $(this).addClass('on'); // ...and highlight new nav item $("#bodycopy").html("<p>Loading...</p>"); $.get($(this).attr('href'), function(data) { $("#bodycopy").html(data); }); return false; }); }); </script> Now when you click on any page in the top navigation, it pops into the bodycopy area without a page load visible from your browser. And all pages remain accessible from their URL as well. Note that this is just a test scenario, and I probably wouldn't use this approach for the entire bodycopy area on a production site (it would make bookmarking difficult). But this approach can be very useful in the right places. 2. Deliver a JSON or XML string for parsing from javascript Lets say that you want pages in your site to return a JSON string with the page's id, title, and number of children when it is requested from ajax. When not requested from ajax, they will return their content as normal. To handle the ajax requests, you'd want to add something like this at the top of your template file before any other output. <?php if($config->ajax) { // this is an ajax request, return basic page information in a JSON string $json = array( 'id' => $page->id, 'title' => $page->title, 'numChildren' => $page->numChildren ); echo json_encode($json); return; } // not ajax, continue with regular page output And here is some markup and inline javascript you might use to test the ajax call on some other page (or the same one if you prefer). You would paste this snippet right in your site's markup where you want that info to appear. <ul id='info'></ul> <script type='text/javascript'> var url = '/'; // this is homepage, so replace '/' with page URL you want to load JSON from $(document).ready(function() { $.getJSON(url, function(data) { $.each(data, function(key, value) { $("#info").append("<li>" + key + ": " + value + "</li>"); }); }); }); </script> The above snippet would output something like this: • id: 1 • title: Home • numChildren: 5 To take this example further, you could build an ajax-driven sitemap or any number of web services. Conclusion Hope this helps you to see how simple it is to use ProcessWire to deliver output for ajax. These are just contrived examples, but hopefully examples that might lead to more ideas. In addition, much of what you see in these examples is also applicable to building web services in ProcessWire.
    1 point
  11. ALIF - Admin Links In Frontend EDIT: latest version update with PHP 8 fixes on 05. Nov 2023 (!) The version now is 1.1.9 (!) This module combines some of the admin links that we want to use on the frontpages sometimes. It is a comfortable and easy way to do so. After you have installed and configured the module, you can inject the links into the frontpage with code like this in a template file: echo $modules->isInstalled('AdminLinksInFrontend') ? $modules->get('AdminLinksInFrontend')->render() : ''; . Credits: The comfortable Javascript Color Picker in the Configpage comes from Jan Odvarko (http://jscolor.com). Many thanks for this! * Toolbar The toolbar can be positioned by css values for top/bottom and left/right. It can expand in vertical or horizontal direction. The buttons are links to the PW admin, for logout, or for editing the page in admin, or informational ones. All settings, including the colors, can be defined in the modules config page. This is available for all PW versions from PW 2.3 up to now. Depending on how you configure this part, it can be used for authors and editors too, maybe. * Import / Export Settings It has the possibility to export and import its settings via two textarea fields. When importing settings, you get a second screen where you can select which settings you want to import. * One-click User Account Switcher For PW versions 2.6.8+, there is one really nice function available, that I use when developing / testing sites with different user / roles. A fast User-Account-Switcher that lets you view the same page from different user accounts with only one click. To enter this mode, you need to login as a superuser one time, and the feature needs to be enabled in the module of course. After that, you can log out, login with different user roles, etc. At least the toolbar buttons for the User-Account-Switcher will stay visible for you. This is session based. There is also an extra button with a trash can and the text "Session", that helps you to leave this mode once you are finished. As you can see in the screenshot, after clicking "guest", I was logged out, but a regular login button, a warning for debug mode and my three defined buttons for user accounts are available. When clicking another user button I login with this account. Very handy. ATTENTION! The use of the One-click User Account Switcher is mainly intended for dev sites, not for public sites! You should be aware that there is a huge security risc when using this feature on public reachable sites! We completly leave ProcessWires comfort zone in regard of security, - and the only thing between your site and potentially hackattacks is this module. (Oh mom, - what have I done?) PW 2.6.8+ has a comfortable function for admin tasks, that let us log into different user accounts via API without using passwords. This module uses this function! All data that is needed during a User Account Switcher session is stored in the session data on the server. So, if someone steel your session cookie, there is potentially risc that he can login as a superuser, depending of the user account buttons you have in your admin links collection! To prevent SessionHijacking, the module can be bound to a single IP address, it uses a fingerprint depending of IP(s) and UserAgent string. And you need to define a max time to live in minutes between 2 and 60, a User Account Switcher session may run. A User Account Switcher session only can be initialized by a Superuser who also explicitly has set a permission called 'alif-user-account-switcher', what is defined by the module, when installing it. So, the prefered way to use this module is, to enable and use the User Account Switcher while the site is unpublic, and before it goes public, remove the permission from the superuser role. This way, you can use its menu function, but not the UAS anymore. On a sidenote, for those rare cases where multiple superusers simultaneous developing on a site and want to use the ALIF, but the UAS should be used only by one, you can leave the 'alif-user-account-switcher' permission removed from the superuser role, but need to assign the role 'alif-superuser' to the single user account. This way, only that single superuser has the permission for UAS, whereas all other superusers doesn't have it. . . * The Configpage * Online demo I have pasted it into this old site and enabled it to be present every time (when the site is in demo mode only!). So, it is an earlier state, but the switcher is functional there: http://pwlaf.biriba.de/dbinfo/ * Download From our modules directory or from github repo
    1 point
  12. PrevNextTabs Module Github: https://github.com/outflux3/PrevNextTabs Processwire helper modules for adding page navigation within the editor. Overview This is a very simple module that adds Previous and Next links inline with the tabs on the page editor. Hovering over the tab shows the title of the previous or next page (using the admin's built in jqueryUI tooltips.) Usage This module is typically used during development where you or your editors need to traverse through pages for the purpose of proofing, flagging and/or commenting. Rather than returning to the page tree or lister, they can navigate with these links. Warnings If you are using PW version 2.6.1 or later, the system will prevent you from leaving the page if you have unsaved edits. For earlier versions, to avoid accidentally losing changes made to a page that might occur if a user accidentally clicks on one of these, make sure to have the Form Save Reminder module installed. http://modules.processwire.com/modules/prev-next-tabs/
    1 point
  13. I've written the issue on GitHub to hear Ryan's thoughts. I'm not good enough in PHP or PW internals and don't know when ajax upload is used. In "ajax mode" uploaded file is read from php://input and then created at the $config->$uploadTmpDir (if set) folder. In "nonajax mode" $config->$uploadTmpDir is not used - files are uploaded to the folder set up by upload_tmp_dir directive in php.ini It would be ideal if "nonajax upload" would store files in $config->$uploadTmpDir to... Is this possible? Sorry for dumb questions...
    1 point
  14. Hello Guys, Thanks for the responses. Turned out to be that my SQL import was only importing half the tables managed to get it sorted. Thanks for your help again! Cheers Jon
    1 point
  15. Thank you for the replies so far. I'am now testing UIkit and like it a lot, especially the class uk-width-* It is simple to understand and clean code.
    1 point
  16. This is documented behavior. From PW's selector documentation:
    1 point
  17. I use separate browser profiles, mostly one per project, but you can create more too. Read more in my blog post: http://blog.rolandtoth.hu/post/61202386954/per-project-chrome-instances
    1 point
  18. Hi Jon, Why don't you tell us something more about what you are using e.g: processwire version you are using did you zip up, ftp or cpanel upload what hoster you are using Anyway in such case I would first run on your online host, a fresh new processwire installation with the same version as you are using local on your computer. Running a fresh new processwire installation will tell you if your online host environment is meeting all the needed requirements. After that simply replace the online site folder with the one you have local, use zip, and ftp or cpanel for upload. After that adapt your config.php local values to the online host values and finally import your local sql file. If everything is working locally but not online, these steps will narrow down where the problem might be. Usually: .htaccess, index.php or paths mismatch hosting restrictions file missing or corruption during zip compress/extract or ftp upload => maybe in your case (field not exist) the .sql migration Anyway let us know about how it goes
    1 point
  19. Did the database get migrated correctly? Is it possible that the field doesn't actually exist - can you check for it in PHPMyAdmin or similar. There should be a table named "field_fieldname" and there should be an entry for it in the "fields" table.
    1 point
  20. 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
  21. 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.
    1 point
  22. Got rid of the PHP notice on module install (1.2.1).
    1 point
  23. Great to hear! I've created an issue and suggested the fix.
    1 point
  24. Thanks for this - If I can help improve the translation, let me know. merci encore.
    1 point
  25. 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/
    1 point
  26. SQL query changed from joins into using IN and NOT IN syntax.
    1 point
  27. 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.
    1 point
  28. jonithlnljani how ? wolud makes.infinite ploop no ? or how u.say in englich. circle jerkey or.recurses no ending.samasaras likes when trimmer beard in.bathroon w 2 mirror & u see millonions of willys
    1 point
  29. After a few days of research I found this solution for my above problem. Complete code is-- <?php if ( isset($_POST['submit']) ) { $upload_path = $config->paths->templates . "images/"; $pdfs = new WireUpload('upload'); $pdfs->setMaxFiles(8); $pdfs->setOverwrite(false); $pdfs->setDestinationPath($upload_path); $pdfs->setValidExtensions(array('pdf','xps','pptx')); // execute upload and check for errors $pdf_files = $pdfs->execute(); if(!count($pdf_files)) { $pdfs->error("Sorry, but you need to add a photo!"); return false; } $rep_id = array(); $page->setOutputFormatting(false); foreach($pdf_files as $pdf){ $building = $page->test_rep->getNew(); $building->save(); $rep_id[] = $building->id; $page->test_rep->add($building); } $page->save(); $page->setOutputFormatting(true); if(count($rep_id) === count($pdf_files)){ $count = 0; foreach($pdf_files as $pdf){ $page->setOutputFormatting(false); $repeater_id = $rep_id[$count]; $field_rep = $page->test_rep->get("id=$repeater_id"); // test_rep is table and test_rep_field is field of the table $field_rep->of(false); $field_rep->test_rep_field = $upload_path.$pdf; $field_rep->save(); $page->save("test_rep"); $page->setOutputFormatting(true); $count++; } } } ?> <form action="<?php $_SERVER['PHP_SELF'] ;?>" method="post" enctype="multipart/form-data"> <p>Click the "Select Files" button below to upload your photo.</p> <input type="file" name="upload[]" multiple /> <button type="submit" name="submit">Submit</button> </form> I hope this will help someone while uploading files in repeater fields.
    1 point
  30. I'm guessing that some new rewrite rule the SEO guys added caused it to start using those ?it= URLs, revealing them when it usually wouldn't. For instance, maybe they setup a rewrite rule that makes /index.php redirect to "/" without getting it quite right, thereby interfering with PW's own rewrite rules. I would suggest removing whatever rule they added that's causing the interference, and then putting your own alternative in a /site/ready.php or /site/templates/_init.php (if using one), like this: if(preg_match('/(index\.php|[?&]it=/!', $_SERVER['REQUEST_URI'])) { throw new Wire404Exception(); } Or if you just want to make it redirect to the homepage, replace the exception line with $session->redirect($config->urls->root); I will add something similar to the core ProcessPageView module to prevent that possibility too.
    1 point
  31. I purely use CKEditor for text and text only. And only allow a few HTML tags. Mostly h2, h3, h4, then p, strong, em, ul, li and a. I disable the pwimage, table and all other thing not related to pure markup text. All other content could be added with a page table field row. So if they need a form, a map, an photo album, a single photo or something else, they can add it via the page table. All rows of the table are looped and set to a variable. That variable is set to the template and rendered on the main view.
    1 point
  32. Set the format to a sensible default and use this in the frontend to get the timestamp for other formatting purposes: // 1452082822 $timestamp = $page->getUnformatted("dateField"); // 01/06/2016 12:20 $defaultFormat = $page->dateField;
    1 point
  33. About handling the display of images from a twitter feed, I did this today by adding code inside MarkupTwitterFeed.module. I post it here in case it could help other pw users having the same needs. // To be added in public function renderItem, before: $out = $options['listItemOpen']; if (isset($item['entities']['media'])) { $mediaUrlField = wire('config')->https ? 'media_url_https' : 'media_url'; foreach($item['entities']['media'] as $m) { if($options['listItemPhoto']) { $photoHtml = str_replace(array('{src}', '{title}'), array(wire('sanitizer')->entities($m[$mediaUrlField]), wire('sanitizer')->entities($m['display_url'])), $options['listItemPhoto']); $text = preg_replace('!' . preg_quote($m['url'], '!') . '(\b|$)!i', $photoHtml, $text); } else { // Hide the media reference in the text $text = preg_replace('!' . preg_quote($m['url'], '!') . '(\b|$)!i', '', $text); } } } where $options['listItemPhoto'] contains the html for a Twitter photo. For example, if you simply want to display the image, you can set it to: $options['listItemPhoto'] = "<img src='{src}' title='{title}'>"; This will be rendered like in this screenshot:
    1 point
  34. Just a small update that adds some nice default styling to the login form. It populates the CSS field on install so you can still edit however you want, but gives a much nicer starting point If you have the module already installed, you'll want to update, then uninstall and reinstall to populate the CSS field. It now looks like this by default:
    1 point
  35. There was a request that I add an official thread for this module, so here it is. MarkupTwitterFeed generates a feed of your tweets that you can output on your site. When you view the processwire.com homepage and see the latest tweets in the footer, this module is where they are coming from. This module was recently updated to support Twitter's new API which requires oAuth authentication. modules.processwire.com page GitHub project page Usage instructions
    1 point
×
×
  • Create New...