Jump to content

kixe

Members
  • Posts

    803
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by kixe

  1. If you want to save a pagefield value to the database you need to set outputformatting false, otherwise the value is only valid during runtime. http://processwire.com/api/ref/page/of/ In your case: $event->of(false); This should work: $event->of(false); foreach ( $event->event_data as $ed ) { if ( $signup_id != 0 ) $ed->signup_id = $signup_id; } $event->save('event_data');
  2. @horst Thanks for your feedback and suggestions (I like them all). I pushed an update to github (Version 113) I made this very quickly. It seems to work, but I hadn't time to try out all scenarios. Could you test a bit? Thanks. Version 1.1.3 NEW: user logout triggers cronjob (db-backup permission required) instead of cycle interval. NEW: extension of filename options (user properties) NEW: custom fileinfo (via module settings). Same features like filename (hookable)
  3. kixe

    Form

    Sanitizer removes linefeeds. Allow multiline in the options array. This one should work: $message = $sanitizer->textarea($form->get("message")->value, array('multiLine' => true)); // or $message = $sanitizer->textarea($input->post->message, array('multiLine' => true));
  4. If your image field is named 'image' use the following api: // single image field $page->image->url $page->image->description //multi image field $page->image->first()->url $page->image->last()->url $page->image->eq(5)->url // your example $content = "<p><img src='{$page->image->url}' alt='{$page->image->description}' ></p>"; 1 ARROW: use curled brackets OR paste as is between double quotes 2 ARROWS and more: you need to use curled brackets, as I did in the example with the image $content = "<article><h2>$page->body</h2>"; Please read some tutorials and informations in the docs, before going further https://processwire.com/api/templates/ https://processwire.com/docs/tutorials/default-site-profile/ https://processwire.com/docs/tutorials/simple-website-tutorials/
  5. Jumplinks is your friend http://modules.processwire.com/modules/process-jumplinks/ use wildcards to define the redirect: SOURCE: /home/business-directory/* DESTINATION: /home/business-directory/
  6. I counted them all: 1kb = 8192 bits
  7. Under the Input Tab of the fieldsettings of your CKEditor Field you have an option to modify 'Extra allowed Content'. As an example, put in here the string img[!src,class,alt,width,height] and save settings. Now you can modify the listet attributes of the image tag in the 'source' dialog of the CKEditor field. But you need to modify it for each input. Was it this, you have been looking for? I f you want to use a normal Textarea Input use the textformatters Adrian recommended. Additionally I recommend Diogos Image Textformatters: http://modules.processwire.com/modules/textformatter-image-tags/ http://modules.processwire.com/modules/textformatter-image-field-markup/ a great and highly configurable textformatter is Ryans Hanna Code Textformatter http://modules.processwire.com/modules/process-hanna-code/ and finally mine: http://modules.processwire.com/modules/textformatter-page-images/ Very simple to insert images with tags. The output markup, wrapping the image tag, is configurable in the textformatter module settings.
  8. I have started developing a new Fieldtype. This Fieldtype provides a CTA Button for the frontend. The fieldtype stores 3 values for 'label' (multilanguage), 'target', and 'class' (CSS). Output Markup can be edited in the Fieldsettings. Enter Page id or path in the target field to store an internal page. If page exist the Field will show up the path in current user language and Page ID as well. If you type in a numeric string which is not similar to any pages id, the inputfield will throw an error. Any other string will be stored as is. If target is an internal page any page field value or property is accessible. The Inputfield optionally provides an API Description. Please try out: https://github.com/kixe/FieldtypeButton http://modules.processwire.com/modules/fieldtype-button/ Feedback welcome. Screenshots:
  9. Language redirect is a http request of type 301. For security reasons POST data are dropped in this case. https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2
  10. Time ago I needed something similar. I solved it with a small script. You may use it as a starting point: $media = wire('pages')->find('parent=1034,template=medium,include=all'); $media->sort('media_type,status,title'); foreach ($media->getValues() as $key => $medium) { $medium->of(false); $medium->sort = $key; $medium->save(); // var_dump($key.' - '.$medium->sort.' - '.$medium->media_type.' - '.$medium->title); }
  11. Hi Adrian, Nice module. Thanks. I didn't notice it until now. It works properly with my ProcessSetupPageName Module. One wish: It would be great to have an option (checkbox) to switch from blacklisting to whitelisting for templates. Meaning switching from 'Exclude Templates' to 'Include Templates' from actions of the module.
  12. Another solution // number of news per news page $limit = 20; // get all news $allNews = $pages->find("template=news"); // get the specific news item $selector = // selectorstring to get specific news item $specificNews = $allNews->get($selector); // get the page number where to find the specific news item $key = $allNews->getItemKey($specificNews); $pageNum = ceil($key/ $limit);
  13. After digging a while I found out it has to do with namespace. "is_callable() doesn't seem able to resolve namespaces. If you're passing a string, then the string has to include the function's full namespace." found here: php.net/manual/en/function.is-callable.php#107105 $featured->each('\ProcessWire\preparePost'); // works $featured->each(__NAMESPACE__.'\preparePost'); // works $featured->each('preparePost'); // works ONLY if no namespace is declared I posted an issue on github: https://github.com/ryancramerdesign/ProcessWire/issues/1869
  14. I have a function with one single parameter ($page). The function sets a page property and return nothing. If I call the function in 2 different ways, one works, the other one not. function preparePost($item) { $item->set('foo','bar'); } $featured = $pages->find($selectorstring); $featured->each('preparePost'); // doesn't work var_dump($featured->each('foo')); /** doesn't work, return * array (size=2) * 0 => null * 1 => null */ foreach ($featured as $item) preparePost($item); // works var_dump($featured->each('foo')); /** works, return * array (size=2) * 0 => string 'bar' (length=3) * 1 => string 'bar' (length=3) */ Any ideas?
  15. Well done. Thanks. I like the lines and words counter. But it shows up only if I start to edit. Same to the included spellcheck. Is there an option to disable spellcheck? In generally I like Markdown much more than CKEditor, because its more save to prevent Layoutkilling by Customers. Great compromise between both!
  16. @Macrura Thanks for pointing this out. I couldn't find a documentation, about toolbar items available within processwire. I tried all of the CKEditor fullpackage and all items are usable. Here a complete list: Source, Save,NewPage, Preview, Print, Templates Cut, Copy, Paste, PasteText, PasteFromWord, -, Undo, Redo Find, Replace, -, SelectAll, -, Scayt Form, Checkbox, Radio, TextField, Textarea, Select, Button, ImageButton, HiddenField Bold, Italic, Underline, Strike, Subscript, Superscript, -, RemoveFormat NumberedList, BulletedList, -, Outdent, Indent, -, Blockquote, CreateDiv, -, JustifyLeft, JustifyCenter, JustifyRight, JustifyBlock, -, BidiLtr, BidiRtl, Language Link, Unlink, Anchor Image, Flash, Table, HorizontalRule, Smiley, SpecialChar, PageBreak, Iframe Styles, Format, Font, FontSize TextColor, BGColor Maximize, ShowBlocks About
  17. This option is not included in core. 4 steps to get this option: Download CK Editor Plugin from here: http://ckeditor.com/addon/colorbutton Place the plugin-folder in /site/modules/InputfieldCKEditor/plugins/colorbutton/ Enable Plugin in Fieldsettings of the TextareaField under the Input Tab -> Plugins (checkbox) Add 'TextColor' to the CKEditor Toolbar This procedure is similar to any other plugin you want to use. Edit: Thanks Macrura (next post)
  18. @Robin S Thanks for pointing this out. This note is obsolete. I missed to remove it from earlier versions. The cronjob is triggered by every user.
  19. Example: The website example.org is a multilanguage site with english as default language and german as second available language. The Name of the root page is 'en' for default language and 'de' for german. If I want to redirect a not existing url to the new page with ID: 1234 and url '/en/archive/' I create a jumplink and type in '/en/archive/' as the target the system detects the page and stores: 'page:1234' Redirect will target as expected to '/en/archive/'. If I want to redirect to the page with ID: 1234 in the german version with url '/de/archiv/' I create a jumplink and type in '/de/archiv/' as the target the system detects the page and stores: 'page:1234' too. Redirect will target to '/en/archive/' and NOT to '/de/archiv/'. To force a redirect to the german version I found a workaround by adding the questionmark (querystring) to the url. In this case the system doesn't detect the page and will store the path instead of the ID. Redirect will happen once and as expected.
  20. After playing around a bit I found the following workaround to force language specific redirects: If you set the destination path to your language specific page the system will detect the related page and store the page as the target. If you add a questionmark (introducing a querystring) at the end of the destination path jumplinks will leave the path as is and redirect will happen as expected. This is not needed for redirects to the homepage. Better solution would be to implement language specific targeting to the module. +1 to the wishlist from my side.
  21. New Page View Options (Modal, Panel) in 3.0.15 makes edit button obsolete http://processwire.com/blog/posts/pw-3.0.15/
  22. As I said use built in options in this case. Read more here: https://processwire.com/api/modules/process-template/ To create contentblocks you can also use Repeaters (single template). Or better ProFields RepeaterMatrix (multiple templates). Repeaters are stored as pages too but very hidden and you don't need to care about naming.
  23. Try this http://modules.processwire.com/modules/process-setup-page-name/ https://processwire.com/talk/topic/8576-name-format-children/?p=117333
  24. In fact the page is already created in the 'middle of the process' and it has to be created to pull the page name from other page fields. If you don't like this. Create a cronjob like bernhard mentioned. Example: $wire->addHook('LazyCron::everyDay', function() { // trash untitled pages $delay = time()-60; $untitleds = wire('pages')->find("created<$delay,name^=untitled,include=all"); foreach ($untitleds as $untitled) $untitled->trash(); // to delete permanently use $untitled->delete() instead }); In this case you don't need this module. Use built in 'Name Format Children' in parent template settings and create the name frome date. It is also possible in my module to create the name from any autogenerated page property like 'created' or 'id'. Read the note in 'Name Format Children' field if module is installed. This message is needed. How could the page editor know from where the values are pulled to generate the pagename? I don't want to change this.
  25. To complete Adrians answer, the ProcessForgotPassword.module tries to determine the 'from' Email address in 3 steps (fallback) from the Modules settings, like Adrian described from config.php $config->adminEmail = info@example.org; construction of an Email address based on $config->httpHost like: $from = 'processwire@' . $config->httpHost; This happend in your example.
×
×
  • Create New...