Leaderboard
Popular Content
Showing content with the highest reputation on 07/30/2015 in all areas
-
Hi folks! I'm about to add my new module FieldtypeAssistedURL to the repository. You find the source code on github and hopefully in the modules repository soon. Here an extract from the README.md: This module offers you a new field type AssistedURL Field, providing and input field for storing absolute and relative URLs. The field type adds a button to open the URL chooser dialog known from the CKEditor link feature without the tab navigation bar for specifying link attributes. Using the URL chooser dialog the editor may select URLs from internal pages or uploaded files via a search field with auto-completion, a page tree control, and a file selector control. Please feel free to post suggestions and any form of feedback here in the forums or on github. Wumbo3 points
-
wire()->addHookAfter('InputfieldURL::render', function($event) { $field = $event->object; if($field->name != "yourField") return; $url = $field->value; if($url) return $event->return = "<img src='$url' width='100' alt='' />" . $event->return; }); This should do the job pasted at the beginning of site/templates/admin.php.2 points
-
2 points
-
Babel is a module that provides functionality for managing section based multilanguage sites. It is inspired by Babel Plugin for MODX. There are cases where websites have 600 pages in english, 700 pages in russian and only 300 pages in english and russian. In this case it is much better to keep the content separate, each under one section and have their translations linked. This module helps you to manage those links. Github Page Download Link How to Install Warning Backup your database before installing this module. Requirements Babel works on top of core LanguageSupport module. You will have to install it first and create languages for your site. Then: 1. Copy all the module files to /site/modules/Babel/ 2. In your admin, go to Modules > Refresh for new modules. 3. Click the "Install" button next to Babel. Settings First of all you should set the root page for each language. Usually section based multilingual sites will have a structure like... Root |__Home (English) |__About |__News |__ News Article 1 |__ News Article 2 |__ News Article 3 |__ News Article 4 |__Contact ... |__Главная (Russian) |__О нас |__Новости |__ Новостная статья 1 |__ Новостная статья 2 |__ Новостная статья 3 |__ Новостная статья 4 |__Связаться ... |__Baş Sahypa (Turkmen) |__Barada |__Habarlar |__ Habar Makalasy 1 |__ Habar Makalasy 2 |__ Habar Makalasy 3 |__ Habar Makalasy 4 |__Aragatnaşyk ... You just need to select the languages that you want Babel to manage and select the root pages for each of them. API Babel creates couple useful methods and a properties for you. language (Page property) Every page that is handled by Babel (those who are descendants of root pages that you choose on Babel module's settings page) will have a language property that returns a Language object that they are assigned to. It is determined based on under which rootParent the $page lives; Syntax $page->language; Return Language object. translation (Page method) This method returns the page that was assigned as a translation for the given $language. Syntax $page->translation($language); Arguments The $language argument could be either a string (the name of the language), an integer (the id of the language) or a Language object itself. Throws WireException if the language is not found or isn't handled by Babel. Return The method returns a Page object or NullPage if the translation is not available. translations (Page method) This method will return the pages that were assigned as a translation for all $languages that are available for that page. Or an empty PageArray if no translations are available. Syntax $page->translations(); Return Returns PageArray. addTranslation (Page method) This method will create a translation link from $page to $otherPage. Syntax $page->addTranslation($otherPage[, $overwrite]); Arguments The $otherPage argument should be a Page object. The language of the page will be determined by Babel itself based on under which language section the page is located. The $overwrite argument is optional and has three case scenarios: If omitted the reverse link of the translation will be created only if the $otherPage does not have a translation link for the $page->language. If set to true the reverse link will be overwritten even if $otherPage does have a translation link for the $page->language. If set to false the reverse translation link will not be created even if the $otherPage does not have any translation links. Return boolean if the translation link/s is/are created successfully or not. removeTranslation (Page method) The method removes a translation link between $page and $otherPage. Syntax $page->removeTranslation($language[, $remove]); Arguments $language (string|integer|Language) The language link you wish to remove. $remove (boolean) If there is a reverse link that points back from the translation to this page, should Babel remove it too. Default is false. Throws Throws WireException if the language couldn't be found or is not handled by Babel. Return boolean If the removal of the translation link/s is/are successful. closestParentTranslation (Page method) Returns the translation of the closest translated parent of the page. Syntax $page->closestParentTranslation($language); Arguments $language (string|integer|Language) The language for which you want a translation for. Throws Throws WireException if the language couldn't be found or is not handled by Babel. Return Page object. getRoot (Babel method) Returns the rootPage of the language. The one you have assigned in the module settings page. Syntax $modules->get('Babel')->getRoot($language); Arguments $language (string|integer|Language) Throws Throws WireException if the language couldn't be found or is not handled by Babel. Return Page object. translatable (Babel method) Tells if a page is translatable via Babel or not. Syntax $modules->get('Babel')->translatable($page); Arguments $page is a Page object. The page you want to check on. Return boolean If the page is translatable or not. getTranslated (Babel method) Returns a PageArray of translated pages. Syntax $modules->get('Babel')->getTranslated($fromLanguage, $toLanguage[, $limit[, $pageNum]]); Arguments $fromLanguage (string|integer|Language) The language from which the translation is. If omitted (or null given) then all the translation from all languages will be considered. $toLanguage (string|integer|Language) The language to which the translation is. If omitted (or null given) then translation to all languages will be considered. $limit is the number of pages you want to receive. Default is 50. $pageNum is the page number. Use for pagination of the returned PageArray. Default is 1. Throws Throws WireException if the language couldn't be found or is not handled by Babel. Return PageArray. getUntranslated (Babel method) Returns a PageArray of pages that are not translated to one or the other language. Syntax $modules->get('Babel')->getUntranslated($fromLanguage, $toLanguage[, $limit[, $pageNum]]); Arguments $fromLanguage (string|integer|Language) The language from which there is no translation. If omitted (or null given) then all the untranslated pages from any language will be considered. $toLanguage (string|integer|Language) The language to which there is no translation. If omitted (or null given) then untranslated pages to any language will be considered. $limit is the number of pages you want to receive. Default is 50. $pageNum is the page number. Use for pagination of the returned PageArray. Default is 1. Throws Throws WireException if the language couldn't be found or is not handled by Babel. Return PageArray. babelHomePage ($config property) Reference to the home page. This is usually one of the pages that you chose in the module settings. Syntax $config->babelHomePage; The babelHomePage is determined based on: the path that user has entered... if not available then the session is checked... if not available then it defaults to the core LanguageSupport module's default language; Usage Tips If your site structure is the way it looks like it is shown above. Your root page usually won't ever render. Whenever a user enters your site at the `/` path you will redirect him to one of language root pages. Here is how I suggest you to do that in your root.php template file. $session->redirect($config->babelHomePage->url, false); that's pretty much everything you need to have in your root.php file. To display links for each language homepage... $home = $config->babelHomePage; $homePages = $home->translations()->and($home); echo "<ul>"; foreach ($homePages as $p) { $title = $p->language->title; echo "<li><a href='$p->url'>$title</a></li>"; } echo "</ul>"; To display links for each translation of the current page... echo "<ul>"; foreach ($page->translations() as $p) { $title = $p->language->title; echo "<li><a href='$p->url'>$title</a></li>"; } echo "</ul>"; ProcessBabelTranslate Babel comes with very useful admin helper. You can link pages as a translation for each other. You can create translation page if there isn't one yet. There is small indicators on page tree that shows which pages are translated to what languages. And you get a Babel Tanslate page where you can quickly find all the translated and untranslated pages accross your site. See the screenshots below... Settings page Translation indicators Quick action button Quick modal translate form Tab translate form ProcessBabelTranslate page Go ahead and try it out. This is my first module to publish. Please tell me if something need to be added, changed, removed...2 points
-
I just published a pre-release of my new password reset module. It will enable identification from any field of your choice, and is fully translatable. Integration is just 2 lines of code, the first is calling the controller, the second is loading a script (no dependencies). You can download the code on GitHub at https://github.com/plauclair/PasswordReset. Also, have a look at the reset process in this video https://vid.me/eEVY. This exemple is not styled, but there should be all you need in there to style it. Comments and feature requests very welcome!1 point
-
Hey, as I often just copy someone else's (sometimes my own) modules structure as a starting point for a new module I thought there has to be a better way to archive that. That's why I created the "ProcessWire Module Generator": modules.pw If something missing? Or some more wishes for options or best practices? Let me know Here's a screenshot:1 point
-
Just a few quick notes: The sites directory, or the developers directory, are our best bet at identifying sites, companies, and developers using ProessWire. On the other hand, these are a subset of the real figures – for an example, none of the sites our company has built using ProcessWire are listed there (that's a longer topic, not going there right now).The truth is that we can't tell for sure just how widely ProcessWire is used, partly because it's built in a way that makes it possible to completely hide the fact that a given site is powered by ProcessWire. Which is a good thing, really. We do know that it's gaining momentum, and it's also quite safe to say that it's usage is nowhere near that of WordPress If, for any given reason, the lead developer had to step down, development would no doubt continue.We've got plenty of capable folks around here. It's pointless to speculate whether that would lead to one or more forks and what else might or might not happen, but I'm confident that ProcessWire wouldn't go away that easily. Personally I've always found the question of "how do we find another developer for a project built with platform X" somewhat off.First of all, this question completely ignores the fact that each system is different. ProcessWire is particularly easy to learn and understand, and unlike (apparently) with certain other platforms, there's no year-long learning period involved. A developer with basic knowledge of PHP and web development in general should be able to just step in without any major delays. To be fair, this also applies to WordPress, and other even remotely sensible platforms. Building sites with a CMS/CMF is not rocket surgery, and while years of experience with given platform will give you an edge over someone less experienced with said platform (you already know some of the possible pitfalls and shortcuts), that's all there is to it. What's much more important is how a particular project has been developed so far. Just like with any other platform out there, it's possible to build broken and overcomplicated crap with ProcessWire, while (and this is at least partly opinion-based) it's not as easy as with certain other platforms. The flexibility of ProcessWire means that even if the previous developer made some pretty horrible choices along the way, it should still be possible to salvage some parts and rewrite others. In the end it's always better to just brace yourself and tell the client that the whole thing needs to be blown into pieces than attempt to forcefully breathe life into a project that's already rotten to it's core, regardless of which system it was built with.1 point
-
on your questions: 1. Many -> http://processwire.com/about/sites/ 2.a) Quick -> http://directory.processwire.com/developers/ b) You'll may found faster a dev but like always in life quantity != quality 3. My personal thought is that a Main dev have to guarantee the quality of changes and build up the roadmap.....there are many contributors (not directly in the github stats but in the issue discussions and as members https://github.com/ryancramerdesign/ProcessWire/network/members ->so only question would be left who or wich group will take over if there was a vacancy of a main dev......for shure there are many talented dev's that are involved... For my thought on point 3 is - nobody can assure such things....this question is like a clients ask "You have to assure me that Wordpress has no security holes...!" regards mr-fan1 point
-
it depends a lot what the content will be; if it is static info, then i would use textarea markup module if it is something that needs to be dynamic, using javascript/ajax, then i might use the textarea markup but have some custom admin jquery that can read other values/fields and change the content of the text area. for php generated stuff i don't know how to insert it between other fields, using the module code, but there might be a way... you could always put it at the top and then move it with jQuery1 point
-
Here's mine: site/assets/cache site/assets/sessions site/assets/logs site/assets/files site/config-dev.php1 point
-
1 point
-
Very nice module - I quite like the idea, and it looks to be very well implemented. Kudos!1 point
-
You could use one Field for downloads where you could upload several files and add tags them like "english", "german", etc.1 point
-
You can use a pageArray method instead of exploding things: if ( $pages->get('template=home')->featured_items->has($project) ) I actually showed this to you not that long ago https://processwire.com/talk/topic/10440-checking-array-for-a-value-might-be-more-php-question-than-pw-sorry/?p=987861 point
-
Technically yes, an interface forces you to implement the public methods in your class. It's like a "contract" that describes the public API of all classes implementing it. However, I just noticed that all the methods in the module interface are commented out. So you're not required to implement the init() method, if you don't need it. Cheers1 point
-
FCM release 0.5.0 (no documentation at the moment... sorry!) requires FormHelper add / edit pages default sanitizer based on field type (textarea or text) if no sanitizer is set to the field skip fields optional use admin form styles file / image upload during page add (check input, page pre-save, set field values and add files and again save the page...) usage / example // load FCM $fcm = $modules->get('FrontendContentManager'); // ADD a page to given parent with parent template $output = $fcm->renderAdd($parentPage); // or EDIT given page $output = $fcm->renderEdit($pageToEdit); // echo jsConfig inside the html head element echo $fcm->JsConfig(); // outpunt needed scripts for inputfield modules, ... inside your html head element foreach ($config->styles as $file) { echo "<link type='text/css' href='$file' rel='stylesheet' />\n"; } foreach ($config->scripts as $file) { echo "<script type='text/javascript' src='$file'></script>\n"; } // echo $output inside your template / html body element echo $output; PW module repo: http://modules.processwire.com/modules/frontend-content-manager GIT repo: https://bitbucket.org/pwFoo/frontendcontentmanager/src/1 point
-
While testing your module I found out that it doesn't work properly in some cases: //no need to obfuscate, since there is no E-Mail Adress <a href="mailto:?subject=Lorem%20Ipsum&body=Lorem%20Ipsum!">Foo</a> <a href="mailto:?subject=Lorem Ipsum!">Foo</a> //doesn't work with the following examples <a href="mailto:mail@example.org?subject=Lorem Ipsum!">Foo</a> <a href="mailto:mail@example.org?subject=Lorem%20Ipsum&body=Lorem%20Ipsum!">Foo</a> For the 1st Example the module should leave the code untouched. Replacement only necessary if '@' is found. For 2nd Example I can offer a solution REPLACE // urlencode a possible subject $matches[1] = preg_replace_callback("!(.*\?(subject|body)=)([^\?]*)!i", function ($m) { return rawurlencode($m[3]); }, $matches[1]); // the function removes the questionmark, the words 'subject' and 'body' and the equalsign from the querystring WITH // urlencode a possible subject and body, no matter if already urlencoded $_matches = preg_replace_callback("!(^\?*)?((\??subject|\??body)=([^&]+)){1,2}!i", function ($m) { return $m[1].$m[3].'='.rawurlencode(rawurldecode($m[4])); }, $matches[1]); I tested a little bit and it worked well with my solution.1 point