Leaderboard
Popular Content
Showing content with the highest reputation on 03/30/2016 in all areas
-
as an update to this topic, after discovering the awesome power of Selectize.js, i have been able to implement really good tagging on the image fields which works much better than the technique discussed earlier in this topic. 1) place the selectize files somewhere in your templates folder http://selectize.github.io/selectize.js/ (i have placed them in a 'plugins' folder) 2) make the files load on page edit, from your AdminCustomFiles settings: ProcessPageEdit plugins/selectize/dist/css/selectize.legacy.css ProcessPageEdit plugins/selectize/dist/js/standalone/selectize.min.js 3) in your ProcessPageEdit.js file, init the plugin: /** * Selectize * ============================================ * init selectize tagging on field called images * */ $(function(){ $(".Inputfield_images input[name^='tags_images_']").each(function() { $(this).selectize({ delimiter: ' ', persist: false, plugins: ['remove_button','drag_drop'], options: [ {value: 'tag1', text: 'tag1 - use this for blah'}, {value: 'tag2', text: 'tag2 - this will do blah'}, {value: 'tag3', text: 'tag3 - a super special tag!!'}, ], create: function(input) { return { value: input, text: input } } }); }); }); Now you have a really good tagging interface: Notice how you can also add explanatory info right into the tag, but keep the tag value whatever you want; there are a lot of other options you can implement, check out the selectize docs. this is really now one feature that i believe should be included in the core or at least made into a module... first an inputfield/fieldtype single/multi select based on selectize which can improve selections when you have a lot of additional data to show about the individual select options; second would be to enable selectize.js on any image tag field and be able to define the option value/labels based globally or based on current template...8 points
-
4 points
-
Is there a way to contribute to the documentation or cheatsheet? I know, that the heavy users probably will now use kongondos apigen documentation or look at the core files themselves. But I think most users will first look at the documentation or cheatsheet. Often when I go through Ryans older blog posts, I find nice methods, that are nowhere else documented. Here are two examples: New $pageimage->maxSize($width, $height) method What's new in the core this week? New API syntax options! Those two examples can't be found neither in the documentation nor the cheatsheet. Also they can't be found through the site search and are hard to find through the Google Search. I wouldn't consider myself being capable writing the documentation, but I would like to post when I find something is missing. Should I do this in this forum or is there a form/mail address I can contact?3 points
-
The owner of the site is a professional photographer, who needs to show (his) images at its best. And I suppose that his main clients are agencies / artdirectors who uses 30" monitors. Any regular "webimageshrinkingtool" is counterproductive here, I believe.3 points
-
@Christophe, I'm more woried about the margin-right: -.25em they are using on columns. They use it to eliminate the white-space between the columns. But when you properly minify the source, there's no white-space, so little gaps will show up.3 points
-
For images in an images field, you can create any sizes you need via PW's native resizing methods. For images inside an RTE field you can use a textformatter module. The idea would be to detect images in the RTE block and replace them with your own custom srcset markup. The Image Interceptor module is a good one to look at if you want to get ideas for a custom module. But there is already the TextformatterImageSRCSET module ready to go. And also check out the ImageToPicture module.3 points
-
Are these names for real? Saying that the 'settings are OK ' isn't very helpful I am afraid . OK in what sense? OK for your ProcessWire install? Something else? There is nothing like WP or ProcessWire FTP . What I think the hosting provider was telling you is to activate your FTP account and, because many FTP programmes have features that allow you to change file permissions (maybe even ownership? not sure), to use such an FTP programme to change your file/folder permissions. Like @horst intimated, your problem is most likely one of ownership. Have a read here about file permissions and ownership. How did you install ProcessWire on that server? Are you able to install modules just fine?3 points
-
Hello everyone, I always wanted to try out an ajax autocomplete search function, but never knew where to start. Of course there is the Ajax Page Search module by soma, but it seems that it was build around the basic site profile. In my case I wanted something more custom and I discovered in this thread the jQuery Plugin Typeahead by RunningCoder, which seemed to be nice. After many hours figuring out, how to combine this Plugin with ProcessWire, I finally got it implemented and want to share my solution with anyone, who also struggles with this topic. 1. Set-Up Typeahead Download the Typeahead-Plugin from the website (I prefer via Bower) and include the following scripts and stylesheets in your templates: <html> <head> ... <!-- Optional CSS --> <link rel="stylesheet" href="/vendor/jquery-typeahead/dist/jquery.typeahead.min.css"> <!-- Required JavaScript --> <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> <script src="/vendor/jquery-typeahead/dist/jquery.typeahead.min.js"></script> ... </head> As next step we need the JSON data. 2. Install Pages to JSON To get the necessary data of all pages as JSON, I use the module Pages to JSON, which provides an easy way to output pages as JSON objects. Of course you can achieve this without this module, but I am not very experienced with JSON, so this module was really helpful. After you downloaded and installed the module, you can configure in the module settings page, which fields you want to output. You can select between own and system fields. For my purpose I selected only title and url to be outputted. 3. Output JSON Now, that we have the module configured, we have to output our search suggestions as JSON. I did it in my template file search.php like this: <?php namespace ProcessWire; // Check if ajax request if($config->ajax) { $results = $pages->find("has_parent!=2"); // Find all published pages and save as $results header("Content-type: application/json"); // Set header to JSON echo $results->toJSON(); // Output the results as JSON via the toJSON function } else { // Your own front-end template } To sum up, we search the pages we want as search suggestions and save them in a variable. Then we output them with the toJSON-Function by the Pages to JSON-Module. All of this happens in a Ajax-Request, that is the reason why we check first, if the page is called via an Ajax request. 4. Insert Form We can now embed the HTML form anywhere you want. Either in an header-include or a specific template. Also you can use your own classes, for this example I used the Typeahead-demo-mark-up and extended it a little. <form id="searchform" method="get" action="<?= $pages->get("template=search")->url ?>"> <div class="typeahead__container"> <div class="typeahead__field"> <span class="typeahead__query"> <input id="q" name="q" type="search" placeholder="Search" autocomplete="off"> </span> <span class="typeahead__button"> <button type="submit"> <span class="typeahead__search-icon"></span> </button> </span> </div> </div> </form> The action-attribute in the form-tag is the url of your search-site. This attribute is of course necessary to know where the form redirects you and where the JSON data is located. 5. Initialize Typeahead As last step we have to initialize the Typeahead-plugin jQuery like this: $(document).ready(function() { var actionURL = $('#searchform').attr('action'); // Save form action url in variable $.typeahead({ input: '#q', hint: true, display: ["title"], // Search objects by the title-key source: { url: actionURL // Ajax request to get JSON from the action url }, callback: { // Redirect to url after clicking or pressing enter onClickAfter: function (node, a, item, event) { window.location.href = item.url; // Set window location to site url } } }); }); We save the action url of the form in a variable, then we initialize Typeahead by selecting the input-field inside the form. As the source we can pass the action url and I included the callback, to link the search results with the site urls. Now you should have a nice ajax autocomplete search form, which of course you can further style and configure. I hope I didn't forget anything, but if so, please let me know. Regards, Andreas2 points
-
Thanks. I feel silly now: I should have consulted my Postfix logs. I did: journalctl --since "20 min ago" I noticed: status=bounced (SMTPUTF8 is required, but was not offered by host.. So I did a web search and ran this config command: postconf -e smtputf8_enable=no Now the mail is sent! I had already tested the dumping inside WireMail.php.. I'll leave info about it below for future generations. if($toName) $to = $this->bundleEmailAndName($to, $toName); // bundle to "User Name <user@example.com" die(var_dump($to, $this->subject, $body, $header, $param)); if(@mail($to, $this->subject, $body, $header, $param)) $numSent++; Header was like this: From: user@mysite.com X-Mailer: ProcessWire/WireMail Content-Type: text/plain; charset="utf-8"2 points
-
Template Cache does only improve performance considerably for template calculations with are resource intensive in themselves. Most templates in processwire aren't that and the bulk time needed is rather the php/processwire bootstrap time.2 points
-
ok. got some news on this - i did some very basic tests the tests were performed on my live server, so there are 2 things to mention: 1) if you test your server you may check back if your provider does allow that 2) i had some normal traffic an my vps, so that may has influenced the tests, but it is accurate enough for my purpose test setup: jmeter VPS with 2GB ram and shared cpu website: very basic website, actually just html with not much php/mysql requests period: 60 seconds regarding to my first post i was interested in the performance @ 200 page impressions per minute. results: 200 users, cache OFF 200 users, template cache ON ### ProCache ON ### 200 users 2000 users 5000 users 0% error rate in all tests trying 10.000 users i got some problems (100% cpu load on my local machine, no response from jmeter...) don't know why there is almost no difference between template cache ON/OFF but no time for further investigation on this for the time. i guess it is because it is defacto only a basic html page with no PW fields. as i should have almost only cached requests on my site there should be really no problems as long as i do not get much more than 2000 requests per minute and that is more than 10 times as much as i need2 points
-
Check the name of the repository at GitHub. In this case there's this line right below it: That's a pretty good indication that this particular repository might be a fork In the GitHub workflow if you fork another repository you can send a pull request containing all your changes to the original repository / author. If you've changed the README in the fork, those changes will also be included in the PR. That's one reason not to include indication about this being a fork or anything like that. Of course you can get over this limitation by creating a separate branch for the changes intended for the PR, but that's extra work and most developers are just plain lazy2 points
-
That would be a good practice, but maybe even better having a separate CHANGELOG.md file to log changes. You can also check commit messages to see what has changed, provided that the author included one.2 points
-
2 points
-
2 points
-
Something using WireArray and WireData. You could use it like this, and all WireArray method would be usable like find(selector) , filter(), remove(), sort() etc. Somewhere in an autoload module or in /site/init.php <?php class MySiteConfig extends WireArray{ public function addItem($key, $value){ $item = new WireData(); $item->name = $key; $item->value = $value; $this->add($item); return $this; } public function render($key){ $str = ""; foreach($this->find("name=$key") as $d) $str .= " " . $d->value; $str = trim($str); return $str; } } // create a new "global" $siteConfig template variable $myConfig = new MySiteConfig(); $this->wire("siteConfig", $myConfig); $siteConfig would then be available everywhere. The addItem() would allow to add items to the WireArray with name -> value. In basic-page.php Template file: $siteConfig->addItem("classes", "main")->addItem("classes", "myClassX"); $siteConfig->addItem("classes", "myClassY"); $content .= wireRenderFile("blog"); then in the blog.php partial $siteConfig->addItem("classes", "blog"); ?><div class='blog <?php echo $siteConfig->render("classes"); ?>'> <h1>Blog Test</h1> <?php // example of using WireArray's implode() echo $siteConfig->implode(" ", "value"); // example of filtering items $vars = $siteConfig->find("name=classes, value^=my"); if($vars->count) { foreach($vars as $v) echo " $v->value"; } ?> </div> This would be easy to extend with further helper methods etc. Also in your template site/init.php or templates/_init.php you could create various template variables That is just a fictive example, not sure how practical this is for handling a use case mentioned in this thread.2 points
-
... got lost in crone Here is another one ... cronjob for database backup. All Informations here: github: https://github.com/kixe/CronjobDatabaseBackup PW Modules: http://modules.processwire.com/modules/cronjob-database-backup/1 point
-
This is a new version of Yahoo! Weather module for ProcessWire, old version of the module can be found at this link. The module has been rewritten, new options have been added alongside with caching from the API (Yahoo! API allows 20.000 calls per hour when using free version, so it comes in handy if your site has a lot of page hits). I've also updated icons in the package (you can easily swap them with yours in module icons folder). You can grab the module from the Modules page or directly from Github link. Update 1.0.1 Yahoo changed their forecast API URL (http://xml.weather.yahoo.com/ instead http://weather. yahooapis.com/), tiny update in Github repo. How to use You can call the module in two different ways: This is a basic call that renders the module, use this if you want only one instance of the module shown with WOEID set in the module settings. <?php echo $modules->get('MarkupYahooWeather')->render(); ?> If you want to show multiple instances of the module, call it this way: <?php $weather = $modules->get('MarkupYahooWeather'); $weather->woeid = 12587912; // Decatur, USA echo $weather->render(); $weather->woeid = 44418; // London, United Kingdom echo $weather->render(); ?> Options This module has the following options: Yahoo! Weather WOEID WOEID (Where On Earth ID) is an unique identifier for each city, you can easily find WOEID by using this site: http://woeid.rosselliot.co.nz. Default = Zagreb Set Locale Sets PHP locale, needed for localized date display. Default = en_US.UTF-8 Set Encoding Converts international date names to right format. Default = ISO-8859-1 Date Format Sets desired date output, formatted with PHP strftime function. Default = %A, %d.%m.%Y. Cache Time Cache time in minutes, caches .xml file(s) retrieved from Yahoo! API and pulls the data locally. Default = 5 minutes Display temperature in Fahrenheit instead of Celsius? Show weather conditions in Celsius or Fahrenheit scale (temperature: C/F; wind speed: km/h, mph; sunrise and sunset: 24h, am/pm). Show 5 day forecast below current weather forecast? Shows extended 5 day forecast, if unchecked, only current weather will be shown. Default = Checked Show wind direction and speed? Shows wind direction and speed. Default = Checked Show sunrise and sunset time? Shows sunrise and sunset time. Default = Checked Autoload script and stylesheet? Renders script and stylesheet during page render, if you prefer to include them manually, turn this option off. Default = Checked Load script in the bottom of the page? If "Autoload script and stylesheet" option is checked, you can select where script should be rendered automatically, before the end of head or body tag. Default = Unchecked Delete Weather Cache Deletes locally stored and cached .xml file(s) from Yahoo! API for all instances of the module.1 point
-
new site for photographer Nick Graham working with design agency Each. http://nickgraham.co.uk/1 point
-
Ok got it. That Object (indeed an array) and its methods are defined here. Very useful advice and link you gave me @kongondo (and thanks @soma too). (Y)1 point
-
for help with the native resizing methods, there is also PIA available1 point
-
Which cache? Template cache you would go to the PageRender module settings and delete cache.1 point
-
@bernhard You could also use the maxSize method: $thumb = $image->maxSize($width, $height); This method does also resizing without cropping. Too bad this nice method is only documented in the blog post and cannot be found through the site search. Hopefully the documentation will be updated with the stable release of ProcessWire 3.1 point
-
@horst if that kind of full res images are really needed i would present lower quality images and make a link somewhere "show/download full res image", don't you think? @chris have a look at the docs. all the options and what they do are well explained here: https://processwire.com/api/fieldtypes/images/ edit: my example creates a new image with maximum dimensions of 1000px (height OR width) and keeping the original aspect ratio 3000x2000 would get 1000x666 2000x3000 would get 666x1000 500x500 would get 500x500 (see option "upscaling")1 point
-
hi nifel87 found a hint in a forum that the rss still works without oAuth... It seems that nikola has fixed this problem: https://github.com/nvidoni/MarkupYahooWeather/commit/43f1f95e7942f6f7f02aa58c0b5cb255b1cf111e changed the URL should do the trick for the moment... // Get weather data old API http://weather.yahooapis.com/forecastrss?w=.... // Get weather data new API 15.03.2016 http://xml.weather.yahoo.com/forecastrss?w=.... it's a bit hackish not using their oAuth secret and token and it would for shure be a deadline sometimes...it's always the sh** with external services... Best regards mr-fan1 point
-
Just guessing...probably has been spat out similar to what happens in ProcessWire admin...Look at the admin source...You'll see something like this: <script type="text/javascript"> var config = { "modals": { "large": "15,15,30,30,draggable=false,resizable=true,hide=250,show=100", "medium": "50,49,100,100", "small": "100,100,200,200", "full": "0,0,0,0" }, "ProcessPageList": { "containerID": "PageListContainer", "ajaxURL": "/processwire/page/list/", "ajaxMoveURL": "/processwire/page/sort/", "rootPageID": 0, "openPageIDs": [ ], // etc. } } </script> @soma talks about the technique here (@see Communicating with PHP).1 point
-
1 point
-
First thoughts: Have you exported the tables or the database itself? Are you importing the tables or the database itself? Is the database you are importing too really empty?1 point
-
The code example probably expects you to be in a non namespaced environment, where it would work. You need to either use a "use" statement in the beginning of your file or call the class with a leading backslash \Aws\S3….1 point
-
1. There's not final answer, but your choice makes sense. 2. Use composer 4. use 'require __DIR__ . "/vendor/autoload.php";' in your config.php1 point
-
Quite good idea, but in this case it prevents the storage of the changed value because the reload enters before the new value will be stored. $(document).on("click", ".ui-button", function(){ location.reload(true); }); ui-button is the button class of the save button in the modal window. A timeout would be a possible solution, but I dont know how long it will take to store the value. For the moment I have added a timeout for 1 second $(document).on("click", ".ui-button", function(){ setTimeout(function() { location.reload(true); }, 1000); }); During the test it seems ok. Maybe there is a better solution.1 point
-
Hi! Great module, very helpful. Sorry for my english, I'm not very good with it. I tried your module and at start It worked fine, but since 15th March 2016 Yahoo has introduced a new method for the authentication that use an oauth2 key. Because of this the module doesn't show any information anymore. I tried to fix it but I'm not good enough with php and service requests. Thx again for this module1 point
-
Don't have any experince with the new Frontendediting function in PW3 but you could go the ajax route to load content or force a page reload... $(document).on("click", ".trigger_css_class", function(){ location.reload(true); }); just as example...hope this helps a little. regards mr-fan1 point
-
that's why i said "just kidding"... i thought that would be enough justification for such a statement on an off-topic forum...1 point
-
I'm using more and more vue.js for html - js interaction. Damn useful and you could easily implement the things intercooler does as well. @bernhard It's certainly not. If you're not in the need to support IE<9 jQuery is really not necessary, especially as it does get heavier and heavier in filesize.1 point
-
Unfortunately it depends on jQuery which I try to avoid if I can, otherwise cool.1 point
-
Exactly. How you log things is up to you, but for debugging purposes it's totally valid to edit core files. Just revert back to original state after you've found your issue.1 point
-
Thanks for educating me, teppo! I have never used GitHub (apart from downloading ZIP files and simple browsing) nor noticed the "forked from" line. Sooner or later I need to find the time to familiarize myself with GitHub, I suppose. And again, sorry for the off-topic question.1 point
-
Hi slave, Please look at the hooking example provided by soma on Github. You need to change it like this (written in browser, not tested): function hookGetListClass(HookEvent $event){ $child = $event->arguments('page'); // current rendered child page $class = $event->arguments('class'); // the class string already present // any check on that child to set your custom class if(count($child->parents) >= 2 && $child->numChildren){ // Only proceed if at least two parents and if an item has children $event->return .= " dropdown-submenu"; // add your custom class to the existing } }1 point
-
Is it possible that you are using it on a live site or at least a publicly accessible server and not your local machine?1 point
-
From the PW modules directory you will get always the original version. If the Author like this feature, he has the freedom to include it. I had to make these changes, to get it working properly with my template function library and I want to share this enhancement. Use it if you like it.1 point
-
1 point
-
Werner, I tried creating a page with name "bäckerei-testmann", as well as changing an existing page to have that name, but seems to work fine here. Double check that you've followed all the instructions in the blog post, as it sounds like something may potentially be missing. However, the error message you mentioned indicates that maybe there really is a page with that name already in there, perhaps as a temporary one that you created but never saved (i.e. queued for deletion). Experiment with other page names to see if you can duplicate the issue. Of course, double check that your PW version is 3.0.12 as well, as this won't work on earlier versions. The guys mentioned it above already, but just wanted to repeat that PW always stores page names as ASCII so it's not going to matter what the collation is, and ascii is the correct one that it should have. UTF-8 page names are converted to and from ascii via punycode, just like IDNs.1 point
-
I forked the module on github which allows the following paths for example: styles/style.css (relative to template - default) /site/folder/style.css (relative to root - NEW) https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js (absolute path to external source via http request -NEW) https://github.com/kixe/ProcessWire-AIOM-All-In-One-Minify1 point
-
First, take a look at the docs on pagination, if you haven't already done so. Important thing to remember is that you need to enable pagination in your parent template (/galerie/) in the case of your example, or in the case of a shop perhaps /produkte/. If it is for a shop, then each product should probably be a page, but you can paginate images just as easily. (And if it is a shop take a look at this.) If you get stuck, come back here and ask some more.1 point
-
@Christophe and @jploch - I have committed a very quick fix that allows this module to work even if you don't have ffmpeg installed. Obviously the ability to grab poster images for the video won't work. Also it won't be able to determine the length of the video. Both of these require ffmpeg. I will revisit this again when I am back from vacation and add the ability to manually upload a poster image, but for now at least this module will work and you can now have the benefits of automatically playing videos with a simple: echo $page->video_field->play; Hope that helps as an interim improvement.1 point
-
I just tested with Soma's form tutorial and it rocks! I will definitly use it in my next project. Just put two attributes like : $submit->attr("ic-post-to", "{$config->urls->httpRoot}contact.php"); $submit->attr("ic-target", "#contact-form-error"); thats all... Impressed.1 point
-
yes - drop in for sure... maybe a module at some point could be convenient, since i'm predicting i'll need this a lot.1 point
-
When the need is there for separate DB configurations and something more than config-dev.php, I've done it like this in my /site/config.php file: switch($_SERVER['SERVER_NAME']) { case 'localhost': // set database settings for localhost break; case 'dev.domain.com': // set database settings for staging server break; default: // set database settings for production server } You should give preference to SERVER_NAME in this case (over HTTP_HOST) just because HTTP_HOST is coming from the client rather than the server (open to tampering). Though it doesn't really matter as long as your last "default" condition assumes the production server.1 point
-
This is out of the scope of PW, the bubbles you are seeing are from your browser. You can find some infos here: http://www.html5rocks.com/en/tutorials/forms/constraintvalidation/ Also, make sure you have set the right html lang attribute for your language.1 point