Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/31/2015 in all areas

  1. You are getting the general field itself, not the field in that page. Try this instead: $other_page = $pages->get("selector_for_the_page"); $other_page->setOutputFormatting(false); $other_page->bestelnummer = $other_page->bestelnummer++; $other_page->save('bestelnummer'); To understand the second line check this: http://cheatsheet.processwire.com/page/built-in-methods-reference/page-setoutputformatting-true-false/
    3 points
  2. Conditional hide / remove fields from form, advanced processing is done in the RegisterEmailValidation plugin. Password field was removed before the form will be rendered. https://bitbucket.org/pwFoo/frontenduser/src/71207f581585ac6e089b47790eadbf3bdbedd5a9/FrontendUser/FrontendUserRegisterEmailValidation.module?at=master#FrontendUserRegisterEmailValidation.module-155 But it's a required field, so required have to be changed to false before form process. https://bitbucket.org/pwFoo/frontenduser/src/71207f581585ac6e089b47790eadbf3bdbedd5a9/FrontendUser/FrontendUserRegisterEmailValidation.module?at=master#FrontendUserRegisterEmailValidation.module-65 It should be also possible to skip the username field. $fu->register(array('email', 'password')); It isn't required by the module, but the you have to set the needed attributes before you call ___save($user). $user is a PW User object. So a pre-save hook (like used with additional nickname plugin) should work for you. $fu->addHookBefore('save', function($event) { $form = wire('fu')->form; if(!count($form->getErrors())) { wire('fu')->userObj->nickname = $form->fhValue('username', 'text'); } }); Just change it to wire('fu')->userObj->username = ...
    2 points
  3. If it's not a huge overhead for your script, you can just bootstrap the processwire installation. You can find the documentation here: https://processwire.com/api/include/
    2 points
  4. In PhpStorm you can get autocompletion and typehinting for wire function calls if you add a file with the following content somewhere to your project. Jetbrains suggests naming this file '.phpstorm.meta.php' and adding it to the root of your project, but it should work anywhere else too. I had to re-open the project after adding the file. <?php /** * ProcessWire PhpStorm Meta * * This file is not a CODE, it makes no sense and won't run or validate * Its AST serves PhpStorm IDE as DATA source to make advanced type inference decisions. * * @see https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata */ namespace PHPSTORM_META { $STATIC_METHOD_TYPES = [ \wire('') => [ '' == '@', 'config' instanceof Config, 'wire' instanceof ProcessWire, 'log' instanceof WireLog, 'notices' instanceof Notices, 'sanitizer' instanceof \Sanitizer, 'database' instanceof \WireDatabasePDO, 'db' instanceof \DatabaseMysqli, 'cache' instanceof \MarkupCache, 'modules' instanceof \Modules, 'procache' instanceof \ProCache, 'fieldtypes' instanceof \Fieldtypes, 'fields' instanceof \Fields, 'fieldgroups' instanceof \Fieldgroups, 'templates' instanceof \Templates, 'pages' instanceof \Pages, 'permissions' instanceof \ Permissions, 'roles' instanceof \Roles, 'users' instanceof \Users, 'user' instanceof \User, 'session' instanceof \Session, 'input' instanceof \WireInput, 'languages' instanceof \Languages, 'page' instanceof \Page, ] ]; }
    1 point
  5. FrontendUser The FrontendUser module provides a frontend login, logout and user registration functionality. Features See module documentation for details. login with error handling and value sanitizing Plugin: ProcessForgotPassword core module integration Plugin: LoginPersist module integration user registration with username and email address already in use check email adress pre-register validation (email verification) Extendable with additional fields and by PW hooks forms generated by PW form api Custom style / script Requirements FormHelper (0.7.1+) Usage Documentation / examples Repository PW module repo GIT repo ToDo / Issues Issues I hope it will be helpful to the community and I would be glad to get feedback or suggestions for improvement!
    1 point
  6. You can enable debug mode in the site/config.php to get more information on errors.
    1 point
  7. Threaded views can be quite simply done by recursive functions, as you can see in the renderNav function that's part of the default installation profile in pw. If that's not sufficient than you've only the option to copy the whole module or ask ryan to add the necessary hooks.
    1 point
  8. How about the "Optional: Generating your own output" variant outlined here: http://processwire.com/api/fieldtypes/comments/?
    1 point
  9. Ah yes!! Thank you Very much I Tried maybe 15 different things next to my code at the top here, But I never applied OutputFormatting, so i kept getting the error. Thanks!
    1 point
  10. Have a read of this page: http://processwire.com/docs/security/file-permissions/ It tells you what parts of your site should have what permissions. chmod and chown are the commands you are looking for, but depending on your website you can probably adjust these through some sort of graphical user interface as well.
    1 point
  11. The simplest solution I see: Create a template file content_block.php Create a folder in your /site/templates/ folder called content-blocks Put in all content blocks you want (can be just .text or .PHP, whatever you wish) Download and install: FieldtypeSelectFile, give it a name. Go to templates add new template with the field you just created, name it content_block. Set the setting of the field to the folder content-blocks Check the Change Page Template setting. Create for every content block a page with the content_block template. Select in every page the block you want to render. Then the magic: // name of the content block template. $blocks = $pages->find("template=content_block"); foreach ($blocks as $block) { echo $block->render(); } Or you can make a pagefield (multiple) allowing al pages with template content_block.
    1 point
  12. Here's a simple way to add autocomplete and 'tags' to your tags field, using admin custom files; you would first need to have admin custom files running and enabled for page edit. this example uses Tag-it! because it stores the tags in a way that seems to work with PW's field (note this is still proof of concept and being tested, but works so far); http://aehlke.github.io/tag-it/ 1.) add the tag-it.min.js to your admin custom files or paste it directly into your ProcessPageEdit.js file. 2.) paste in the CSS into your ProcessPageEdit.css file 3.) Initialize the tags after the plugin, in your ProcessPageEdit.js $(function(){ $(".Inputfield_images input[name^='tags_images_']").each(function() { $(this).tagit({ availableTags: ["kenburns", "test"], singleFieldDelimiter: ' ' }); }); }); you can set it up so that you initialize the field based on it's name and then set your tags with the availableTags option. the CSS needs to be adjusted to be compatible with the jqueryui settings used by PW admin; this is my current CSS, but needs some work still (though it works): ul.tagit { /* padding: 1px 5px; */ padding: 7px 5px; overflow: auto; margin-left: inherit; /* usually we don't want the regular ul margins. */ margin-right: inherit; border-top: 1px #ccc solid; } ul.tagit li { display: block; float: left; margin: 2px 5px 2px 0; } ul.tagit li.tagit-choice { position: relative; line-height: inherit; background: #BBCEF1 !important; } ul.tagit li span { color: black !important; } a.tagit-close { /* background: #eee; */ } input.tagit-hidden-field { display: none; } ul.tagit li.tagit-choice-read-only { padding: .2em .5em .2em .5em; } ul.tagit li.tagit-choice-editable { padding: .2em 18px .2em .5em; } ul.tagit li.tagit-new { /* padding: .25em 4px .25em 0; */ padding: 0; } ul.tagit li.tagit-choice a.tagit-label { cursor: pointer; text-decoration: none; } ul.tagit li.tagit-choice .tagit-close { cursor: pointer; position: absolute; right: .1em; top: 50%; margin-top: -8px; line-height: 17px; } /* used for some custom themes that don't need image icons */ ul.tagit li.tagit-choice .tagit-close .text-icon { display: none; } ul.tagit li.tagit-choice input { display: block; float: left; margin: 2px 5px 2px 0; } ul.tagit input[type="text"] { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; border: none; margin: 0; padding: 0; width: inherit; background-color: inherit; outline: none; } there are a few other good tagging plugins for jquery and i've been gradually testing them and trying them out; but for simple needs, this example may be pretty workable. One other caveat - since the plugin initializes on the field and modifies the way it looks, it will trigger the changed field, and consequently ask you if you want to save the page, on exit, even if you didn't change any fields on the page... *plugin init edited to change the stored tag delimiter for PW image tags field
    1 point
  13. Sure! I'm definetly going to write about it in a future blog post. It's my first project using Vue.js and I was very impressed with its potential, however the community is still quite small, so I had to figure out many things just by myself, especially regarding the implementation of sub-components, nevertheless I'm happy with the result. I'm planning to use it again in the future. Also thanks everyone for the warm welcome and positive reactions.
    1 point
  14. For some cases, it's a matter of preference. What's also cool about the inheritance route, is that you can use type hinting in your methods and functions. It makes the code more readable and also protects from errors. Also there is always some overhead (even though very small) when you are executing hooked methods. As you already noticed, you can use conditional hooks. And you can of course check the template of the Page in question inside the hook as well. Anyway, I would go with inheritance in your case. First and foremost because you don't need any autoloading modules, and you never have to wonder 'where the heck did I put that hook'. In my opinion it makes your application more manageable.
    1 point
  15. Ah, got it working. See instructions here: http://ckeditor.com/ckeditor_4.3_beta/samples/replacebyclass.html The textarea also needs the class 'ckeditor'
    1 point
  16. I found that downloading ckeditor and implementing it was way easyer, Download from here: http://ckeditor.com/download Include ckeditor.js on website along with jquery plugin. <?php echo '<script src="'.$config->urls->templates.'js/ckeditor/ckeditor.js"></script>'; echo '<script src="'.$config->urls->templates.'js/ckeditor/adapters/jquery.js"></script>'; ?> enable plugin for textarea with id selector in your js file function enableCkeditor() { $( 'textarea#editor1' ).ckeditor(); }; and woop it works http://hate.it/add-hate/ you need to be loged in to see form tho . Hope it helps someone
    1 point
  17. The $page's next and prev functions return the next and previous sibling, according to whatever sort settings you have defined with the parent. However, you could still do it like this: $siblings = $page->siblings("sort=date"); // or whatever you want to sort by $next = $siblings->getNext($page); $prev = $siblings->getPrev($page); if($prev) echo "<a href='$prev->url'>Prev</a> "; if($next) echo "<a href='$next->url'>Next</a> "; Personally, I prefer using regular pagination to something like this. The skyscrapers profile has some good examples of using pagination with custom sorts.
    1 point
×
×
  • Create New...