Leaderboard
Popular Content
Showing content with the highest reputation on 02/11/2016 in all areas
-
Thank you! I think I'm falling in love with PW, It's so easy doing complicated stuff.8 points
-
I just gave the documentation for CloudCannon a read, and I can't agree with you. You still have to think about how you structure it, decide what information to turn into individual fields (editable regions) and how you name them for translation (manually give every editable region a unique data-i18n key) and styling. The example for the navigation with an endless list of if-statements just to decide which link should have the "active" css class set is enough in itself to make me never ever want to use it as a CMS. The "problems with PW" you mentioned are things every developer should always (at least try to) work out in advance before he/she starts working on a site, no matter what platform. Even a static site needs fixed places for pieces of identical semantic value and proper naming of HTML elements for the CSS and JS that is referencing it to work and still make sense after a year. If you encounter things that you always need to do the same way to get started with a website in PW, you can create a site profile, use one of the Exporter modules or write a short script. This is one of the big strengths of PW: to make complex recurring tasks easy.4 points
-
To extend upon what LostKobrakai said, by basic understanding of PHP, I would say: how to set variables how to use the if control structure how to loop through an array (foreach) how to output something (echo) Those basic concepts apply for any programming language and will be heavily used in your templates. Master those with PW's easy API and you'll be like 80% of the way there.4 points
-
Thanks for this. It's probably good to also point out that Flickity may require the purchase of a license depending on the project.3 points
-
Hello again. Thought i share my way of creating sliders in my ProcessWire websites, by using the images field type and some HTML, JavaScript, CSS and a pinch of love. Step One: Go to http://flickity.metafizzy.co/ and download Flickity slider. They also have a CDN option for thoose who prefere that. Also have the page handy cause it has alot of usefull info for configuring the slider and such. Note: In my example i use jQuery to initialize Flickity but you can use it without, see the website for more info. So you need to load jQuery before flickity in the header section for my example to work. Step Two: Here is an example of how you could write some code and HTML for your template file where the slider should render. This code assumes your images field is named images. <div class="slider-container"> <?PHP /* check if there is any images to display */ if(count($page->images) > 0) { /* render out the images and resize to 700 pixel width */ foreach($page->images AS $key => $image) { echo('<img src="' . $image->width(700)->url . '" class="slider-container-item" alt="' . $image->description . '">'); } } else { echo('<p>Houston we have a problem...there are no images to see here...</p>'); } ?> </div> Also lets put together some simple CSS for our container and items. Alter it to your own needs and preference. For the Flickitys sliders default CSS and configuring see the website. .slider-container { position: relative; display: block; overflow: hidden; width: 100%; max-width: 700px; padding: 0; margin-bottom: 15px; clear: both; } .slider-container-item { position: relative; display: block; width: 100%; height: auto; max-width: 700px; } Step Three: Put the default CSS and also Flickitys JS files and load jQuery before Flickity in the header of your site so that flickity works as intended. Or use the CDN option mentioned on the flickity website. <link rel="stylesheet" href="/path/to/flickity.css" media="screen"> <script src="/path/to/jquery.js"></script> <script src="/path/to/flickity.pkgd.min.js"></script> Don´t forget to put the Flickity JavaScript initalization code at the bottom of the template file. For all the Options and configuration see the website: http://flickity.metafizzy.co/ In the example code below i use just a few of the many options. <script type="text/javascript"> /* initiate Flickity Slider JS */ $(document).ready(function(e){ $('.slider-container').flickity({ // options cellSelector: '.slider-container-item', cellAlign: 'center', imagesLoaded: true, percentPosition: true, contain: true }); }); </script> Note: This is my prefered way of doing it. But there are alternative ways to initialize Flickity if you read the info on the website. This should be enough to get you started. And with a little imagination i think you could see the potential. Good luck with all your Slider making dreams2 points
-
Hi craigiop, It sounds like you are you using "someone else's" site profile. Anyway, if you remove fields, you might need to adjust the appropriate template file(s) accordingly.2 points
-
Was going to write a longer reply, but BitPoet already summed up most of my thoughts One thing I'd like to add to the "benefits" section is that with ProcessWire you can be certain that you won't run into issues if that "simple site" needs to grow. Sure, you could always ditch all you've got and start from the scratch, and sometimes that's a good idea anyway, but ProcessWire is more than capable of handling both small and large needs. That being said I don't really know CloudCannon that well, so it might also be capable of handling larger needs, but based on what I've seen so far that doesn't seem very likely. At the very least their pricing model ($$ per month per user, if I understand it correctly) would make CloudCannon really expensive for most of the clients we work with2 points
-
The module could not be removed. So I deleted the row in the "modules" table, and also the files from the "site->modules" folder and the "aiom" folder from "site->assets". No I get this error, when I call the frontend: But there is nothing in the pw log, nor in the servers log. I can login in the backend. When logged in, I can view the site. Edit: I just became aware that it could have been because of the site cache. I now safed the home page again and now the frontend works again.2 points
-
File could not be removed or module could not be removed? If file, then just delete it manually. If module, then you can remove it via phpMyAdmin or similar. Find the table called 'modules' in your ProcessWire database, then find the row with this module's class name, i.e .AllInOneMinify (check in the column class) and delete that row. You might want to first backup your db just in case2 points
-
The forum is your friend https://processwire.com/api/coding-style-guide/ https://processwire.com/talk/topic/3961-new-to-cms/ https://processwire.com/talk/topic/2994-learning-php/ https://processwire.com/docs/tutorials/but-what-if-i-dont-know-how-to-code/ https://processwire.com/talk/topic/6030-learning-php-where-to-learn-just-enough-to-make-living-w-pw-easier/2 points
-
I just wanted to add my approach of using a static method on my extended multisite module together with a cached list of domain names: https://github.com/LostKobrakai/MultisiteExtended/blob/master/MultisiteExtended.module#L341-L3642 points
-
I went through the following free course which was easy to follow and didn't take long. It has most areas covered and allowed me to understand the PW API and templates. https://www.codecademy.com/learn/php2 points
-
To start out with PW you don't even need to use or understand oop. You just need to understand the api processwire does provide and a basic understanding of using php. You'll learn all the other stuff on the go, which will be much easier with a real use case at your sight.2 points
-
JqueryFileUpload This module is a ProcessWire implementation of the awesome Blueimp jQuery File Upload plugin. Server-side, the module provides a custom uploads' handler enabling you to perform various tasks with ease. The module is an interface of the feature-rich Ajax File Uploads widget provided by the jQuery File Upload plugin. The module is completely customisable and can be used both in the front- and backend (e.g. in a third-party module). Please read the README carefully and completely before using the module Release Status: Stable. Module Download: http://modules.processwire.com/modules/jquery-file-upload/ Issues tracker Project page: GitHub Security The module has been written with security in mind and makes no assumptions about any client-side validation. Instead, the module provides robust server-side validation of uploaded files. Server-side, no Ajax requests are honoured unless specifically set via configurable options server-side. This means that client-side requests to upload, delete and list files are not executed unless allowed server-side. By default, files are uploaded to a non-web-accessible (system) folder and files previously uploaded on the server are not sent back for display unless that setting is enabled. However, developers are still strongly advised to implement any other feasible measures to guard against malicious uploads, especially if allowing frontend uploading. For instance, developers can use native ProcessWire checks to limit access to the widget (e.g. only allowing uploads by registered/logged-in users). Demo A short video demo can be found here (and below )(CSS is WIP! ). In the backend, you can see it in action within the (upcoming) module Media Manager Features Fast Ajax uploads. Client and server-side validation. Client-side image resizing (highly configurable options). Beautiful touch-responsive image gallery preview. Audio and video previews pre-upload. Chunked and resumable file uploads (currently client-side only; server-side handling planned). Drag and drop support. Copy and paste support (Google Chrome only). Progress bars. Cross-domain uploads. Single or multiple uploads. Delete uploaded files. Documentation On GitHub. Have a look at the long list of available options. License Released under the MIT license @Credits: Sebastian Tschan @Thanks: Pete and BernhardB for the idea. Please test and provide feedback. Thanks!1 point
-
Hello Everyone. This is not Strictly just about Processwire, but its something i use with a Processwire website that i created. It´s just a simple little Anti-spam protection system i use to make it more difficult for simple bots to mess around with a contact form on the said website. it seems to be working pretty well. The system is very simple, let me explain. Step 1 In the template file for the contact form have this code: <?PHP /* create a random integer.*/ $sendFormInteger = mt_rand(1000,9999); /* save the integer to session var using PW API or just go PHP vanilla */ $session->set('antispam_code', $sendFormInteger); ?> As you can see we just create a 4 digit integer and save it to a session var using Processwire $session API. https://processwire.com/api/variables/session/ Step two Also in your form have for example a label that display the code we created above, so the poster has to manually fill it out in a form field. For example like this: <label for="antispam_code">Anti spam code: <strong><?PHP echo($session->get('antispam_code')); ?></strong></label> <input type="text" name="antispam_code" value="" class="" placeholder="Fill in antispam code here" /> We simply echo out the code we saved in the session var into the label so the user can read it and then fill it out into our form field below the label. Step Three In the file or template that receives the form data put in a simple check like bellow: <?PHP /* sanitize our data and make sure its a integer */ $antispam_code = $sanitizer->int($input->post->antispam_code); /* check if the code we saved in the session var is equal to the one filled in the form and sent to us */ if($session->get('antispam_code') == $antispam_code) { /* if antispam code correct then delete it and go on */ $session->remove('antispam_code'); } else { /* if code is NOT correct then do something else */ } ?> More info on $sanitizer API: https://processwire.com/api/variables/sanitizer/ Just thought i share this technique with you all. I have no doubt that you could easily come up with something more advanced then a 4 digit integer that i use. My anti-spam system is set up so that it creates a new code everytime the form template is loaded. So it should be hard to guess unless they make the bot read the HTML and find the code in the label and make the bot fill out the correct form field before sending it. Happy coding.1 point
-
You can create so to speak an empty template without an uploaded template file by going to the Admin > setup > templates > add And not choose a template file. Then a empty template is created unless you choose to have fields included from another template. You can use this template When creating pages just like templates with files connected to them. Hope it helps.1 point
-
1 point
-
Yes you can create a template directly from within the processwire backend without a template file in the templates folder associated with. You can just the same add fields to such a template. Here is a thread that shows how flexible templates can be used in processwire: https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/1 point
-
I must admit i dont know that much about encryption myself, so I have used the following example with a little modification. http://stackoverflow.com/questions/16600708/how-do-you-encrypt-and-decrypt-a-php-string/16606352#16606352 Do not use BLOWFISH and EBC (this it too predictable) as in the example, instead of that i'm using RIJNDAEL_128 (or 256 if you like) and CBC I also recommend to use a long encryption key, maybe something above 1024 characters, or even 2048 long function encrypt($pure_string, $encryption_key) { $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $encryption_key, utf8_encode($pure_string), MCRYPT_MODE_CBC, $iv); return strtr(base64_encode($iv.$encrypted_string), '+/=', '-_.'); } function decrypt($encrypted_string, $encryption_key) { $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $encrypted_string_dec = base64_decode(strtr($encrypted_string, '-_.', '+/=')); $iv_dec = substr($encrypted_string_dec, 0, $iv_size); $decrypted_string = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $encryption_key, substr($encrypted_string_dec, $iv_size), MCRYPT_MODE_CBC, $iv_dec); return trim(utf8_decode($decrypted_string)); } update: The base64 encode/decode i threw in so that it should be possible to use the encrypted strings as url segments and so are able to use it together with procache1 point
-
Changed the git so that jade-php is included in a normal download. Version 1.0.2 brings also some additional settings for stream and a problem we experienced with Suhosin1 point
-
This is because you are setting the session to 0 every time the page loads, the reason it's working if you are logged in is because of the $user->isLoggedin(). You don't need anything else other than: if($session->get('visit_counter_flag') === 0 && !$user->isLoggedin()) { /* if the user is NOT logged in and not counted */ /* turn of output formating so PW do not give an error when we change the value */ $page->of(false); /* increment the current integer plus one */ $page->visit_counter++; /* save the visitor_counter field */ $page->save('visit_counter'); /* turn on output formating so PW work as it should */ $page->of(true); /* set a visit counter flag to 1 so next load do not count */ $session->set('visit_counter_flag', 1); }1 point
-
Hello Krlos. Welcome to PW community. I hope you will persist and learn PHP because its worth it and a wonderfull language once you get the hang of it. I would suggest you have a look at the: http://www.php.net and also another good source with alot of valuable info is: http://www.phptherightway.com/ PHP the Right Way might be tough to for beginners but they teach good concept and worth a read. Good luck and don´t be afraid to ask questions.1 point
-
Unfortunately I haven't had the opportunity to play with PW 3 yet, so I don't know what's wrong here. Probably something is different in the way that PW fetches images. I'm quite busy by now, but I'll look into it as soon as possible, hopefully next week.1 point
-
@congomonster, thanks for catching that. Fixed; in dev branch for now. @all Please note that if you want the method MarkupBlog::formatDate() to output your comments date according to the date field in blog_comments, you just need to pass it a second parameter 2 (integer 2). For instance, in the template file 'blog-recent-comments.php', line #30, we had this: $date = $blog->formatDate($comment->created); ...but we now have this: $date = $blog->formatDate($comment->created, 2); Since the second parameter is give a value of 1 by default, this change should be backward compatible. Unless you want the updated feature, you don't need to do anything in your template files.1 point
-
Existing pages always take precedence over urlSegments. You have several options: Use urlSegments that don’t exist as children of /site/teachers/, for example by adding a string, or by using 2 urlSegments. E.g. /site/teachers/selection/teacher1/. Use GET parameters instead: /site/teachers/?teacher=teacher1. You could either process the parameter with PHP or catch it with JavaScript and use your existing AJAX solution. Which would probably be the simplest option. Just add one or two lines of JS. Or, if you don't want the actual page under /site/teachers/teacher1/ to be reachable at all, just display /site/teachers/ in that template. Example below: template of /site/teachers/teacher1/: $options['teacher'] = $page; //pass the teacher to the parent page using options array echo $page->parent->render($options); //render the parent page (/site/teachers/) template of /site/teachers/: if(isset($options['teacher'] && $options['teacher'] instanceof Page) { $aside_teacher = $options['teacher']; } //Now render the page as you normally would, and you can use $aside_teacher to put its contents where you need them This also has the added bonus that you can use standard page caching for the child pages.1 point
-
Thanks for this example. Using thumbnail pictures instead of numbers also works good against bots.1 point
-
Thank you sir. I must say that i fell in love with Processwire when i discovered it by chance. My Autism makes it difficult for me to grasp concepts sometimes and with Wordpress i had a tough time. Put Processwire changed everything for me. It sounds silly byt its like a dream come true. Processwire totaly make sens to me and the way the API works and as a fan of jQuery i love the route Ryan Cramer took with it.1 point
-
I just want to add that the access forbidden response is the correct one to return, because the file/folder in the path is certainly not "not found". At least if you want to adhere to the http specification.1 point
-
will media manager support, beside self-uploaded videos, how about video content provider like youbue. For instance, add a youtube link in media manager Such that I can browse youtube videos added in the media repository1 point
-
1 point
-
Video clip showing latest development...(note: previews of other types other than images are still a work in progress...)1 point
-
Should work like this $field->addOption(value, label, attributes); $field->addOption(123, "Produkt1", array("disabled" => "disabled"));1 point
-
I would ask Ryan to make the method hookah Le. So no need for extendingm I think it can be useful in cases like this.1 point
-
For anyone that has the map hidden initially before being opened resulting in bad rendering of the map. I tried the following that was mentioned here on this post but with no success. After a while(2 hours ) scratching my head I changed it to the following: setTimeout(function() { google.maps.event.trigger($("#mgmap1")[0], 'resize'); mgmap1.map.setCenter(mgmap1.options.center); }, 250); Now works perfectly.1 point
-
Hi rusjoan, Sorry you're having a bad experience at the moment, but I don't think it helps to get angry at PW. Just having a quick look, I see a couple of issues with your code. $config->paths will be empty because when you're inside a function you need to use wire('config') or $this->config depending on how you are using it in the module. This is because of PHP variable scope - there are lots of posts about this. Same goes for your use of $user and $input->get Try fixing those and see where you are at. I think there are probably more things amiss, but let us know what happens with those changes first. If you are calling the module on a use specific basis in your templates, which I think is what you are doing, then autoload false makes sense.1 point
-
Already a bunch of good resources, but here's a couple more: Especially if you're at "absolutely beginner" level, there's a ton of useful video tutorials floating around. This one titled "Learn PHP in 15 minutes", for an example, seems pretty good. For more background there are also more thorough videos, such as this Harvard extension school lecture. Once you get up to speed, you should most definitely take a look at PHP: The Right Way. If you're really into it, I'd strongly suggest Programming PHP from O'Reilly. It's available as an ebook too. Another book worth checking out is Essential PHP Security. Short but good -- if every PHP developer knew at least this much about security best practices, PHP world would be a lot safer place. Just my two cents. Totally random fact: Designing Web Graphics by Lynda Weinman was one of the very first web design books I could get my hands on. That was some fifteen years ago, when quality learning material was still kind of scarce, at least around here. Should probably take another look at that book one of these days, could be sort of fun1 point