Leaderboard
Popular Content
Showing content with the highest reputation on 06/18/2015 in all areas
-
I was actually thinking of converting all feature request/enhancement issues to something in the PW website (powered by PW pages). Something like the sites directory, with the ability to "like" requests, so that the most requested ones could rise to the top and get more focus. This would also get them out of GitHub, so the focus there can be on issue reports. Though I think it's good to still submit feature requests at GitHub, but I would just move them to the more dedicated system and close them out there once that's done.7 points
-
Hi guys, Looking for a dev interested in developing a ProcessWire plugin for Z-Ray - a cool new tool for debugging PHP. You know ProcessWire more than anyone here at Zend - let me know if you're interested: daniel.be@zend.com Cheers! Daniel7 points
-
Just in case anyone missed it... https://letsencrypt.org/2014/11/18/announcing-lets-encrypt.html The headline is: Let’s Encrypt is a new Certificate Authority: It’s free, automated, and open. Arriving Summer 2015 Extract: Let’s Encrypt is a new free certificate authority, built on a foundation of cooperation and openness, that lets everyone be up and running with basic server certificates for their domains through a simple one-click process. Mozilla Corporation, Cisco Systems, Inc., Akamai Technologies, Electronic Frontier Foundation, IdenTrust, Inc., and researchers at the University of Michigan are working through the Internet Security Research Group (“ISRG”), a California public benefit corporation, to deliver this much-needed infrastructure in Q2 2015. The ISRG welcomes other organizations dedicated to the same ideal of ubiquitous, open Internet security.3 points
-
Try $page == $page->parent->children->last(). EDIT: Gah, there's a way to do it with siblings() where it includes the current page in the siblings() PageArray but the correct code eludes me and I suspect diogo will beat me to it Oooh, you could do if ($page->next) { // show the next link - $page->next; } else { // show the link to the first again - $page->siblings->first(); } I think.3 points
-
You have the option of using the .htaccess file take care of the SSL redirection. Some related links that talk about this are: https://processwire.com/talk/topic/9782-htaccess-optional-redirect-to-https/ https://github.com/ryancramerdesign/ProcessWire/pull/1128 https://perishablepress.com/stupid-htaccess-tricks/#sec132 points
-
2 points
-
2 points
-
Getting ready to launch. Needs some finishing touches but wanted to share it http://www.gabrielaestates.com2 points
-
2 points
-
Pageimage Manipulator supports this: $image = $page->images->first()->pimLoad("suffix")->setOutputformat("jpg")->save();2 points
-
Hi, after looking at the 300 open "issues" on Github, it turns out that a lot of them, including some of mine, are labeled "enhancement" / "feature request". To get the increasing number of issues down there (which might give a wrong impression on how well maintained PW is), and to do sort of a cleanup I was planning to set all of my "issues" which are labeled "enhancement"/"feature request" as closed. I am assuming that the idea was either good enough and had been recognized for an enhancement consideration and thus stored in a to-do list somewhere else, or the the idea was not good enough and did not survive. In either case, an "issue" like this,does not need to be open forever, imho. Is closing it the best way to deal with it - or should we leave the step to Ryan (or anyone maintaining this)? (Also there are many "fixed" / "completed" issues that could be closed eventually.)1 point
-
Martin, that is fixed already. I really need to figure out how to distribute upgrades... Can you send me an email and I'll send you latest release back?1 point
-
The good thing of having it here intead of GitHub is that there could be it's own fine grained system for flagging, like in a project management system, so the people know the current status and where a voting would have an effect. - planned for this dev version cycle - panned for after next mayor update - Maybe sometimes - Not currently planned - Not planned (never) - Done/Closed (hidden?) (Maybe closed/done requests could be hidden and only shown on request) Just thinking...1 point
-
Hey guys Just had the need for letter grouped tags with jumplinks and got this snippet in the end // output jumplinks $out .= "<div><ul>"; foreach($tags as $t) { $letter = strtoupper(substr($t->name, 0, 1)); if($letter != strtoupper(substr($t->prev($results)->name, 0, 1))) $out .= "<li><a href='#letter_$letter'>$letter</a></li>"; } $out .= "</ul></div>"; // output tags grouped by first letter foreach($tags as $t) { $firstLetter = strtoupper(substr($t->title, 0, 1)); if($firstLetter != strtoupper(substr($t->prev($results)->name, 0, 1))) $out .= "<div><h4 id='letter_$firstLetter'>$firstLetter</h4><ul>"; $out .= "<li><a href='{$t->url}'>{$t->title}</a></li>"; if(substr($t->name, 0, 1) != substr($t->next($results)->name, 0, 1)) $out .= "</ul></div>"; } Just wanted to share, maybe it helps someone or someone got some improvement ideas EDIT: I just uploaded it to the live site, cause I really like examples myself http://www.happygaia.com/tags/ (I always wanted to showcase our page properly, maybe next time ) The jumplinks could be a little more fancy and the anchor jumping could be nicer too, the letter heading itself is hidden by the sticky menu, but I'm a little lazy right now.. EDIT: After a while I changed this to another approach. Now I'm creating an an associative array first, index is the first letter and values are all page id's, feels more solid. And now it's easier to extend it, like counting all entries for letter A and so on..1 point
-
1 point
-
Thanks for explanation of what's going on here Ryan. I do think it would be very useful to have the option for allowing rendering of the input without changes having any effect and thus keeping the ability to control the visibilty of fields based on that field.1 point
-
When a field is only made viewable (whether by permissions or by the field's visibility setting), only its content is rendered in the document, not its form field. When it comes to visibility, field dependencies are a front-end/javascript task, so it needs that form field see what the value is. It doesn't work in your case because the field you are using for your dependency physically doesn't exist in the form (since it is not editable). In order to support this dependency scenario, we may need to add an option to allow rendering of the <input> rather than just the contents, similar to what we do for language field permissions. The user would still be able to change it (and affect the dependencies that way, though only on the front-end), but any changes they make to non-editable fields wouldn't be saved.1 point
-
Hello, I'm getting this exact error after launching a site using 2.6.1 for the first time. I ran the site through Xenu link checker to try and trigger the error message, but it ran fine, suggesting to me that the problem doesn't lie in the site templates. The System Notifications module appears to create a table in the database called field_notifications, which holds the data that is used for the notifications. It would appear that the error is being caused by a 404 error trying to be added to this table without a unique pages_id and sort. 41 is the superuser ID I believe. So essentially what is happening is the system is trying to add another record (pages_id = 41, sort = 0) when it already exists. However, I can't seem to replicate this however many times I generate a 404! Any ideas what might be generating the 404 that is causing the error? (PS - Going to disable the 404 notifications for the time being)1 point
-
You could add them with some JS with Admin Custom Files http://modules.processwire.com/modules/admin-custom-files/ Something like: $(".InputfieldPageTableButtons").each(function(){ $myButtons = $(this); $myTableContainer = $myButtons.closest(".InputfieldPageTableContainer"); $myButtons.clone().prependTo($myTableContainer); }); (written in the browser and not tested)1 point
-
You might also, depending on your scenario, want to change the "else" in my scenario to check for other pages at the same level as this page and not show any links if there are no other pages, so I think this would work for that scenario: if ($page->next) { // show the next link - $page->next; } elseif ($page->siblings) { // show the link to the first again - $page->siblings->first(); } Or for something that reads a little more clearly but does the same: if ($page->siblings) { // Only bother with next/back-to-first links if this page isn't all on its own if ($page->next) { // show the next link - $page->next; } else { // show the link to the first again - $page->siblings->first(); } }1 point
-
Hi pwFoo, It should be possible with an autoload module that hooks before Pages2Pdf::createPDF. Delete the styles.css file in /site/templates/Pages2Pdf folder, so that the module does not add styles from this file Create a new autoload module (or use an existing one) and add the following code into the init method. // Inside an autoload module public function init() { $this->addHookBefore('Pages2Pdf::createPDF', function($event) { $pages2pdf = $event->object; $page = $event->arguments('page'); // Set a custom css file for the template of the page where the PDF is generated $cssFile = wire('config')->paths->templates . 'pages2pdf/' . $page->template . '.css'; $pages2pdf->wirePDF->set('cssFile', $cssFile); }); } I did not test this code, please report if it does work or not work Cheers1 point
-
1 point
-
nice one gebeer, thanks for sharing! didn't made it for me properly because then the homepage menu would be active too. But it pointed me in the right direction so I'm successfully using this now $item->child("id=$page->id") === $page $item would be $child in the above examples1 point
-
1 point
-
Any plans to add gravatar or avatar to comments and if not, am looking to implement one for my website, you don't mind pull-requests ?1 point
-
Make sure to "open" the new parent page before moving stuff there. It needs to be highlighted to receive a page as child no matter if there are already children or not.1 point
-
Hello, I've found (again?) ami.responsivedesign.is yesterday. I can use it, then, for example, take a screenshot after having removed the (red) section part and the body background image, changed (or not) the body background color and removed the mobile and tablet divs if the website is not responsive/adaptive/mobile-friendly. I've just realized that the ones for which both the "Am I Responsive Bookmarklet" and the website input field don't work are ProcessWire websites. Probably because of Header always append X-Frame-Options SAMEORIGIN in the .htaccess file. Could/Would some of the things in the following article be interesting to incorporate in ProcessWire's .htaccess file?: https://www.simonholywell.com/post/2013/04/three-things-i-set-on-new-servers/ (I've just found this article while searching for more information on "Header always append X-Frame-Options SAMEORIGIN" via Google.)1 point
-
As tsd says, $page->rootParent, assuming it's always the "section" and not the "sub-section" you want. So for the current page, to return the root (root = as far up the tree before hitting the homepage) parent's template you would do: <?php echo $page->rootParent->template; ?> I think if you wanted the subcategory template in your example and the tree could run to any depth, you could do this: <?php echo $page->parentsUntil('id=' . $page->rootParent->id)->last()->template;?> The docs for parentsUntil suggest it will return every parent until the condition is met, so we only want the last one in your case, so hence the usage of last() there. Funny avatar pic by the way1 point
-
wrote an article http://www.okeowoaderemi.com/articles/posts/wordpress-to-processwire-a-guide-for-developers/1 point
-
Added a check to make sure the user downloading a PDF has view permission, thanks again Bernhard for finding/suggesting this! https://github.com/wanze/Pages2Pdf/commit/30810213ae939ccc3fc033765570c91c9be47cdd Cheers1 point
-
I would just like to add something to Ryans great template code. I think this may be helpful for some. To add some styling to the output, you can: In "renderSitemapXML" function, change the following $out = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; to this $csspath = wire('config')->urls->templates; $out = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<?xml-stylesheet type="text/xsl" href="' . $csspath . '/css/xsl-stylesheet.xsl" ?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; Then include this file "xsl-stylesheet.xsl" in your "css" directory. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>XML Sitemap</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="http://tablesorter.com/jquery.tablesorter.min.js"></script> <script type="text/javascript"><![CDATA[ $(document).ready(function() { $("#sitemap").tablesorter( { widgets: ['zebra'] } ); }); ]]></script> <style type="text/css"> body { font-family: Helvetica, Arial, sans-serif; font-size: 18px; color: #545353; } table { border: none; border-collapse: collapse; } #sitemap tr.odd { background-color: #eee; } #sitemap tbody tr:hover { background-color: #ccc; } #sitemap tbody tr:hover td, #sitemap tbody tr:hover td a { color: #000; } #content { margin: 0 auto; width: 1000px; } .expl { margin: 10px 3px; line-height: 1.3em; } .expl a { color: #da3114; font-weight: bold; } a { color: #000; text-decoration: none; } a:visited { color: #777; } a:hover { text-decoration: underline; } td { font-size:14px; } th { text-align:left; padding-right:30px; font-size:12px; } thead th { border-bottom: 1px solid #000; cursor: pointer; } </style> </head> <body> <div id="content"> <h1>XML Sitemap</h1> <p class="expl"> Generated by <a href="http://processwire.com/">Processwire</a> this is an XML Sitemap, meant for consumption by search engines. </p> <p class="expl"> You can find more information about XML sitemaps on <a href="http://sitemaps.org">sitemaps.org</a>. </p> <p class="expl"> This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs. </p> <table id="sitemap" cellpadding="3"> <thead> <tr> <th width="75%">URL</th> <th width="12%">Last Change</th> </tr> </thead> <tbody> <xsl:for-each select="sitemap:urlset/sitemap:url"> <tr> <td> <xsl:variable name="itemURL"> <xsl:value-of select="sitemap:loc"/> </xsl:variable> <a href="{$itemURL}"> <xsl:value-of select="sitemap:loc"/> </a> </td> <td> <span> <xsl:value-of select="sitemap:lastmod"/> </span> </td> </tr> </xsl:for-each> </tbody> </table> </div> </body> </html> </xsl:template> </xsl:stylesheet> You can of course put the file anywhere else, just change the path in the code. Also you can adjust the styling to suit your taste/site. I hope this helps someone. P.S. though I have called the file a "stylesheet" it is actually an XSL Transformation You can read more here http://www.w3schools.com/xsl/xsl_intro.asp1 point
-
Hi, I have implemented the feature and it's available in the dev branch: https://github.com/wanze/Pages2Pdf/tree/dev If anyone has time to test it out, please do so and report any issues back here. I will merge it into the master branch after some more testing How does it work? First, you need to enable multilanguage support in the module configuration. If enabled, the module creates a PDF in the language of the current user. The same is true when downloading a PDF. If the PDFs are pre-generated when saving pages in the admin, a PDF for each language is created. The language name is appended to the PDF filename in order to distinguish between files of different languages. In addition, if the module "LanguageSupportPageNames" is installed, the local page name is used for the filename. At the same time I added the newest version of mPDF to the module WirePDF. As always, please check that your PDFs are still rendered correctly after updating! Good night to everyone from Switzerland1 point
-
Here are some API additions to the dev branch, primarily for WireArray/PageArray/etc. I've found these very handy lately, and would have on almost any project I worked on, so decided they'd add value to the core. I'll add these to the cheatsheet once 2.4 replaces 2.3, but for now, here they are. The examples here use PageArray, but note that these API additions apply to any WireArray derived type, not just PageArray. WireArray::implode() Implode all elements to a delimiter-separated string containing the given property from each item. Similar to PHP's implode() function. Usage: $string = $items->implode([$delimiter], $property, [$options]); Arguments: $delimiter - The delimiter to separate each item by (or the glue to tie them together). May be omitted if not needed $property - The property to retrieve from each item (i.e. "title"), or a function that returns the value to store. If a function/closure is provided it is given the $item (argument 1) and the $key (argument 2), and it should return the value (string) to use. [$options] - This argument is optional. When used, it's an array with modifiers to the behavior: skipEmpty: Whether empty items should be skipped (default=true) prepend: String to prepend to result. Ignored if result is blank. append: String to prepend to result. Ignored if result is blank. Examples: $items = $pages->find("template=basic-page"); // render all the titles, each separated by a <br>, for each page in $items echo $items->implode('<br>', 'title'); // render an unordered list of each item's title echo "<ul><li>"; echo $items->implode('</li><li>', 'title'); echo "</li></ul>"; // same as above, but using prepend/append options, // this ensures no list generated when $items is empty echo $items->implode('</li><li>', 'title', array( 'prepend' => '<ul><li>', 'append' => '</li></ul>' )); // same as above, but with all items now presented as links // this demonstrates use of $property as a function. note that // we are also omitting the delimiter here as well, since we don't need it echo $items->implode(function($item) { return "<li><a href='$item->url'>$item->title</a></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>')); WireArray::explode() Return a plain array of the requested property from each item. Similar to PHP's explode() function. The returned PHP array uses the same keys as the original WireArray (if that matters). Usage: $array = $items->explode($property); Arguments: $property - The name of the property (string) to have in each array element (i.e. "title"). You may also provide a function/closure here that should return the value to store. When a function/closure is used it receives the $item as the first argument and the $key (if needed) as the second. Examples: // get an array containing the 'title' of each page $array = $items->explode('title'); // get an array containing the id, url and title of each page $array = $items->explode(function($item) { return array( 'id' => $item->id, 'url' => $item->url, 'title' => $item->title ); }); WireArray::data() Store or retrieve an arbitrary/extra data value in this WireArray. This is exactly the same thing that it is jQuery. I've personally found this useful when building search engines: the search engine can store extra meta data of what was searched for as a data() property. Then any other functions receiving the WireArray/PageArray have access to this additional info. For example, the search engine portion of your site could populate an array of summary data about what was searched for, and the render/output code could render it to the user. Usage: // Setting data $items->data('key', 'value'); // Getting data $value = $items->data('key'); // Get array (indexed by key) of all data $values = $items->data(); Arguments: The above usage section explains all that's needed to know about the arguments. The only additional comments I'd make are that 'key' should always be a string, and 'value' can be anything you want it to be. Example: function findSkyscrapers() { $floors = (int) wire('input')->get->floors; $year = (int) wire('input')->get->year; $items = wire('pages')->find("template=skyscraper, floors=$floors, year=$year"); $items->data('summary', array( 'Number of floors' => $floors, 'Year constructed' => $year )); return $items; } // the render function can focus purely on output function renderSkyscrapers($items) { echo "<h2>You searched for:</h2>"; // render the summary of what was searched for foreach($items->data('summary') as $label => $value) { echo "<p>$label: $value</p>"; } echo "<h3>Skyscrapers found:</h3>"; // note use of new implode() function, though a foreach() would be just as well here echo $items->implode(function($item) { return "<p><a href='$item->url'>$item->title</a></p>"; }); } WireArray::and() WireData::and() Return a new copy of the WireArray with the given item(s) appended. Primarily as a syntax convenience for various situations. This is similar to jQuery's add() and andSelf() functions, but I've always felt "add" implied adding something to the original rather than creating a new combination, so went with "and" in this case. The term "and" is actually a reserved word in PHP, so you can't usually have a function named "and()", but through the magic of hooks, ProcessWire can. This function should reduce the instances in which you'd need to do "$a = new PageArray();" for example. Usage: // create a new WireArray with $items and $item (appended) $myItems = $items->and($item); // create a new WireArray with $items and $moreItems (appended) $myItems = $items->and($moreItems); // create a new WireArray with $items and $item (prepended) $myItems = $item->and($items); // create a new WireArray with $item and $anotherItem (appended) $myItems = $item->and($anotherItem); // create a new WireArray 4 items $family = $pappa->and($mamma)->and($brother)->and($sister); Examples: // generate breadcrumb trail that includes current page foreach($page->parents->and($page) as $item) { echo "<a href='$item->url'>$item->title</a> / "; } // check if page or its children has a featured checkbox if($page->and($page->children)->has("featured=1")) { echo "<p>Featured!</p>"; }1 point
-
Arjen, Missed your post above until now. I don't have time at the moment, but overall I'm not doing anything all that fancy.1 point
-
Well basically when you follow the RESTful approach when creating systems, you use resources rather than actions. you can know more here http://restcookbook.com/ http://restpatterns.org/ http://www.restapitutorial.com/ and this books https://leanpub.com/build-apis-you-wont-hate http://www.soa-in-practice.com/ Example if you want to make an admin for the users resource. you can have this URL http://api.example.com/users In the traditional CRUD aproach, the verb is inside the URL like http://api.example.com/users/create but in REST you must use only HTTP Verbs to interact, so the same endpoint url makes different actions depending on the verb used to call it. In our system that could be http://api.example.com/users GET - result in a list of users POST - creates a new user ------------------------------------- http://api.example.com/users/clsource GET - result in the user data PUT - updates the all the data of a specific user PATCH - updates a specific data field of a specific user DELETE - deletes the user Using the HTTP response codes and mime types you can notify the result of an operation, usually with a JSON or XML body for information. The Web services Approach, specially REST web services, enables us to separate complex systems in smaller ones, easier to mantain and test. Basically you can have multiple backend systems that just are APIs and one frontend system that glue them all. this add a layer of security and robustness, because you can separate your systems in different servers. A possible attack can not affect all the system, just small parts of it.1 point
-
Glad it helped. For keeping class on for month when you are on the day page: $class = $page === $child || $child->children->has($page) ? " class='active'" : ''; Worked fine for my case. Or the other way around like diogo suggested a few posts above: $class = $page === $child || $page->parents->has($child) ? " class='active'" : ''; Hope it helps. PS: nice picture from Bkk1 point