Leaderboard
Popular Content
Showing content with the highest reputation on 08/18/2015 in all areas
-
Having some experience with ExpressionEngine, Craft CMS, Drupal, WordPress and (luckily) ProcessWire, I find Ryan's approach to ProModules to be a smart and effective solution. With product exposure and attention comes a market. That market can be 3rd party commercial modules, or first-party modules. Personally, I'd much prefer a first-party module for something at tightly integrated as Drafts. I think this is an evolutionary step for ProcessWire, and a positive one. If a project requires the workflow or functionality that ProDrafts offers, I think the small price is beyond reasonable. If you have a few publishers, and this module saves them a few minutes /day, it's paid for itself pretty quickly. I hope Ryan continues on this course. I don't see it detracting from the core product at all - in fact the opposite. As more Pro modules have been released, the pace of core development has spiked. All-in-all a good thing in my opinion. Sponsored development is a great contribution too (thanks Apeisa and Avoine!), but Pro Modules are also a great way to push PW forward.9 points
-
Ok, updates! Regular asm inputfields now work dynamically without the need for a page save Compatible with the new singular autocomplete fields Links are now fully configurable on a field-by-field basis Implemented preliminary "Add New" functionality to enable adding pages via modal window right from the field Changed "Edit" link labels to "View" (just my preference... but maybe this could be made configurable down the road) Code cleanup and optimization Note that after you upgrade you may have to re-set your page fields (just the edit link checkbox, not the whole field).5 points
-
Just added some new features and a couple of bug fixes to the dev branch. Fixes for export mode with certain complex field types Added support for AJAX loading of BCE - especially useful if you are using the "New Tab" position option - requires PW 2.6.11+. This will make Page -> Edit load much quicker when you have lots of child pages. New Lister mode - this allows you to view (and configure the default columns/filters) all children under the current page. If you have ListerPro installed you can also use the Actions on the children. This also supports inline editing which makes for a very quick and easy way to edit the key fields on each child page. Please let me know how the new AJAX load and Lister mode features work for you - I think I need some wider testing before pushing this to the master branch. You can define the Lister config settings sitewide, and then provide overrides for each parent page that has been enabled under "Configurable Pages" This screenshot shows the new Lister mode configured to show a predefined set of columns - a great way to preview the page content of child pages. This shows the Lister Inline Edit mode - making for very quick editing of key fields in child pages.4 points
-
I found how to fix the problem.... disable AutoJoin field on the PageReference field..... Not sure if this is documented somewhere...that setting AutoJoin will limit your options when you have more then 170 references....4 points
-
I realise that you kind of got your answer already, but just wanted to add some thoughts to the topic First of all, we've discussed the "what should be in the core" topic a few times, and the conclusion has so far been something along the lines of "features that most sites require". For most sites the published/unpublished separation is more than enough, and a feature like drafts could actually be even harmful (an added complication). ProcessWire, as it is right now, does most of what any regular site could require, and more. In fact I'd be tempted to argue that in the future we should trim down current distribution, not add to it, unless someone can point out a real need that still hasn't been answered. What Ryan has been doing with the AJAX inputfield updates, selector updates, etc. is enhancing existing features, and in my opinion that should remain the main area of focus in the near future. Anything that isn't in the core can be realised in the form of modules, and if those modules are commercial, that's (again in my opinion) fine. ProcessWire has a viable module ecosystem, and anyone can create and publish commercial modules, if they so choose; in other words, this isn't a right reserved for Ryan alone. Of course I hope that module authors choose to open source their code and provide it for free, but I can't force that decision on anyone.. and neither can anyone else All that being said, the way this works should be communicated clearly and visibly; what goes to core and why. Years ago I looked into Concrete5. Back then multi-language support was only available as a commercial addition, and my first reaction was literally "what a greedy bunch they must be, asking money for what should be a core feature". Thinking about it now, I probably just didn't understand their target audience and the reasoning behind this particular decision. I sincerely hope that as few people as possible take a look at ProcessWire, see Drafts or FormBuilder or ProCache, and think that "those ProcessWire developers must be a greedy bunch to take money for obvious core features!"3 points
-
Hello @ all, in the past I had the problem that I wanted to add additional markup and manipulations to images that were added with the editor to my body field. My aim was to add Bootstrap framework classes to my images and to add additional containers for certain CSS3 effects. I have tried several ways with dom manipulation, jquery and other php manipulations, but all of them dont satisfy my exact needs. After searching Google i found a php library called "PHP Query" which works similar to jQuery but on serverside. After several tests it seems to me the best way for complex manipulations and so I decided to make a simple textformatter module. It consists of 2 files: the phpquery.php file for the library and the the module file itself which contains the manipulations The php query library file can be found at https://code.google.com/p/phpquery/downloads/list The module file: <?php /** * TextformatterPhpqueryImageFieldMarkupManipulator (1.0.0) * A textformatter module to change the markup of images added via editor with the help of the PHPQuery library. * * @author Kern Juergen * * ProcessWire 2.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class TextformatterPhpqueryImageFieldMarkupManipulator extends Textformatter { public static function getModuleInfo() { return array( 'title' => "TextformatterPhpqueryImageFieldMarkupManipulator", 'version' => "1.0.0", 'summary' => "A textformatter module to change the markup of images added via editor with the help of the PHPQuery library (https://code.google.com/p/phpquery/).", 'author' => "Kern Juergen", 'href' => "", 'permission' => array( "" ), 'autoload' => false, 'singular' => false, 'permanent' => false, 'requires' => array( "PHP>=5.4.0", "ProcessWire>=2.5.28" ) ); } public function format(&$str) { require('phpQuery.php'); $id = $this->page;//grab the page id $galleryid = 'gallery-' . $id;// create the gallery $document = phpQuery::newDocumentHTML($str); // Selects all image elements added via editor $matches = $document->find('img'); foreach ($matches as $match) { //starting manipulations - examples (you can find more and a documentation at https://code.google.com/p/phpquery/wiki/Manual) pq('a > img')->addClass('linked'); //add linked class to all linked images pq('img')->addClass('img-responsive')->addClass('thumbnail'); //add thumbnail and responsive class to all images pq('.linked')->removeClass('thumbnail'); pq('a > img')->wrap('<span class="scalecontainer"></span>')->before('<span class="roll"></span>'); //add additional markup to images with links pq('img')->parents('a')->addClass('thumbnail')->attr('data-lightbox', $galleryid); //add thumbnail class to the link to the larger version and the data attribute pq("a > span > img.align_left)")->parents('a')->addClass('align_left'); pq("a > span > img.align_right)")->parents('a')->addClass('align_right'); pq("a > span > img.align_center)")->parents('a')->addClass('align_center'); pq("p > a.align_center)")->wrap('<div class="image-center"></div>'); pq("p > img.align_center)")->wrap('<div class="image-center"></div>'); //end manipulations } $str = $document; } } The module file includes the phpquery with the require command. $matches = $document->find('img');// Selects all the images This line of code grabs all images //starting manipulations - you will find more info at https://code.google.com/p/phpquery/ //These are some manipulations pq('a > img')->addClass('linked');//add linked class to all linked images pq('img')->addClass('img-responsive')->addClass('thumbnail');//add thumbnail and responsive class to all images pq('.linked')->removeClass('thumbnail'); //remove class thumbnail on linked images pq('a > img')->wrap( '<span class="scalecontainer"></span>' )->before('<span class="roll"></span>'); //add additional markup to images with links pq('img')->parents('a')->addClass('thumbnail')->attr('data-lightbox', $galleryid); //add thumbnail class to the link to the larger version and the data attribute pq("a > span > img.align_left)")->parents('a')->addClass('align_left'); pq("a > span > img.align_right)")->parents('a')->addClass('align_right'); pq("a > span > img.align_center)")->parents('a')->addClass('align_center'); pq("p > a.align_center)")->wrap( '<div class="image-center"></div>' ) ; pq("p > img.align_center)")->wrap( '<div class="image-center"></div>' ) ; //end manipulations This is the manipulation section. You can find a lot of examples at the php Query site. The best is that you can use CSS3 selectors to match a certain element on the page. This makes it much easier. I only posted this module for others who are interested in manipulating images. You use it at your own risk and I doesnt make it public on Github. The manipulations are only for my purpose and you can make your own. Just write it between "//These are some manipulations" and "//end manipulations". Install the module at site/modules/ and add this textformatter module to your editor field. All the images added with the editor will be manipulated in an elegant way. Best regards Jürgen PS.: I am not a skilled PHP pro, I have never learned it at a professional level. So if anybody has improvements please post it here Edit: The include of the phpquery.php file should usualy be at the top of the module file, but in this case it can make problems during the installation of the textformatter. This is the reason why I added it inside the function. If you run into problems after the installation please add this line of code to the top and everything works fine. TextformatterPHPqueryImageFieldMarkupManipulator.zip3 points
-
this.look like a repleye to questiones here http://processwire.com/blog/posts/processwire-2.6.13-and-a-preview-of-prodrafts/#Comment11880 allso pw all ready having sweet versionings frm weekly.pw.teppo http://modules.processwire.com/modules/version-control/ i make draftas this like 1.installs processPageclone frm core 2.clicking copy.on page in.tree { page u want.draft of } 4.edit.edit.edit { keep unpublishas } 4.get mom to edit.fix.edit blahblahblah shutup mom 5.ready to publishas ? trash.originalas page 7.rename clones page and clicking publishas edit 8.ok mabe i will.try prodraft3 points
-
What the guys said above - I hadn't thought about it like that and was going to suggest something else, but the more I think about my own requirements draft pages would only have been used in less than 10% of projects I think, and even then they would warrant the price tag so not an issue really and it shouldn't be core. The only draft I need most of the time is as I'm writing something before it's published, so the unpublished state does that for me. This does come up from time to time with new pro modules (pretty sure I remember a similar conversation way back when FormBuilder or something was released) but there's usually a good answer like the guys have made above. I prefer that everyone who has paid for Pro Modules gets the benefit of everyone else's questions and answers in the relevant support forums. If the modules were free to all, other community members would undoubtedly help out non-paying folks in the forums which is fine, but given that there are a lot of people here generous with their time and knowledge, folks might not need paid support or see the need to buy that option so it would be a bit of a gamble. Having said that, some aspects would be nice in core, but not to the extent as in this module. But someone could easily build a more basic module for drafts - how do you think the Dev Directory works when you post updated content? (It actually clones the current entry, you edit the clone, then when approved it's copied over the original - a very rudimentary draft system built in a short time using just a few API commands in a small module).3 points
-
Thanks @mr-fan! I just put together another screenshot showing how you can use BCE as the equivalent of an inline PageTable field interface. Obviously these are just child pages and are not callable from a field, but it provides an excellent editing interface in a dedicated tab along with all the filtering options of lister. It also doesn't have any of the problems with a PageTable field regarding editing the content page directly and not having new pages automatically added, etc. The inline ajax editing is also a great bonus over the popup modal editing. Of course, this inline editing requires ListerPro, but I think it is worth it2 points
-
2 points
-
Having used ProcessWire for 5 years and in 50 projects (or so) without drafts, I don't think it's fundamental functionality by any means. Very rarely requested and much more rarely actually needed. For Avoine, I don't see big need for drafts, so having it as pro module is much better for us than sponsoring.2 points
-
Hi, first of all I'd like to thank you all, and in particular Ryan, for this great project which is ProcessWire. I'm using ProcessWire for the first time and frankly I'm finding it quite good, despite my lack of experience. Anyway, I created this post to introduce you the following module, on which we are working, and I'd like to share it with the community which could benefit from it and maybe improve it. You can find the module here: https://bitbucket.org/mauro_mascia/processwire-social-login/ Basically, it adds the ability to allow a social login (using the HybridAuth library - https://github.com/hybridauth/hybridauth) as well as a standard login, user profile and registration. The module is clearly not complete and it is at its first stage of maturity and I hope you can forgive me if I have not fully complied with the PW best practices1 point
-
I highly recommend reading the second post, too before implementing anything, as it might simplify a lot, depending on your setup.. Because I just updated all MarkupCaches with newer WireCache, couple of weeks ago, and really like it, I thought why not share it. So I got _init.php as prependTemplateFile, and _out.php as appendTemplateFile. But let's check out the interesting part, for example an article.php template. but for some pages, for example blog, it makes sense to include all children ;-) You can include any page you like, or define a time or a template as expiration rule. Here my defaults from the _init.php $cacheNamespace = "hg"; $cacheTitle = "$page->template-" . $sanitizer->pageName($page->getLanguageValue($en, "title")) . "-$page->id-{$user->language->name}"; $cacheTitle .= $pageNum ? "-$pageNum": ''; $cacheExpire = $page; I'm not exactly sure if there is any benefit in using a namespace, you can omit the namespace part and if needed just prefix the cache title. Works both. You'll see why I added the namespace/prefix a little later ;-) For the title I'm getting, the template, english page title (you can of course use the language title and omit the language name part, but I liked it better to have the caches grouped.. After language name I'm adding the page number if present. If you need you can of course create a different, more or less specific cache title. Add get parameters or url segments for example. Then I have $cacheExpire already set to $page as default value, so I don't need to set it in every template So my markup (only the important parts) looks like this: //You can have anything you like or need uncached above this $cacheExpire = $page->chilren(); $cacheExpire->add($page); $cache->getFor($cacheNamespace, $cacheTitle, "id=$cacheExpire", function($pages, $page, $users, $user) use($headline) { // as you can see, within the function() brackets we can pass any Processwire variable we need within our cached output. // If you don't need any you can of course leave the brackets empty // and if you need any other variable wich you had to define outside this function you can pass them via use() // so here goes all your markup you want to have cached // for example huge lists, or whatever }); // Then I have some more uncached parts, a subscription form for example. // After this comes another cached part, which gets -pagination appended to the title. Otherwise it would override the previous one. // It's not only caching the pagination, I just needed a name for differentiation. $cache->getFor($cacheNamespace, $cacheTitle.'-pagination', "id=$cacheExpire", function($pages, $page, $users, $user) use($headline) { // so here comes more cached stuff }); After this your template could end or you can have more uncached and cached parts, just remember to append something to the cache title ;-) Now comes, at least for me, the fun part haha In my prepended _init.php template file I have the following code under the cache vars: if($user->isSuperuser() && $input->get->cache == 'del') { if($input->get->clearAllCaches == "true") { $allCaches = $cache->get("hg__*"); foreach($allCaches as $k => $v) $cache->delete($k); $session->alert .= "<div class='alert alert-success closable expire'>All (".count($allCaches).") caches have been deleted. <i class='fa fa-close'></i></div>"; } else { $currentPageCaches = $cache->get("hg__$page->template-" . $sanitizer->pageName($page->getLanguageValue($en, "title")) . "-$page->id*"); foreach($currentPageCaches as $k => $v) { $cache->delete($k); $session->alert .= "<div class='alert alert-success closable expire'>Cache: $k has been deleted. <i class='fa fa-close'></i></div>"; } } $session->redirect($page->url); } So when I append the parameter "?cache=del" to any URL all cache files within my namespace and beginning with the predefined $cacheTitle will be removed. Means all language variations and the "-pagination & -comments" caches will be deleted, too. This is the else part. But if I append "&clearAllCaches=true", to the first parameter, it will get all caches within my namespace and clear them. Without the namespace it would clear Processwires caches (like the module cache), too. I'm storing a little success message in a session called "alert" which is closable by the FontAwesome icon via jQuery and expires after some seconds, means it will remove itself, so I don't have to click ;-) Maybe it makes more sense to change the cache title and have the page->id first, so you could select all related caches with $cache->get("hg__{$page->id}*"); I liked them grouped by template in the database, but maybe I change my mind soon because of this For not having to type those params manually I have two buttons in my _out.php template file. I have a little, fixed to the left bottom corner admin menu with buttons for backend, edit (current page), and now clear cache button which unveils the clear all caches button on hover, so it's harder to click it by mistake. When someone writes a comment, I added similar lines as above, after saving the comment, to clear comment caches. Ah, the comment caches look like "-pagination" just with "-comments" appended instead. I don't know if there is an easy way to expire a cache when a new children (especially backend created) is created, other than building a little hook module. With MarkupCache it could be a pain to delete all those folders and files in /assets/ folder, especially with slow connection. The database driven WireCache makes it much faster, and easier when set up those few lines of code to make it for you. more about WireCache http://processwire.com/blog/posts/processwire-core-updates-2.5.28/#wirecache-upgrades https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireCache.php Hope it helps someone and is okay for Tutorial section, if you have any questions, suggestions or ideas feel free to share. Hasta luego Can1 point
-
1 point
-
I'm not really sure how this is selecting 1|3 here, but there's certainly a lack in checking for empty strings in the FieldtypeOptions::sanitizeValue() function. To fix this add this right at the start of the function: if($value === ""){ return $this->getBlankValue($page, $field); }1 point
-
Have you checked this troubleshooting guide for moving installations? https://processwire.com/docs/tutorials/installation-moving-and-troubleshooting/page51 point
-
Any opinion on the "View" vs. "Edit" link label? Originally I had just changed it to "View" for one of my projects, but then I realized this might be clearer for the majority of applications, since "Edit" could imply editing the field itself rather than the selected page(s).1 point
-
I'm not sure if this has been brought up before, and I definitely know this idea is very wishful thinking since it goes directly against how ProcessWire is supposed to work, but I thought I'd bring it up anyway. Currently, if you want to add a field to a page, you must add that field to the template that the page uses. This means, the field will exist not only for that specific page, but any pages that use the same template. Sometimes however, I want to add a field to a specific page without having to give that page a unique template. Perhaps I'm a little lazy, or perhaps it just seems like creating a specific template feels like overkill, although that is the ProcessWire Way. If you are familiar with Advanced Custom Fields for WordPress, it does have this kind of functionality (in addition to a few other cool ways to assign fields), but WordPress of course handles custom fields in a much more "loose" way. Any thoughts on this?1 point
-
It's now fixed, but a config option must be enabled: https://github.com/ryancramerdesign/ProcessWire/issues/1321#issuecomment-1315256551 point
-
Hi BernhardB, glad you like it! This feature has been indispensable on my own projects as well. If I understand correctly, it sounds like you need the ability to alter the parent page of new items based on the location of the current field in the page tree. Right now if you leave the parent option blank it should give you the option of where you want to add the page each time you create a new one. But I know this isn't ideal for what you want to do. I'll look into creating a Custom PHP field for that. I'm not completely sure if it's even possible, but my guess is that it shouldn't be too hard if I can look at how Ryan did it. I agree that an unselect button would be nice. I haven't looked into how the page list select works under the hood, but it sounds like that might be a fun challenge if I can find the time to look into it. It might be as simple as adding a button and overlaying a bit of javascript to trigger the other button that's hidden in the list.1 point
-
seems i've to translate some strings again....you're really getting this as alternative editing interface for childpages instead of the normal pagetree.... Thank you very much for this nice piece of work - will testing soon.1 point
-
The issue is the empty <i> tag. You could try: <i class="krown-icon-bubble" style="color:#e64d36"> </i> Otherwise, the recommended approach seems to be this setting: // allow i tags to be empty (for font awesome) CKEDITOR.dtd.$removeEmpty['i'] = false1 point
-
Yep, I thought I worded that a little unclearly. I didn't mean to express an opinion that drafts should be a core module Re: team forming in open source projects - it does seem to often require years of history and dedication from power users. If we look at LibreOffice, it forked from a company-governed project to a foundation-governed one. There is a lot of paperwork involved in running the foundation and the president is mostly preoccupied with that stuff from what I know. The foundation had been chugging along for 4 years before I joined the QA team. I don't have a clear picture about the historical amount of effort in organizing the teams, only that it was very easy for me to walk in and start contributing. I also slid into helping the design & infra teams and before I knew it I was the official Etherpad guy Important elements in getting remote team members to work efficiently are effective web-based collaboration tools.1 point
-
Just picking up on Ryan's earlier comment: I did this recently for pages containing multiple images and descriptions and thought I'd share the code snippet. If your CSV data for the temporary textarea field ("desc_temp") is formatted like this... image1.jpg=A description for image 1 image2.jpg=Another description ...etc, then after importing you can apply the descriptions with... foreach ($mypages as $p) { $p->setOutputFormatting(false); $desc_lines = explode("\n", $p->desc_temp); foreach ($desc_lines as $line) { list($file, $desc) = explode("=", $line); $image = $p->images->get("name=$file"); $image->description = "$desc"; } $p->save(); $p->setOutputFormatting(true); }1 point
-
1 point
-
Ok, it should be fixed in the latest version. This fix is only needed for PW 2.6.6+ but I think it should also work fine on older versions.1 point
-
Hola! Is there still work to be done in this translation? I would gladly like to contribute with this effort I am from México and I would like to think that my latin american spanish is acceptable I could help with a Latin American version if it's still missing, I read on the first page that there were plans to release one but I don't read more posts from the people involved.1 point
-
I like ProcessWire, and I've used it on almost every project in the past three years. But to state this in the way that you have is borderline trolling. You are of course entitled to your opinion, but in my world, things aren't as easily defined in black and white. And they aren't for my clients, either.1 point
-
btw, I vote for an informational page similar to the following (maybe linked from the public Road Map), so that when a visitor is investigating ProcessWire and wants to know the frequency of previous updates, they are able to find it without having to perform a search in the forum or visit another site. https://codex.wordpress.org/WordPress_Versions1 point
-
Got a little further by looking at the SQL queries run. Seems I found a bit more info: The page containing the Page field is queried like this: (seen in the debug trace when on this page in the Backend) SELECT false AS isLoaded, pages.templates_id AS templates_id, pages.* , pages_sortfields.sortfield, (SELECT COUNT(*) FROM pages AS children WHERE children.parent_id=pages.id) AS numChildren, field_title.data AS `title__data`, GROUP_CONCAT(field_card_group.data SEPARATOR ',') AS `card_group__data`, field_fb_success.data AS `fb_success__data`,field_fb_error.data AS `fb_error__data`,field_max_checkin.data AS `max_checkin__data` FROM `pages` LEFT JOIN pages_sortfields ON pages_sortfields.pages_id=pages.id LEFT JOIN field_title ON field_title.pages_id=pages.id LEFT JOIN field_card_group ON field_card_group.pages_id=pages.id LEFT JOIN field_fb_success ON field_fb_success.pages_id=pages.id LEFT JOIN field_fb_error ON field_fb_error.pages_id=pages.id LEFT JOIN field_max_checkin ON field_max_checkin.pages_id=pages.id WHERE pages.templates_id=61 AND pages.id IN(1341) GROUP BY pages.id The part: GROUP_CONCAT(field_card_group.data SEPARATOR ',') AS `card_group__data` is what returns a full list of id's that are referenced... so far so good, got 210 id's But the next query that is run is: SELECT id, templates_id FROM pages WHERE id IN(1337,1338,1353,1399,1400,1401,.. etc This is where not all id's from the previous query are included in the IN ( ) part. it only includes 170 id's Hope anyone has an AHA moment... not sure why this is happening... still going through the processwire Core to find out where things are done.1 point
-
One notable difference between setOutputFormatting() and of() is the difference in return value. // setOutputFormatting is chainable and returns the page object $page->setOutputFormatting(false)->set("field", "value")->save(); // of() is not chainable, but does return the previous OutputFormatting status $oldOf = $page->of(false); $page->set("field", "value"); $page->save(); $page->of($oldOf);1 point
-
Resurrecting this slightly, but I did something along these lines just now with help from this thread (actually approached it netcarver's suggested way from the first post). It's one where I wanted to skip the first page of adding a name (for events in a calendar) but didn't want to use a repeater - which would achieve the same, but I wanted separate pages. Code as follows: In init function: $this->pages->addHookBefore('ProcessPageAdd::execute', $this, 'generateName'); The function that does the work (specific to my case): public function generateName() { if ($this->input->get->parent_id == 1019) { // 1019 = some page where we want to auto-generate child page names $page = new Page(); $page->parent = $this->input->get->parent_id; $page->name = $this->pages->get($this->input->get->parent_id)->count()+1; $page->template = 'child-template-name'; $page->addStatus(Page::statusUnpublished); $page->save(); $this->session->redirect("../edit/?id=$page"); } } So it checks we're creating a page under a certain parent, sets the right template, creates a page using an integer as the name based on the count of pages under the parent page and then takes you to the edit form for that page. The beauty of it is that since there has been no title entered so far, the user has to fill out the page fields - well title at least - to continue. So why did I do something so convoluted here? Because for what I'm using the title field for I needed to allow duplicate titles, so different names is key to this. The individual pages themselves will never be visited - they're just being pulled into a table into the parent page. Of course I could have used repeaters, but on this occasion I didn't want to. I think that with a little work, and the addition of multiple config lines like in my ProcessEmailToPage module you could expand this to monitor certain parent pages, hook into new page creation and create the page with a specific child template nice and neatly instead of hardcoding it as above. When I get time I might just do that... which might not be any time soon For now the above code works though for anyone wanting to adapt it to do something similar.1 point
-
Hello there Peter, This may not be of much help, but still wanted to point out that exporting data from ProcessWire for specific needs, ie. where you can easily define what data / which parts of your site / which templates you wish to export is relatively easy to achieve, just not with direct SQL queries: Bootstrapping PW and writing simple command-line script that exports data is one method I've used in the past. Another method, which is especially helpful if you only need to export specific templates, is creating a template file that instead of HTML serves JSON, XML, CSV or whatever format you prefer, accompanied with proper headers of course. If you need to export multiple pages, it should again be easy to write a template file that finds pages you need and renders each of them one after another with render() method of Page object. This is actually something I've just recently used for Excel export on a relatively large client site, accompanied with various user-defined search criteria. Works like a charm. You could also combine these two by writing a command-line script that does exactly what I've described above for exporting multiple pages simultaneously. As a neat little trick you could also switch template file used for rendering by altering the value of $page->template->filename on the fly per page in order to have "export template file" while still avoiding any unnecessary changes or complex logic at the site itself. This is still pretty far from generic export method, but has so far fulfilled all my export needs perfectly fine. PW doesn't force any limits on what you can do with your template files, which is one of the reasons I find it such a wonderful platform for pretty much anything web-related.. and even some non-web-related things1 point
-
Hi, I had a similar issue with one.com. Support suggested to comment out the following within the .htaccess file: #Options -Indexes #Options +FollowSymLinks Also: #<IfModule mod_php5.c> #php_flag magic_quotes_gpc off #php_flag magic_quotes_sybase off #php_flag register_globals off #</IfModule> That worked for me but I am concerned it may cause issues down the road! Big thanks for all the hard work you guys have put into processwire. I've spent a day running through the tuts and It already feels like a great piece of kit, plus real friendly community.1 point
-
Create a field "counter" with type "integer" and set it as "hidden, not shown in the editor" or "always collapsed, requiring a click to open", as you prefer. Put this code on your template: $page->counter += 1; $page->of(false); $page->save('counter'); $page->of(true); echo $page->counter; voilá1 point
-
Hi antknight That wouldn't work - like I wrote that would produce an error 500. However, I found the cause of the problem in the .htaccess file: #Options +FollowSymLinks Once I commented out this directive, the problem disappeared. I found the solution here: http://www.wallpaper...pache-t718.html And a general explanation of the directive here: http://www.webmaster...orum11/1962.htm I hope this helps others with the same problem. /Allan1 point
-
WillyC is right! How could I missed it So you can do: $form->setMarkup(array( 'list' => "<div {attrs}>{out}</div>", 'item' => "<div {attrs}>{out}</div>" ));1 point
-
I think this would be pretty straightforward to do. Assuming you are recording a per-page count, then you'd want to add a integer field to the page (called 'pageviews' or something like that). Then at the bottom of your template: <?php $key = "pageview" . $page->id; if(!$session->$key) { $page->pageviews++; $page->save('pageviews'); $session->$key = 1; } You may also need to add a $page->setOutputFormatting(false) above that if PW throws an error. And you might prefer to take it a little further and use an array in your $session var. The only real problem with this method is that a portion of pageviews on any site are going to be from bots, spiders, etc. You can eliminate nearly all of those by setting up a new template/page that does nothing but record pageviews and hit it with javascript. The example assumes you set this up at /tools/pageview.js (a PW page), and you would paste this somewhere in your template that powers the pages you want to track: <script type='text/javascript'> // write the script statement with JS so that spiders don't attempt to include it document.write('<scr'+'ipt type="text/javascript" src="/tools/pageview.js?id=<?=$page->id?>"></sc'+'ript>'); </script> Then your template running /tools/pageview.js: <?php if(($id = (int) $input->get->id) > 0) { $p = $pages->get($id); if($p->id && $p->fields->has('pageviews')) { // page was found and it has a 'pageviews' field $key = "pageview" . $page->id; if($session->$key) { // pageview already recorded for this page, so skip it } else { // pageview not yet recorded for this page for this user session $p->pageviews++; $p->save('pageviews'); $session->$key = 1; } } } echo "// this JS file intentionally blank"; I assume you meant thousands not hundreds. But regardless of the number (or even if it has a couple extra zeros), it should not be a problem. You won't notice a difference in performance. And given that you are just saving one field 'pageviews', rather than the entire page, it'll be especially fast (at least in 2.1).1 point