Leaderboard
Popular Content
Showing content with the highest reputation on 06/21/2016 in all areas
-
Does using dedicated module files help a lazy programmer? For a private helper module I wanted to built, I decided to use the possibilities of dedicated files (implemented in PW 2.5.5) and not to write all into a single module file. Until now, I totally missed or forgot about this possibility. To my excuse: on introduction I may have thought not to use it early in my modules to keep backward compatibility. And then totally forgot about it. I allready use a tool for postprocessing in my sites. And I'm not familiar with all those popular node/grunt/gulp/npm/bower/and-what-else stuff out there. It looks to me a bit oversized for small to medium websites. But I also wanted not miss a comfortable, easy to use config for less and sass files, especially for those from frameworks like Bootstrap 3 / 4 or UIKit. So, what my toolbox should get added was a preprocessor (compiler) for sass (.scss) files first. I choosed the UIKit for the first shot. The created files for a configurable module called PreAndPostProcessor and a process module called ProcessPreProcessor were: PreAndPostProcessor.module PreAndPostProcessor.info.json PreAndPostProcessorConfig.php ProcessPreProcessor.module ProcessPreProcessor.info.json ProcessPreProcessor.css ProcessPreProcessor.js As you can read about the differences to the old-schooled style in Ryans blog post, I focus on what I found out to be most useful for me. Starting with the Config file, I decided to use the $this->add() method in the __constructor(). It is the way what needs less code to define your inputfields for a configpage: just a collection of arrays with field or fieldset definitions. Mandatory definitions are: type, name, label. Others are optional: description, notes, required, columnWidth, collapsed, showIf, ... And, of course, you need the definitions specific to your fieldtypes (value, options, ...). To group some fields into a fieldset, add a key called "children" to the fieldset array and add all field definitions to it as collection. Simple! Another nice thing I discovered, is the use of the *.info.json files. So, this I have used before, but not like here. The behave is like with the *Config.php files, - you write really less code, just arrays with key - value pairs and PW does the rest for you! Only difference here is, that you have to write it in JSON notation. The ProcessPreProcessor.info.json file contains the neccessary and common parts: title, version, requires. And some others: permission, permissions, page and nav. Page and nav are specific to Process modules. With page {name, parent, title} you define where PW should create you a page in the admin, and with nav, you can define a complete submenu for this page. For those who are yet not familiar with the internal structure of Processmodules: you can navigate to a submenu entry by calling it: {pw-admin-url}/{main-module-url}/{submenu-url}/. Calling the main menu url invokes the ___execute() method of the module. Calling a submenu url invoke the ___executeSubmenu() method. This all is really simple and straight forward. And it is really really helpful in cases like with the new toy for my toolbox. The nav is a collection of arrays, each holding at least an url and a label. Thats enough for PW to implement the menu and submenu for you in the admin. But you also may define an icon too. Aaaand, you also can add your own custom key / value pairs to it. PW does not complain on it. I have added a description. The nav was generated by parsing all core distribution scss files from the UIKit. They have a name and description in their first two lines. I programatically read this out and generated this nav notation for the info.json file: The (main) ___execute() method of the ProcessPreProcessor.module should present a submenu list with file infos. This now could be done by parsing the info.json file: public function ___execute() { // generate a navigation $dump = json_decode(file_get_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.module') . '.info.json')); $nav = $dump->nav; $out = "\t\t\t<dl class='nav hnpp'>\n"; foreach($nav as $obj) { $out .= "\t\t\t\t<dt><a href='./{$obj->url}'>{$obj->label}</a> ></dt>\n"; $out .= "\t\t\t\t<dd>{$obj->description}</dd>\n"; } $out .= "\t\t\t</dl>\n"; return $out; } To make it even more friendly for lazy devs, , I created one method that is called from all sub-execute methods by simply passing their own name over into this function that loads and parse the scss file and displays its config page: The first version work out nicely. Here is a screenshot of it: ... and to answer the initial question: Yes, it does!10 points
-
6 points
-
This morning's commits add to the color scheme: Red: The current page is using a different template. Orange: The current page is using it's default template file, but there are other pages on the site that are using a different template file (obviously via the Sticky option). Use "Reset All" to clear this when you're done testing. Green: All pages on the site are using their default template files. This is now documented on the blog post.5 points
-
If your fields are named " block_title" and " block_body", you need to call them with its names. In your example you are calling title and body. foreach($siteSettings->global_footer_blocks as $block) { echo "<div class=4u 12u(narrower)><section>"; echo "<header><h3>"; echo $block->block_title; echo "</h3></header>"; echo "<footer>" . $block->block_body . "</footer>"; echo "</section></div>"; } Does this work?3 points
-
@adrian Perfect! I already had Tracy installed and this works perfectly. Thank you. For anyone else visiting this thread, you might need to activate Template Path in the Panel Selector of Tracy, create a dev version of the template you want to work on, then navigate to that page and use the Template Path panel as adrian indicates above. (Small tip from me - make the page header or background a different colour on the dev version, so you know you're on the right one.)3 points
-
The default pagination methods should work with the resulting pagearray.2 points
-
Hello, What do you think about this entire article?: https://mindtheshift.wordpress.com/2015/04/02/r-i-p-rem-viva-css-reference-pixel/ Edit: I'll try to read all the article's comments.2 points
-
Great job on the new forum @Pete. Is there an account setting I can apply so replies in a Q&A thread are sorted by date by default? I find it hard to follow the conversation when they are sorted by rating and don't want to have to change the sort order manually for every thread.2 points
-
In case someone is wondering about the PW 3.0.22 new password field functionality ( InputfieldPasswordComplexify ) compatibility, this is what you will need in the <head>... <link type="text/css" href="/wire/templates-admin/styles/font-awesome/css/font-awesome.min.css?v=17j" rel="stylesheet"> <script type="text/javascript" src="/wire/modules/Inputfield/InputfieldPassword/complexify/jquery.complexify.min.js"></script> <script type="text/javascript" src="/wire/modules/Inputfield/InputfieldPassword/complexify/jquery.complexify.banlist.js"></script> <script type="text/javascript" src="/wire/modules/Jquery/JqueryCore/xregexp.js?v=1466417387"></script> <script src="/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.min.js?v=101-1466417387"></script>2 points
-
Thanks Pete, love the newer feel and grateful (again) to you for the work. I noticed in my profile it says I have no 'Friends' <--insert joke here-->. I assume that's just some data that their migration process was not able to include, or should I start to worry o_O / change my brand of toothpaste etc?2 points
-
Sure, I'd be glad to elaborate. Here's the outline of the update process: Update the MLS, processing each property type and property status individually for flexibility Get layout of RETS parent class (In my case Property) and RETS listing type tables (In my case A, B, C, and D) using GetClassesMetadata and GetTableMetadata Populate list of available MLS entries with only MLS, internal ID, and modification timestamp. $connection->Search('Property', 'A', '(LIST_15=ON6KCGQ87YK),(LIST_104=Y),(LIST_12=2013-06-02+)', ['Select' => 'LIST_1,LIST_105,LIST_87','Limit' => 'NONE']) The LIST_15 part of the query is a filter for status. Sadly, RETS makes heavy use of lookup fields, so you have to find the code for the value you want on the lookup table before you can find the value to use for the query. Fortunately, this is only an issue for field values used in the RETS queries themselves. Delete listing pages that no longer exist on the MLS For each listing without pages or each listing with a changed timestamp { Populate MLS data using data collected by querying for all fields from only the one property Update all photos if the photo timestamp changed (iterate the media using a GetObject -- PHRETS makes this easy) Update all documents if the document timestamp changed (mostly the same as with photos) Precache the resized images of random listings Precache the long-lived WireCache snippets of random listings Aggressively delete unused asset files, including unneeded and obsolete image sizes. 10 GB of photos and documents is plenty. This code also forces a photo update if photos are missing. Delete expired log files Prerender homepage and pages linked from it with ProCache curl -sS `curl -sS https://website.com/|grep -oE 'listings/([a-z]+)/([a-zA-Z0-9-]+)/|quick-search/([a-zA-Z0-9-]+)/'|sed -e 's/^/https:\/\/website.com\//'|sort|uniq` >/dev/null I'm sure there's so much I missed; I'll be doing well if this even makes sense! One thing I didn't cover above is the replay mechanism. If I make a change to RETS value parsing, I can easily run a complete offline update using the cached JSON data from each listing. It's a big timesaver.2 points
-
Thanks for testing @cstevensjr @Werner Pilnei - are you running the site as https? Can you try having the cron call the standard http version of the url instead?1 point
-
Follow-up I tested with PW 3.0.20 and PHP 5.6.19. Then I then upgraded the PHP to 7.0.6. With both PHP versions everything worked as normal. I setup a new cron job and that is working without any problems.1 point
-
At least it let enough room for speculations. Did they have investigated? Is it a server config that they don't want tell about or change it? Or do they NOT have investigated and this is a boilerplate answer that is sent with enough timedelay? annoying!1 point
-
I always hate those kind of answers. I mean they invested time to replicate or otherwise prove that it's not their fault, but giving any detailed information about the results cannot be done?!1 point
-
Yeah, they changed how this worked because you could become friends in the previous one and the other person not have any say in it, whereas in this version it's "followers". You would have thought they'd just change the friends to followers during upgrade but I think that would have meant a possibility of being alerted whenever the person being followed posts something so I can see why they changed it I suppose.1 point
-
1 point
-
1 point
-
The old wiki was still useful when one wanted to learn about the general concepts behind ProcessWire, but module development has evolved since then, so probably a good starting point is this: https://processwire.com/blog/posts/new-module-configuration-options/ BTW, as far as I know, there are no plans about saving the old wiki. If someone needs it, I have a version of it that was saved by a "web grabber". Just pm me, if you need it.1 point
-
Hi teppo, thanks for your reply! I now took the javascript road. With jQuery I search for all links which have 'assets/files' in their href and attach target="_blank" to them.1 point
-
I will attempt to verify, however I am still at PW 3.0.20 (with an Automatic Page Name Format/PageTable issue reported in Github #1878)1 point
-
Was literally thinking about the same thing just yesterday. Solved it by a combination of JavaScript targeting only links to assets and instructing users to apply target "_self" to file links they don't want to open in a new window/tab. That's definitely less intuitive than having target "_blank" automatically selected, but does the trick Another option would be injecting JavaScript for when Page Edit Link is rendered and handling this there. In that case it would probably make sense to track the change event of the file input and act on that, perhaps combined with a check that avoids changing the target value if the user has already changed it manually. Just for the record, it would be nice to see a built-in setting for this. I'd assume this to be a relatively common need.1 point
-
Macrura, great–glad that was it! I've updated the core Field.php file so that this should no longer be an issue: https://github.com/ryancramerdesign/ProcessWire/commit/c0b30dbb24d30845d98ab1c9d103bbead1a6e629 Still a good idea to define defaults for your module though. If you don't, there's a good chance the module will not work if someone creates a field and neglects to change any settings (and thus never saves any config data).1 point
-
You should use clearAddresses() before sending the second email : [...] if (!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!<br>Sending an email to the submitted email from user...<br>"; // clear addresses $mail->clearAddresses(); //Set who the message is to be sent to $mail->addAddress($field3, 'Bob'); $mail->Subject = 'Thanks for contacting us | sent once'; $mail->Body .= "Thanks for contacting us at our Site."; // send email $mail->send(); } This should do the work.1 point
-
This URL seems not to be valid anymore. I get an error trying to access it. Thought that you should Know cause the info IT provides is helpfull. Maybe the plan is to move that info to the main pw website ?1 point
-
No, the module doesn't support it. And I cannot see much benefit for it. This is the only part what would be a really pain in the ***, if one would try to integrate this. And AFAIK, you get the same effect if you use the base64 data with your img src. And this can be done outside of the module. // when building your HTML-content, you simply can add something like $htmlcontent .= "<img src='data:image/png;base64," . base64_encode(file_get_contents($image->width(300)->filename)) . "' />";1 point
-
1 point
-
No, - no other / better ideas here. Just trying hard to follow up with most of the new stuff here (in the forums). Wondering how to best store / load / exchange them between different sites / installations. Textarea populated with json or simple json files?1 point
-
Yeah, good idea - I have made those changes locally - they should be committed later today. I think that was/is my thought. I am not sure where or how else you would want to run them. My idea was to just have a way to store common debug snippets and also perhaps admin/db cleanup, manipulation, batch operation type snippets. Maybe you have some better / different ideas to share?1 point
-
Hi, I have been running a processwire based film magazine for more than 3 years now. The resources are wonderful, and the forums are full of information so much so that I did not have to ask a single question during the design process or later. I just added it in the showcase section when the site was done. http://projectorhead.in But in the last week I have been facing some real trouble and the forums dont seem to have anything related. The problem; Once in the admin section, I cannot publish any new content, pages that have some exisiting content, dont accept anything. If I wish to update module settings/ install or uninstall any new module, it does not work either. Every click on any button meant to achieve something in the admin leads to a 404 error in the front end. It started from one page but now nothing would change in the admin, it feels like it has become a hard ball of metal which would just not move. The attempts; 1. I upgraded the entire installation, thinking it was due to the outdated version. I am running the latest stable, 2.7.2, php version 5.6 2. I turned on the debug in config.php, it threw some notices and warnings, have fixed all barring one, where imagesize wants another variable, it hasnt created any issue in the past. 3. I cleared up all caches using the filemanager, removing cache files. Since the backend will not let me purge caches, I had to use the file manager. 4. I cleared the cache table from the phpmyadmin. 5. ProcessImageMinimize was throwing up errors, so I removed the calls from the template and deleted the module using file manager. 6. Saw some suggestion about the .htaccess rules, played around and nothing worked, however the .htaccess is being duly read and used by the server. I am out of options and having to stall the latest issue of our magazine, would really appreciate some quick help on what else I could try, possible solutions etc. I hope I have described the problem sufficiently, but if you need any more details, please ask. Best.1 point
-
The issue has been solved, thanks to the help from Adrian. For those who might get into a similar situation, the culprit is the mod_security. Here is how it all came about; I have a shared hosting environment and the mod_security had been activated recently for all my domains in the hosting setup. While everything had been fine for a long time, suddenly one day the mod_security decided to kick in. The problem may seem a minor glitch in the beginning, and you may begin by clearing up your cache, refreshing the modules and doing a core upgrade to the latest stable version. If any of these help you to solve the issue, great. If not, then try disabling the mod_security and then refreshing the site. In my case it solved the issue and everything came back to normal. If it does not help, then you might have to look at other possible issues in the forums. Best.1 point
-
Where do you see somebody posting something negative and why do you call it negative where somebody just gives his opinion ? I could tell you why but if you follow the likes in this forum you can see for your self. What kind of arguement is that ? Going through a lot of trouble and or spending a lot of hours into something does not guarantee a good result. My opinion is that the new forum look has become visually totally cluttered and over exposed. I can't see anymore where online people are looking in what channels in the forum or who is currently reading in a thread like before. If I now hover over an online name the bottom of the popup disappears under the taskbar. The old forum look was clear, without fancy stuff and functional where it needed to be. What now happened with the forum upgrade will eventually also happen with processwire: pumped up with fancy stuff and Apple look a like styles. Status Quo rules everywhere. Am I being negative here or trying again to give my unbiased objective opinion ?1 point
-
1 point
-
Very chuffed that it only took a minute to figure out... so here you are a way to quickly change the appearance (by adding your own class programmatically) of the register submit button: $fu->form->fhSubmitBtn->attr('class', 'first-class-name another-cool-class another-amazing-thing-the-button-does green-button massive-button'); do you have a quick overview of what form elements are available as built in by the way? Not that I don't like codegazeing...1 point
-
That's interesting. Usually I have a local copy of each site. For sync (and deploy) I use capistrano. For example: cap production db:server_to_local. - db:server_to_local Import server database locally --- executes --- - db:dump_server_db dump server database - db:download_server_dump download server database dump - db:dump_local_db backup local database - db:import_server_db import server database locally - db:download_assets you will be asked, whether to fetch assets from server This way I can also sync between servers easily (production to staging for example).1 point
-
Hi phippu, interesting post. Maybe I can come back to this later, (im in hurry now), but want to note that you can use different sharpening methods with ImageSizer. It has 3 of those imageconvolution matrixes that only rely on the GD library. The values are: "soft", "medium" and "strong". and it has a USM implementation based on pur PHP-Code what is on by default and also uses those 3 paramnames. You can switch between them per global setting $config->imageSizerOptions["useUSM"] = true | false, or add it to your $options array on a per image base. You also can force the recreation on a per image base with adding "forceNew" = true | false to your $options array. (No need to delete variations manually or in an extra step) Ah, not to forget that the use of "defaultGamma" also affects the result: $options["defaultGamma"] = [0.4-4.0 | -1] (-1 is to disable it) You can add suffixes to image variation names per $options array: $options["suffix"] = [a-z0-9_-] By using suffixes you are able to create variations with different values for the same param avoiding overwriting them each other. A test setup for visual comparision of the possible sharpening outputs could be like that: $options = array('quality' => 100, 'upscaling' => false, 'forceNew' => true); $defaultGamma = array('dg0' => -1, 'dg1' => 2.2); $useUSM = array('usm1' => true, 'usm0' => false); $tests = array('s0' => 'none', 's1' => 'soft', 's2' => 'medium', 's3' => 'strong'); $image = $page->images->first(); foreach($defaultGamma as $k1 => $v1) { $options['defaultGamma'] = $v1; foreach($useUSM as $k2 => $v2) { $options['useUSM'] = $v2; foreach($tests as $k3 => $v3) { $options['sharpening'] = $v3; $options['suffix'] = $k1 . $k2 . $k3; $variation = $image->width(intval($image->width / 2), $options); echo "<p><img src='{$variation->url}' alt='{$variation->name}' /><br />{$variation->name}</p>"; } } } // (written in browser, not tested!)1 point
-
The quick answer, Regardless of the hack, if you are using shared, VPS or even dedicated server hosting, even ProcessWire can be affected. If the site that you manage is using the same user account and/or on the same virtual/physical server as a compromised WordPress or Joomla site, any compromise can indeed affect the ProcessWire installation. If there are no old/new WordPress or Joomla installations under the situations I described and you are having this problem, then yes there may be an issue with ProcessWire. Please let us know if this is the case, however I doubt if it is, since we would have already seen this occur in other ProcessWire installations worldwide. PHARMA is an old hack, but it doesn't mean it hasn't been updated. Either way, you need to work with the security team at your webhost to identify and mitigate any issues. Please keep us informed on your progress clearing this issue up. Best Regards, Charles1 point
-
If you can wait, I'm currently working on a booking module for ProcessWire Currently it has specific needs for a specific job, so allows bookings on non-consecutive days, but will have consecutive days as an option by the time I'm finished (more useful for accommodation then). One thing I would say is that a restaurant booking system and a room booking system have very different needs. Both have been at the back of my mind when developing this module, but I need to look into the options required for a restaurant booking system when I get further along with this - the links in the first post here are helpful for that. There are some other nice features I don't want to give away just yet, but it might be worth waiting if you can for a few weeks.1 point
-
I'll admit right away that I've managed to solve it, but maybe someone else will find this useful and also I believe it would be good to put it somewhere in FAQ/Documentation When getting pages by template like so: $categories = $pages->find("template=category"); the results are not sorted according to menu order (maybe it's a bug?). I couldn't find anywhere the info how to force the sort by menu order (everywhere in the documentation there are examples with title and some other variables). The solution was quite easy, but I had to look to database and source code: $categories = $pages->find("template=category,sort=sort"); Btw. thanks for this amazing CMS - I've spent several hours today learning and doing my first website and I must say it is impressive. It has great potential. Cheers.1 point