Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/14/2016 in all areas

  1. Not a bug, it just how it is. The 1 page is forced by the Inputfield, not the Fieldtype.
    3 points
  2. I don't see where you set: $field->derefAsPage == FieldtypePage::derefAsPageOrNullPage; When you don't set it it will store as a PageArray.
    3 points
  3. Hey Peter, I got a few up and running. Not really difficult, just make sure the domains are pointing to the same server and directory. Your questions: 1. See below for screens. 2. Unfortunately you can't share users across multiple domains by default. You need an Single Sign On service to share (front-end) users. 3. Depending on how you create your set-up you can easily deploy another site. In the set-up below the logo and content are different. We are going to add 4-5 sites when the first two are ready. Note: I'm using multi-site by apeisa (and later soma). I saw that soma recently updated some stuff to handle 404. I use a module for the different 404 pages. Also be sure to create two form-builder pages since the first one can't be shared. This might be different in soma's newest version. Screenshots: Tree Module configuration Name setup of the new homepage
    2 points
  4. Correct Syntax for Fieldtype Select Options $optionsfield // return id (string) $optionsfield->id; // return id (int) $optionsfield->title; // return string USE THIS or $optionsfield->value; // return empty string or value (if your option settings like '1=value|title') // dot syntax in selector string $pages->find('optionsfield.id=2'); Docs: https://processwire....tions-on-a-page or https://processwire....d-on-selections @BitPoet $page->manufacturer return id as a string, NOT the title!
    2 points
  5. @adrianmak, is it just a copy&paste mistake that your code accesses $category while you set outputFormatting to false on $page? @gebeer: Additionally, there are two other methods to get a page field's value in another language (with the first one being my favorite): // 1. Directly from the page: $title_en = $category->getLanguageValue($eng, 'title'); // 2. A bit more circumspect: $titleField = $category->getUnformatted('title'); $title_en = $titleField->getLanguageValue($eng);
    2 points
  6. Wire Mail SMTP An extension to the (new) WireMail base class that uses SMTP-transport This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times. The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only). Here are Ryans announcement. Current Version 0.8.0 (from 2024-09-25 -- initial version 0.0.1 was pushed on 2014-03-01) Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md Downlod: get it from the Modules Directory || fetch it from Github || or use the module-installer in PWs admin site modules panel with its class name "WireMailSmtp". Install and Configure Download the module into your site/modules/ directory and install it. In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature. You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts. Usage Examples The simplest way to use it: $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient. You may also use the object oriented style: $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire: $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients. $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array: $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working: $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; } A MORE ADVANCED DEBUG METHOD! You can add some debug code into a template file and call a page with it: $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage. The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one: Following are a ... List of all options and features testConnection () - returns true on success, false on failures sendSingle ( true | false ) - default is false sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+) to ($recipients) - one emailaddress or array with multiple emailaddresses cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses bcc ($recipients) - one emailaddress or array with multiple emailaddresses from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest dispositionNotification () or notification () - request a Disposition Notification subject ($subject) - subject of the message body ($textBody) - use this one alone to create and send plainText emailmessages bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback) addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here (only available if a signature is defined in the config screen) attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename send () - send the message(s) and return number of successful sent messages debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!) getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses, logActivity ($logmessage) - you may log success if you want logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here sentLogReset () - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter sentLogGet () - is called automaticly within the send() method - returns an array containing all previously used emailaddresses sentLogAdd ($emailaddress) - is called automaticly within the send() method Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
    1 point
  7. Possible UI/UX improvement. Quite often I work with large amounts of fields and templates grouped by various tags. It would be nice to show these tags as the second menu level, and add a third with the actual fields and templates grouped. Perhaps this could be a $config option? The dropdown menu for fields can extended page height which is hard to scan read, and select the appropriate field / template sometimes.
    1 point
  8. This week we've been focused on one of the major 3.x roadmap items, which is to have strong Composer support in ProcessWire. In this post, we now have an outlined process and a full proof-of-concept module built to demonstrate it all, plus info on how other module authors can support Composer as an alternative installation method. To add to that, we get into Google's Client API with a new 3.x specific module and how to connect Google's Calendar services with ProcessWire. https://processwire.com/blog/posts/composer-google-calendars-and-processwire/
    1 point
  9. Both "manufacturer=$optiontitle" and "manufacturer.title=$optiontitle" should work, unless you have separate values/titles configured and want to search for the value, then "manufacturer.value=$optionvalue" is the way to go. Both .value and .title support text matching.
    1 point
  10. I sent two pull requests: TemplateEngineTwig: adds setMultiple and latest twig version using composer TemplateEngineFactory: adds setMultiple and renderChunk methods Example: How to use a chunk In template file: /site/templates/view/template.twig <?php foreach ($nav_pages as $p): ?> <?php $page->renderChunk('chunks/nav-item', array('page' => $p)); ?> <?php endforeach; ?> /site/templates/chunks/nav-item.php <?php namespace ProcessWire; $foo = 'do some logic // something with the contextual data'; $author = $this->page->createdUser; $view->setMultiple( array( 'author' => $author, 'item' => $this->page, 'foo' => $foo )); /site/templates/view/chunks/nav-item.tpl Author: <?= $author ?> <br /> <a href="<?= $item->url ?>" title="<?= $foo ?>"> <?= $item->title ?> </a>
    1 point
  11. Inputfield dependencies work with the html inputfields, which aren't filled for file fields, because of it's long time ajaxy nature. Afaik there's currently no way to archive what you need.
    1 point
  12. Your approach will not work. If you want to go on with repeaters you have to use nested repeaters. Other options: Page/ PageTabel Field or ProFields Matrix. More Information about nested repeaters and ProFields Matrix here: https://processwire.com/blog/posts/more-repeaters-repeater-matrix-and-new-field-rendering/ I would do this job with a simple Page or PageTable Field Create some fields (currency, period, percent) Create a template 'rate' and assign the fields above Create some pages (rates) with template 'rate' USD 12m 5% USD 6m 5% EUR 6m 6% Create a Page Field 'rates' and use template 'rate' for selectable pages Assign this Page Field to the 'loan' template.
    1 point
  13. Excellent walk-through on the blog, Ryan! I'm sure this will also broaden PW's appeal outside the current community. However, as a musician, every time I see Composer's logo I cringe...it's a conductor, not a composer FFS! Oh well, close enough for PHP, I guess.
    1 point
  14. Composer is a package manager. If the package is a framework, a library or just a code snippet is not really relevant so much. And here you go about what things to use/do with composer. My goto libraries: Carbon, Nette/Forms, kahlan, faker, any of those when needed; As soon as I've more time to put into CI I'll certainly look into using phpdotenv. Probably every third party service integration like Mail / Calender / Paying Gateway should be managed by composer. Any finally if you ever need to use non-php software on your server like redis or elastic-search or others you can find php libraries to use those as well.
    1 point
  15. @Ryan I'd suggest you taking a look into flarum. It's fully installable by composer and does also use composer to install plugins into it's own folder structure.
    1 point
  16. If I've understood the question correctly, the answer is I don't know. But my guess so far is: I'm not sure you'll want Composer for this, as PW is still a system that needs to be installed and connected with a database, etc. Meaning, you can't use PW's API unless you've installed it, and that installation involves a few screens of configuring the DB, creating admin account, etc. Whereas, it seems that most of the things one pulls in with Composer are more PHP library specific. But it's a good question because we are going to be making the ProcessWire core available on Packagist, so it'll be interesting to find out exactly what one would do with it from there because ProcessWire is not something that will run out of a /vendor/ directory or just start working because one of its classes was autoloaded. I suspect we'll have some trial and error and things to discover here as we go through the process.
    1 point
  17. It already does that - or, to be more precise, PW's default behavior takes care of that.
    1 point
  18. I am getting the same error with multi language fields when I use getLanguageValue method. When I use the other approach it is working. Try this $categories = $pages->get(1060)->children(); $language = $user->language; // save the user's language foreach($categories as $category) { $user->language = $languages->get('default'); // you need to use default because English is your default language and set the $user language to it $content .= $category->title; } $user->language = $language; // restore the user's language If you want to show page titles in all languages, just loop through your languages inside the foreach: foreach($categories as $category) { foreach ($languages as $lang) { $user->language = $lang; $content .= $category->title; } }
    1 point
  19. Sounds useful, I will take a look at it. I think it should already be possible as you can load any ProcessWire template and render it, e.g. Edit: Actually I think the code won't work as the hook to modify the rendered output is attached to Page::render(). It should be possible to move the hook to TemplateFile::render() $chunk = new TemplateFile($config->paths->templates . 'intro.php'); $chunk->foo = 'bar'; // Can be forwarded to Twig in intro.php $chunk->render(); // This should return the output of the intro.twig template file But I never tried it, so not 100% sure it works. A little wrapper on the module class wouldn't hurt though, e.g. $factory->loadController('intro.php'). Perfect, please send a pull request (target dev branch) I'll update ProcessWire and Smarty engines and notify the author of Jade as well. Nice, please send Do you see any benefit in having multiple Twig versions available to choose from? Cheers
    1 point
  20. Hi Guys I really like the Form API of Processwire, it is really flexible. You can build from a simple contact form until to a complex registration form in a short time without using HTML. The only "flaw" which I encountered is. The bigger the form is, the bigger the code gets and this can be frustrating when you are building forms with more than 20 Inputfields. The code gets longer and readability gets lost over the time since it is a (almost)self repeating process of "codeblocks" where the structure is almost always the same. So I decided to write up a simple class to "minify" the code when building forms with the form API. How does the class work? It is a very simply class where you create a new (didn't know how to name the class ^^)ProcessForm Object and get the InputfieldForm Object with the getFormObject() function. Now you can call the addInputfield() function to create any kind(not are all supported, only the simple ones) of Inputfield. And at the end you can render the ProcessForm object which basically calls the render() function of the InputfieldForm class. <?php $form = new ProcessForm("./contact", "post", "contactform"); //default ("./", "post", "ProcessForm") $form->addInput(array( 'type' => "InputfieldText", 'label' => "First Name", 'attributes' => array('id' => "firstname", 'name' => "firstname"), 'required' => 1 )); $form->addInput(array( 'type' => "InputfieldRadios", 'label' => "To much code for a simple Form?", 'options' => array('yes' => "Yes, absolutely", 'no' => "No, absolutely not"), 'attributes' => array('id' => "tomuchcode", 'name' => "tomuchcode"), 'required' => 1 )); $form->render(); ?> Is this usefull? Honestly said, I don't know if this is usefull for you. It is usefull for me, since I can "minify" or have a better overview/readability over my code. PS: I am still learning PHP OOP, so dont hate me when my "oop skills" are too low. I'am very open to better approaches, tipps, suggestions to improve this class or go antoher way to manage the big amount of code when building big forms with API. PPS: The class isn't tested very well(or better said it isn't tested at all ^^) since I am to lazy to do tests. So don't use this in commercial projects(but when you want still using it commercial it is at your own risk ^^). The code is on Github Greetings Orkun aka "Nukro"
    1 point
  21. If you only want to allow one page you should also configure to only allow single page. Currently you have a single select but the field is multiple.
    1 point
  22. I think this is good idea. Personally I have a number of module ideas but have no firm idea what to prioritise. Something like this would be of benefit to me. As for a calendar module, I have been working on something for a while now. These are very old screenshots and will change. The module was based on dhtmlxScheduler but that will definitely change. Maybe I should release this module next
    1 point
  23. Hello saboor, Please don't update /wire/config.php. Update /site/config.php where you can add things found in /wire/config.php and modify them. You won't have to bother about the /wire/ folder upgrade.
    1 point
  24. Welcome to the forum saboor, You might be interested in a few tips you can find in the forum, like this one: https://processwire.com/talk/topic/12431-moving-site-to-another-server Or the docs: http://processwire.com/docs/security/migration/ http://processwire.com/docs/security/file-permissions/ You might want to do a google search like this one: site:processwire.com/talk moving Anyway, what sort of error messages (PHP, Apache, etc..) do you get? You might want to use $config->debug = true; in config.php. By "procash", do you mean ProCache? ProCache is not required at all. As the name implies, it is for those who need some serious caching for the otherwise fast ProcessWire.
    1 point
  25. For those interested, I've released a new prerelease and dropped the PHP 5.5.0 requirement. I've also added a few features and will be creating a forum thread soon.
    1 point
  26. Updated and fixed Russian Language Pack. Completed translation main part of the administrative panel. Add Translation for some popular modules like Markup SEO PW-PW-LanguagePack-ru-RU-master.zip
    1 point
  27. UPDATE: Fortunately, I have traced the problem. (I recalled having a similar problem on MODx a few years back) ALL of the pages which I created on local XAMPP install and migrated to the live site would throw a 403 Forbidden on save as well as pages which had content that matched the ModSecurity filters/ rules on the server. It does not like the brackets <> I guess. The pages I created on the live site had fields which were to have HTML code but were left empty, hence no error was thrown and the page was saved gracefully. Error log below: [sat Jan 17 13:13:33 2015] [error] [client xxx.xxx.xxx.xxx] ModSecurity: Access denied with code 403 (phase 2). Pattern match "(< ?(?:script|about|applet|activex|chrome).*(?:script|about|applet|activex|chrome) ?>|> ?< ?(img ?src|a ?href) ?= ?(ht|f)tps?:/|" ?> ?<|" ?[a-z]+ ?<.*>|> ?"? ?(>|<)|< ?/?i?frame|\\%env)" ... [uri "/xxxx/page/edit/"] I have a few text fields which are supposed to accept HTML code and output it as is but my host does not like it being saved to the database un-escaped. This issue has been traced and is fixed for now by revisiting the template files PHP code and outputting the data some other way OR manually editing ALL offending entries in the database.....hmph BTW, my host uses HSPHERE/PARALLELS and hides its Apache version
    1 point
×
×
  • Create New...