Leaderboard
Popular Content
Showing content with the highest reputation on 12/24/2014 in all areas
-
17 points
-
A proof-of-concept session handler module for PW that uses Redis as the session database. You'll need access to a Redis server (IP address and Port) and you can configure the session prefix, the Redis DB that the sessions will be stored in and a time-to-live for the sessions. Please let me know if you run into any issues with this module. Here it is on Github. Here it is in the modules repository.6 points
-
Merry Christmas from Zagreb! One quick picture from the main square, check out other if you're interested5 points
-
Thank you kids! And seasons greeting to both of you and to all the other Processwirers* here. (* Process Wirers? That would make us webtricians then!)5 points
-
I have done a couple of tests in respect of memory (memory_get_usage) and timings (Debug::timer()) when processing 1000 copy-pasted CSV values in a 100X10 matrix table: For a fictitious investment company, I generated (using a local install of datagenerator) CSV data consisting of 100 rows (account manager) x 10 columns of customer details containing their: Full Names, Age, Country, Bank Account Number, Phone Number, Credit Card CVC, Email, Income, Address, Post Code Btw, this showcases another use for this Fieldtype. It is not only about colours vs sizes . If you have data such as above that is most likely already available in CSV or similar format and that would not readily lend itself to being converted to pages (even for use in Page Fields), then you probably want to use FieldtypeMatrix... OK, back to our measurements...I imported my 1000 CSV values into my matrix and got the following results. Note that I am on an i7 windows machine. lightning.pw has been down for me the last couple of days so wasn't able to test there. I am not good at such testing so if anybody else wants to help out I'd appreciate it. I also had to increase my max_input_vars from the default 1000. Saving 1000 pipe (|) delimited CSV values //Note: SEQUENTIAL PROCESSING (I skipped timing methods like get() and set() //not sure why ___sleepValue() was not showing here! See next test where we exit at ___sleepValue() 11187192: Memory Usage Start: get()Inputfield() 0.0360: Debug Timer End: get()Inputfield() 11270704: Memory Usage End: get()Inputfield() 11772248: Memory Usage Start: ___wakeupValue() 11772456: Memory Usage Start: get()blankValue() 0.0000: Debug Timer End: get()blankValue() 11773896: Memory Usage End: get()blankValue() 0.0700: Debug Timer End: ___wakeupValue() 13372176: Memory Usage End: ___wakeupValue() 12871408: Memory Usage Start: sanitizeValue() 0.0000: Debug Timer End: sanitizeValue() 12871408: Memory Usage End: sanitizeValue() 14262896: Memory Usage Start: ___render()//render calls mergeMatrix() 14263624: Memory Usage Start: mergeMatrix() 0.2190: Debug Timer End: mergeMatrix() 15165696: Memory Usage End: mergeMatrix() 0.2800: Debug Timer End: ___render() 15231376: Memory Usage End: ___render() Same as above (+sequential) but exiting at ___sleepValue() //exit before ___sleepValue() returns $values 11707344: Memory Usage Start: get()Inputfield() 0.0020: Debug Timer End: get()Inputfield() 11790872: Memory Usage End: get()Inputfield() 11791416: Memory Usage Start: get()blankValue() 0.0000: Debug Timer End: get()blankValue() 11792856: Memory Usage End: get()blankValue() 11793040: Memory Usage Start: sanitizeValue() 0.0000: Debug Timer End: sanitizeValue() 11793040: Memory Usage End: sanitizeValue() 12762576: Memory Usage Start: ___processInput() 12763296: Memory Usage Start: mergeMatrix() 0.0540: Debug Timer End: mergeMatrix() 13372952: Memory Usage End: mergeMatrix() 13361256: Memory Usage Start: ___processInput() - csv only 13361848: Memory Usage Start: processCSV 13362040: Memory Usage Start: mergeMatrix() 0.0080: Debug Timer End: mergeMatrix() 13486200: Memory Usage End: mergeMatrix() 13613512: Memory Usage Start: get()blankValue() 0.0000: Debug Timer End: get()blankValue() 13614504: Memory Usage End: get()blankValue() 0.0830: Debug Timer End: processCSV() 15346208: Memory Usage End: processCSV() 0.0830: Debug Timer End: ___processInput() 15098552: Memory Usage End: ___processInput() 14992888: Memory Usage Start: sanitizeValue() 0.0000: Debug Timer End: sanitizeValue() 14992888: Memory Usage End: sanitizeValue() 15128552: Memory Usage Start: ___sleepValue() 0.0160: Debug Timer End: ___sleepValue() 15511096: Memory Usage End: ___sleepValue() Loading the matrix table with the saved 1000 values //SEQUENTIAL 11763208: Memory Usage Start: ___wakeupValue() 0.0890: Debug Timer End: ___wakeupValue() 13363016: Memory Usage End: ___wakeupValue() 14253776: Memory Usage Start: ___render() 14254504: Memory Usage Start: mergeMatrix() 0.2250: Debug Timer End: mergeMatrix() 15156544: Memory Usage End: mergeMatrix() 0.2680: Debug Timer End: ___render() 15222208: Memory Usage End: ___render() Don't know what to derive from these results or if I did them correctly . From a timing point of view, the results don't look too bad, or? Saved data screenshot5 points
-
Just popped out another bootstrap and processwire auto website! I am getting to where I can do these in 1 to 2 weeks now! Uses the bootstrap carousel for the slider, Google maps marker module and the form templates processor module on the detail page. Also using redirects module and batcher. (Redirects for the sub menu items under inventory to send the user to the search page with the correct query strings.) I also use a cron that reads an inventory csv file and makes or updates processwire pages based on the vin number. http://www.classictexarkanakia.com4 points
-
Happy Christmas to all Willie Batenburg was a small anonymous artist with a banjo from Dordrecht until he was discovered by a few employees of Radio Rijnmond. His music was from that moment played regularly on this channel and Willie became a real hero. Thousand guilders could be won by the listener who could exactly tell what words he sang. (nobody has ever won the price )4 points
-
4 points
-
3 points
-
3 points
-
Just remembered that I have a couple of Christmas songs too! The first is serious, the second is plain cheesy https://www.youtube.com/watch?v=u59_xmNSp54 and https://www.youtube.com/watch?v=w3dNmLCoeXk2 points
-
2 points
-
2 points
-
I solved my own issue, I ended up using one image field and using the limit=1 method. Works like a charm!2 points
-
On mobile so just a quick reply: strings work just as well. I've posted about this earlier, but IMHO whole integer version idea is flawed, exactly for the reasons you mentioned above. They can only represent a subset of version numbers. People also keep confusing them with octals, which is another issue..2 points
-
+1 for the idea. For the implementation, I'd suggest encouraging module authors to implement Semantic Versioning or similar strategy; no need to include special flags, fields, etc. when version number itself clearly states if there's a (potential of) breaking change.2 points
-
Hey Friends of Webanalytics, I've finished the main work on porting Wanzes GA into a PiwikAnalytics Module. Just uploaded it to the modules directory. It does pretty much the same like GAModule So take a look at the module post: http://processwire.com/talk/topic/1609-processgoogleanalytics/ You could download the module in the directory or directly from my site: http://misterui.de/site/assets/files/1087/piwikanalytics.zip Cheerio1 point
-
Hello all, Little stuck on how to override what a field outputs when being called within a template file. Take the following sample code inside a template: <h1> <?=$page->title?> </h1> <div> <?=$page->another_field?> </div> What I'm trying to do is analyse and potentially modifying the output of this field from within a template, using a module WITHOUT saving the page. This is currently the code that I'm trying to run public function init() { // add a hook after each page is rendered and modify the output $this->addHookBefore('Page::render', $this, 'exec'); } public function exec($event) { //Get the rendered page $page = &$event->object; if($page->template == 'admin') { return; } //As a test, try and modify the title field, but in the future I'll need to be able to modify any fields $page->set("title","A test title!"); } Unfortunately, this doesn't work. - The page still renders the original title within the template! Ideally - my long term goal is to know: What the field type of the called/rendered field is The current value of this field Any guidance is appreciated!1 point
-
"install or die!" Sorry too direct?1 point
-
Not directly, its not. But with a custom script it is possible; something to tell Blog about the IDs of your comment related pages and that comments feature is enabled. Alternatively, if you know what you are doing and TESTING on a development server first, you can directly edit the necessary values in your database using a programme like phpMyAdmin. The code below is from a fully installed blog, in the PW db table 'modules' and the row 'ProcessBlog'. It tells you what is going on. {"blogFullyInstalled":1,"blogStyle":1,"schedulePages":0,"commentsUse":1,"templateFilesInstall":2,"tagTemplatesFields":"blog","blog":2480,"blog-posts":2481,"blog-categories":2482,"blog-tags":2483,"blog-comments":2484,"blog-widgets":2485,"blog-authors":2486,"blog-archives":2487,"blog-settings":5190,"blog-asc":4017,"blog-dnc":4018,"blog-dc":4019,"blog-rposts":2491,"blog-rcomments":2492,"blog-broll":2493,"blog-tweets":2495,"blog-pauthor":4015} In your case, you would first need to create the four comments pages and note down their IDs. blog-comments":2484" - comments (parent of below three) blog-asc":4017, - always show comments "blog-dnc":4018, - disable new comments "blog-dc":4019 - disable comments There is also the recent comments page to install under widgets. blog-rcomments":2492 You would also have to create the necessary fields that go with those pages as in a full blog install. Then it would be a matter of simply adding the above key/value pairs that have the IDs of your newly created comment page. This would be faster than writing a custom PHP script You would also need to change this: "commentsUse":1, in your case the value is '0' - it would need to be changed to '1' It is not as complicated as it sounds but like I said, you would need to try and thoroughly test on a development install first! If you want to go this route (rather than install afresh), I suggest you fully install blog on a test server and compare the above db values to your current install that's missing the comments feature as well as compare their respective Blog Pages tree....I think that's it really...1 point
-
@kongondo Great example. Timings look fine to me. Memory usage looks to be well within the default PHP ini setting for maximum memory assignment.1 point
-
1 point
-
Thank you Adrian, You guys are so awesome! I will give a look to simplepie. Merry Christmas and and all the best in 2015!1 point
-
Would something like this work? $ads = $pages->find("parent=1304, include=hidden"); $randomAds = $ads->findRandom(4); // or whatever number you need foreach ($randomAds as $a) { #do stuff } If there are a lot of children of parent=1304 be aware that this might not be the best performing option.1 point
-
Looking into it further, this isn't supported in MarkupLoadRSS. It would be possible to extend it to do this, or you could consider some alternatives, like Martijn's approach above, or use Simplepie which is awesome http://simplepie.org/wiki/tutorial/how_do_i_get_a_thumbnail_from_a_youtube_feed http://simplepie.org/wiki/addons/youtube1 point
-
Updated the README and Screenshots on GitHub. Should be really nice to use now: https://github.com/LuisSantiago/FirstSteps/ I also splitted this module to allow third-party modules to use this feature (examples are on github).1 point
-
Well explained. It's really important when you're learning a new system to be completely comfortable with the terminology. If the words used to describe something doesn't gel with you, then you're not going to absorb the concept. Reminds me many years ago of trying to learn expression engine when everything in the tutorial book (and Expression Engine) was called a blog. I didn't get it (at the time) until EE 2 came out and their internal terminology changed. So these days, to counter getting hung up on a keyword or label which I find confusing, I will treat a word as an anagram instead. IE Instead of thinking "its a page", imagine it's a P.A.G.E and make up your own meaning for this such as Part of Anything Going to be Edited Pod for All your Generated Entries Place Already Great for Expansion I'm sure there's better possibilities but it may help. Or it may make things worse :-/1 point
-
1 point
-
Module now available. Opening post updated and expanded. I added a couple of media queries to the home.php template code but I can't seem to add them to the opening post code - weird. Updated to add: not so good using FF on android.1 point
-
1 point
-
Hey Peter, If there is more than one value in the page field array, then looping is likely what you want, but if the page field is set to only allow one option, then you are better off with your good friend "first": $page->course_detail_level->first()->title1 point
-
Maybe the most natural and just general would be foreach($page->fields as $f) { echo "Type:$f->type Name: $f->name Label: $f->label<br>"; } $page->template->fields, $page->get("fields") etc A more deep hook into fields would be to hook formatValue(page, field, value) of Fieldtype. It will replace every title fields rendered on page also from other pages. $this->addHookAfter('Fieldtype::formatValue', $this, 'hookFields'); public function hookFields($event) { $page = $event->arguments("page"); $field = $event->arguments("field"); $value = $event->arguments("value"); // not sure this is needed here, and won't prevent from exec in admin. You better set module config to "autoload" => "template!=admin" if($page->template == "admin") return; if($field->name == "title"){ $event->return = "ohhhhhhh"; } } You could also just hook into specified field type like page title field $this->addHookAfter('FieldtypePageTitle::formatValue', $this, 'hookTitle'); You can also create your own property as per HelloWorld.module. But not overwrite already existing fields. $this->addHookProperty('Page::hello_world', $this, 'example4'); I'm not sure what you're trying to archive and if there isn't another approach, just mention ways... For example: You asked how to modify the page title. I showed you how and it's working. Fieldtype::formatValue will get called only when output formatting is on. And it's called when using TextFormatter modules on a field.1 point
-
Works fine $this->addHookBefore('Page::render', $this, 'renderHook'); public function renderHook($event) { $page = $event->object; if($page->template == 'admin') return; $page->title = "ohhhhhhh"; } Now the rendered page has always title ohhhhhhh. But this does not change the title for page in navigation or other places.1 point
-
1 point