Leaderboard
Popular Content
Showing content with the highest reputation on 03/20/2013 in all areas
-
We just launched a new e-commerce website built off of ProcessWire. We worked off of Apeisa's shopping cart module as a base and were able to get the system integrated with Authorize.net's DPM for payments. We had a to do a lot of custom programming for this client as they needed sales tax, promo codes, and different shipping rates for different zip codes. I was delighted throughout the whole process with how much I was able to tailor the editing experience for the client as well as the visitor's experience on the page. The client had several last minute requirements which we would never have been able to implement in the time we had if we were using a different CMS and didn't have PW's API and custom field system. I would like at some point to release some of the new shopping cart code (shipping rates by zip code, sales tax, promo codes) to the rest of the community, but as it stands it's not modularized/generic enough and the code is in too many different pieces to make it practical. If I have time outside of work I will try to see if I can make it more distributable so that I can give back something to PW Special thanks to Apeisa for his input when we were getting started with this. http://www.harkenslandscapesupply.com/5 points
-
Thought I'd point out a fantastic resource for placeholder images. Rather than the usual grey boxes or kittens... http://www.hhhhold.com The usual /300x400 urls apply. Also if you want to avoid seeing the same images crop up again and again, you can use a tiny js file https://github.com/ThisIsJohnBrown/hhhhold-js You won't go back!4 points
-
In 2.3, there are also these two additions (so far, undocumented). Either one returns the number of visible children: $page->numChildren(true); $page->numVisibleChildren; I will be adding these to the API pages, along with all the other 2.3 additions very soon.4 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 Cheerio3 points
-
Hello my PHP addicted friends Since I see so many struggling with JS (read: jQuery) in the forums, here is a good learning resource via Cody Lindley's twitter http://superherojs.com/3 points
-
For those of you who like the module Wanze did, but want to use Piwik like me I Started to port his Module into a Piwik driven module today. If Wanze could stop adding features like a boss, I'm probably finished by Friday and upload it to the modules section. The module will do pretty much the same, in first release there is no 'change date range' option, but I will add this feature definitely. Anyone don't know what I'm talking bout? Watch the Screenshot3 points
-
Hey all, I've converted the ProcessWire 2.3 rules to Nginx. Hope this will help some people Greetings, Niek server { listen 80; listen 443 ssl; root /var/www/example.com/public_html; server_name example.com www.example.com; ssl_certificate /etc/pki/tls/certs/example.com.crt; ssl_certificate_key /etc/pki/tls/private/example.com.key; client_max_body_size 50m; access_log /var/www/example.com/_logs/access.log; error_log /var/www/example.com/_logs/error.log; # ----------------------------------------------------------------------------------------------- # Set default directory index files # ----------------------------------------------------------------------------------------------- index index.php index.html index.htm; # ----------------------------------------------------------------------------------------------- # Optional: Redirect users to the 'www.' version of the site (uncomment to enable). # For example: http://processwire.com/ would be redirected to http://www.processwire.com/ # ----------------------------------------------------------------------------------------------- if ($host !~* ^www\.) { rewrite ^(.*)$ $scheme://www.$host$1 permanent; } # ----------------------------------------------------------------------------------------------- # Access Restrictions: Protect ProcessWire system files # ----------------------------------------------------------------------------------------------- # Block access to ProcessWire system files location ~ \.(inc|info|module|sh|sql)$ { deny all; } # Block access to any file or directory that begins with a period location ~ /\. { deny all; } # Block access to protected assets directories location ~ ^/(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) { deny all; } # Block acceess to the /site/install/ directory location ~ ^/(site|site-[^/]+)/install($|/.*$) { deny all; } # Block dirs in /site/assets/ dirs that start with a hyphen location ~ ^/(site|site-[^/]+)/assets.*/-.+/.* { deny all; } # Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php location ~ ^/(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ { deny all; } # Block access to any PHP-based files in /templates-admin/ location ~ ^/(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP or markup files in /site/templates/ location ~ ^/(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP files in /site/assets/ location ~ ^/(site|site-[^/]+)/assets($|/|/.*\.php)$ { deny all; } # Block access to any PHP files in core or core module directories location ~ ^/wire/(core|modules)/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any PHP files in /site/modules/ location ~ ^/(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any software identifying txt files location ~ ^/(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md)$ { deny all; } # Block all http access to the default/uninstalled site-default directory location ~ ^/site-default/ { deny all; } # ----------------------------------------------------------------------------------------------- # If the request is for a static file, then set expires header and disable logging. # Give control to ProcessWire if the requested file or directory is non-existing. # ----------------------------------------------------------------------------------------------- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|eot|woff|ttf)$ { expires 24h; log_not_found off; access_log off; try_files $uri $uri/ /index.php?it=$uri&$args; } # ----------------------------------------------------------------------------------------------- # This location processes all other requests. If the request is for a file or directory that # physically exists on the server, then load the file. Else give control to ProcessWire. # ----------------------------------------------------------------------------------------------- location / { try_files $uri $uri/ /index.php?it=$uri&$args; } # ----------------------------------------------------------------------------------------------- # Pass .php requests to fastcgi socket # ----------------------------------------------------------------------------------------------- location ~ \.php$ { # Check if the requested PHP file actually exists for security try_files $uri =404; # Fix for server variables that behave differently under nginx/php-fpm than typically expected fastcgi_split_path_info ^(.+\.php)(/.+)$; # Set environment variables include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Pass request to php-fpm fastcgi socket fastcgi_pass unix:/var/run/example.com_fpm.sock; } }3 points
-
hi, same here: my profession is designer and copwriter, not coder. i still have difficulties to think like "real" coders but i'm progressing. however, here is what i found after having discovered pw for me (i came from contao via textpattern to pw and i have some good knowledge of wp too): coding is fun coding with pw is even more fun because it rewards you with success pw gives me the superpower i always wanted when i tried to adapt contao's pre-made markup to my needs you would like to do the same with wp you can do with pw? good luck - go and learn advanced php. beginner skills will not be enough apart from this, i'm not sure if making wp themes is a good business. if i look at themegarden for example it seems quite competitive. why not specialize in custom tailored websites to clients that appreciate it? from my experience, this market is competitive too, but working. enjoy pw!3 points
-
I've been working on an experimental module set that adds 2-factor authentication to ProcessWire with the help of Steve Gibson's PPP one-time-pad system. This is split into two modules; a CryptoPPP library that implements the otp system and a 2-factor authentication module that uses it to add 2-factor authentication to ProcessWire. The 2-factor module adds an additional "Login Token" field to the login page into which the authenticating user will need to enter the next unused token from their one-time-pad. Pages from their pad can either be printed out in advance in a credit-card sized format (with codes being crossed out as they are used as shown here) or the required token can be sent to their registered email address so they don't need to print anything out. This second option requires a good email address be present in the user's account in order for them to be sent the token. Email Delivery To set up email delivery go to the 2-factor module's config page and choose "token delivery via email" and save the settings. Next, make sure that every user who will use the system has a valid email address set up in their account. Upon the first failed user login attempt, the required token will be emailed to the user’s email address and they should then be able to log in. Printing Pages From The Pad If you prefer to print the tokens in a handy credit-card sized format then… Go to your profile screen Expand the “PPP Initialisation Vector” field Hit the “Show Token Cards” button to open a new browser window with the next 3 useful cards Use your browser’s print option to print these out Trim them to size and store ...but make sure you print these out before you enable 2-factor authentication on your account. If you cross out your used codes, you will always know which code to use when logging back in -- and if you forget, the first login attempt will fail and the token field will then prompt you with the location of the correct code to use. Why would I ever want to use 2-factor authentication? If your site is only for you or for people you know use good passwords then you probably never will need a 2-factor authentication system. But it has been shown that many users use passwords that are, well, rubbish not very good and having a second factor can be useful in mitigating poor passwords. As the second factor in this system comes out of a one-time-pad system (meaning it will not be reused) then having the user's password leaked or guessed should not compromise their account nor will having someone spy out the token they are using to log-in as tokens are not re-used (well, not for a very long time.) Known Problems You need to hit the save button after you install the 2-factor module to get it to remember the initial settings. (I guess I'm not setting the defaults correctly at present but pressing the button will allow you to move forward for now) Uninstall of the 2-factor module leads to a lot of warnings. Attachments2 points
-
Ok I copied your code over and starting taking closer look and test. There was so many faults and things to change, I can't name them all. First off, I changed the input submit and changed to if($input->post->submit){..., since contactname in the form isn't required and just personal preference and a good practice. I made sure debug mode in true in /site/config.php. First submit, BANG!!! error: Fatal error: Exception: Can't save page 0: /about/: It has an empty 'name' field (in /Applications/XAMPP/xamppfiles/htdocs/pwprofile/wire/core/Pages.php line 514) #0 [internal function]: Pages->___save(Object(Page)) #1….. So it can't create and save the page because you don't assign a title nor a "name" to the page before saving. I moved the code around to add those. -- Then there was a wierd line: $contact_photo = $input->post->contact_photo; and later: $np->contact_photo = $contact_photo; // being the file POST Maybe a left off when trying something? -- Then after that, the assignment of the upload to the page image: foreach($files as $filename){ $uploadpage->contact_photo = $upload_path . $filename; } $uploadpage? should be $np -- At the end of when errors found you still have the contest_photo instead of contact_photo. // get the errors foreach($contest_photo->getErrors() as $error) $message .= "<p class='error'>$error</p>"; -- All in all nothing special and nothing wrong with the PW code in there, except the page name left out. But with debug mode on an easy spot. I created a gist with a working version of your code here: https://gist.github.com/somatonic/5207537 (I changed template and parent to my default install but nothing to worry about. I also commented out a bunch not needed to make it work.) Still with the validation of the form fields open to do, currently you only validate the upload and show errors.2 points
-
Greetings onjegolders, Thanks for the link. Always like to see nice placeholder resources. Now, if there were only a resource that forced clients to upload proper photos on a live site... Thanks again, Matthew2 points
-
and for those who use chrome https://chrome.google.com/webstore/detail/php-ninja-manual/clbhjjdhmgeibgdccjfoliooccomjcab?hl=en2 points
-
I also know what you're saying, but I have to strongly disagree. I could've write this in any other similar thread. The problem is the code posted in a wysiwyg is "horrible" to read and even copy it. Then after this is working (as with 1000 other code here in the forum), there comes the next who takes this code but need another feature.. then the game start again with same story same code but different bugs issues. What I would like to do is helping how to code and debug, not have 1 million snippets that are sometimes very bad coded and not complete best practice or not even working spooking around the forum. It already happened many times and it will get worse by time. I know what you're wanting to do and I understand, but in the long run what we are practicing here since 2 years is very bad for newcomers. We better this energy and time to help with little tutorials and snippets that are good to start with in a dedicated site/place.2 points
-
Awesome site, well done! Great to see Apeisa's shopping cart module here too.2 points
-
You might want to check out the blog profile, which uses "next/prev" for comments pagination: http://processwire.com/blogtest/comments/ Also, the current version of ProcessWire does include the ability to paginate comments, though it's not particularly automated yet. See the FieldtypeComments::findComments function. While not the prettiest bit of API code, you can use it like this: $limit = 10; // comments to display per page $start = ($input->pageNum-1) * $limit; $selector = "page=$page, sort=-created, start=$start, limit=" . ($limit+1); // find the comments. replace "comments" with the name of your comments field $comments = FieldtypeComments::findComments("comments", $selector); // output the comments echo $comments->render(); // output the pagination links if($input->pageNum > 1) echo "<a href='./page" . ($input->pageNum-1) . "'>Back</a> "; if(count($comments) > $limit) echo "<a href='./page" . ($input->pageNum+1) . "'>Next</a>";2 points
-
For backend hook include additional script. Take a look the InputfieldDatetime.module ___render() is hookable (three underscores) So you would roughly create an autoload module that hooks into InputfieldDatetime::render to initiate that a datetime field is rendered somewhere and a good point to add our script: $this->addHookBefore("InputfieldDatetime::render", $this, 'addScripts'); And in the function add the script like ryan showed. public function addScripts($event){ $this->config->scripts->add($this->config->urls->templates . "your/script.js"); } And it will add it to the admin, when a Datetime field is rendered. Ahhhh form builder! You can add that line from Ryan to form-builder.inc template... You can't change the InputfieldDatetime module itself with hooks, just to additional stuff when a datetime is "rendered".2 points
-
My own website is very out of date. Basically all my extra time now goes towards ProcessWire, and my own website gets no love. It's now a 6-year old site... ryancramer.com is now so old/bad that it probably reflects very poorly now. I need to do a redesign/redevelopment soon!2 points
-
I have added the sharpening and quality-select to Thumbnails-Module2 points
-
Hey Alan, No probs re the docs. Something you might want to consider: Reducing the number of characters in the output character set (by using the distinct charset) does reduce the strength of the generated token somewhat so you may want to consider increasing the length of your generated tokens to compensate for this -- maybe by using 4 runs of 4 chars.1 point
-
Thank you Ryan & Apeisa. You guys are the best Couldn't have done it without you!1 point
-
Greetings, OK, Soma, here's my gist for this subject: https://gist.github.com/MatthewSchenker/5205927 I hope this can make it easier and more productive to work this out -- and better for everyone to use. Also, maybe this can be a spark that gets more of us to Github to work out our code? Thanks, Matthew1 point
-
1 point
-
thank you! ajax - my guideline was this little tutorial: http://processwire.com/talk/topic/225-how-to-work-with-ajax-driven-content-in-processwire/ php - and maybe you will find something usefull here to learn php: http://processwire.com/talk/topic/2994-learning-php/1 point
-
Samuel, The field is automatically part of every page. You can simply echo $page->created_users_id There is also a $page->modified_users_id1 point
-
You could do something very simple, even if it only pulls your twitter and some marked posts from the forum1 point
-
I have figured it out. Following the advice from here: http://processwire.com/talk/topic/1002-cant-upload-imagefiles-problem/ I have added uploadTmpDir which was apparently not set in /site/config.php. Now everything works. Taking advantage from this opportunity, I have a suggestion. Maybe ProcessWire should have this directory set by default? Is there any disadvantage to that?1 point
-
Hi! "Caret" added to 1st level menu if it has a submenu. https://github.com/jsanglier/Bootwire-Starter-Profile/pull/1 Hope this will be usefull to someone.1 point
-
Hey renobird, Late here too, but difficult to sleep when working on a ProcessWire site! You are correct... I was missing that piece! Definitely, that should be there. I added it, and holding my breath I tried the form again. But it still doesn't work. Same result: no errors, and we see the "success" page, but the new page does not appear in the page tree. Other suggestions or ideas? Thanks, Matthew PS: I've edited my post above to keep track of changes. That way, when this discussion is done, there will be a complete example for others to reference.1 point
-
Hi Alan, Try something like this... $key = CryptoPPP::genKeys(); $key = CryptoPPP::keyToTokenBlocks($key, 4, 3, '-', CryptoPPP::DISTINCT_CHARSET); That's off the top of my head and untested. You should get three blocks of four chars from the "Distinct charset" (which should be safe as a GET variable) with a dash between the blocks. You can check the parameters of keyToTokenBlocks here, and here are the characters from the "distinct charset".1 point
-
Hello there and welcome to the forum! Perhaps I'm missing your point, but why not simply use session_id() for this? PW uses PHP sessions under the hood, so this shouldn't be a problem.. of course depending on what you're going to use this information for (You could also grab session ID from $input->cookie->wire, though as far as I'm aware that's essentially the same thing. Note that "wire" is just the default session name set in /site/config.php and if you've changed it to something else you'll have to use that instead.)1 point
-
1 point
-
You'll need to configure this via field settings; by default time isn't visible at all. Note that there are separate settings for field output format and input field format1 point
-
1 point
-
1 point
-
@jan: Klar, sag einfach Bescheid, wenn du Fragen hast oder so ------ Translation: Thanks, just contact me if you have any questions1 point
-
Guys, try to keep other languages than English, PHP and Klingon on translation forums. It is little bit frustrating for us who read all unread topics.1 point
-
Yes, old passwords still work after an update in ProcessWire 2.3. New password hashes (new user or an old user changing her password) are just different in a way that is incompatible with older versions of ProcessWire. So no going back to 2.2 (without resetting passwords) after a password has been changed or new password has been created.1 point
-
Hi Wanze - many thanks - great and simple solution, nice thinking! here is how i finally implemented: <?php $tags = $pages->find("template=tag"); foreach($tags as $tag) { $c = $pages->count("template=audio, tags={$tag}"); if ($c == 0) continue; ?> //filter <li> markup here <?php } ?>1 point
-
I have a vague recollection that this is related to Xdebug. Try deactivating that (in php.ini, I think) and see what happens.1 point
-
Maybe something like this could work: $tags = $pages->find('template=tag'); foreach ($tags as $tag) { $c = $pages->count("tags={$tag}"); if ($c == 0) //... this tag was not assigned to pages, so don't output it with your filter }1 point
-
I think a lot of the users who would use WordPress (especially) but even Joomla and Drupal would probably not be that interested in ProcessWire (and I have no idea how Ryan would cope if half a million users suddenly knocked at the door!) If a lack of instant solutions for every scenario is a weakness for some potential users, then that is a strength for others; those who might not actually want to get their hands dirty, but realise that that is the only way they are going to get the precise functionality they are looking for. For those, ProcessWire is possibly easier than others! On the docs side, various little efforts are happening in various places and will slowly come together. I have 3 tutorials now to get people started, starting with the Basic Website Tutrorial and of course the API section has all the nitty gritty bits, including the invaluable cheat sheet! More will come along!1 point
-
If PHP's garbage collector isn't working right, it'll affect DB sessions too. @joe_g, unless your site really handles that many sessions in a day, you may want to look into your PHP garbage collector settings. The relevant PHP settings are session.gc_probability, session.gc_divisor and session.gc_maxlifetime. We set the gc_maxlifetime automatically based on your $config->sessionExpireSeconds setting, but not the other two. However, you can force specific settings for those by adding lines like this to your /site/config.php file: ini_set("session.gc_probability", 1); ini_set("session.gc_divisor", 100);1 point
-
If the garbage collector on server is set wrong this can happen. The good news, there's is now DB session module in PW since some versions in dev already to handle session via DB. Just install it. https://github.com/ryancramerdesign/ProcessWire/tree/dev/wire/modules/Session1 point
-
There's a nice class WireUpload that makes uploading files very easy. Here a slightly modified example of a site: $upload_path = 'YOUR_TEMP_UPLOAD_PATH'; $u = new WireUpload('avatar'); //avatar is the name of the input-file field $u->setMaxFiles(1); $u->setMaxFileSize(5*1024*1024); $u->setOverwrite(false); $u->setDestinationPath($upload_path); $u->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); $files = $u->execute(); //Actually not sure if this returns an array if you only allow to upload one file, maybe its the filename (string) if ($u->getErrors()) { foreach($files as $filename) @unlink($upload_path . $filename); foreach($u->getErrors() as $e) echo $e; } else { //Save the foto to the avatar field $page->of(false); $page->avatar = $upload_path . $files[0]; $page->save(); $page->of(true); @unlink($upload_path . $files[0]); } As you can see, it's very straightforward to add the image to the avatar field (Pw rocks!)1 point
-
It's easier to read. But my opinion is that it's also difficult to understand where it could lead. With GPL you know you are protected from some big corporation coming in and taking over. It keeps others from exploiting ProcessWire's core in ways we can't predict. Profit motives are limited to what you create with or for ProcessWire, rather than what you do to it. ProcessWire's core remains protected. I'm not saying I'm against MIT, and always think that going "more open" is good and worth considering. I'd love to talk to the Concrete5 folks to gain insight on their choice. But we should never be motivated to change the license because someone misunderstands ProcessWire. We should only be motivated by what's ultimately best for the project and users. Currently I think GPL is a great and safe fit for us. Though I also understand the GPL always opens questions wherever you take it. So it's important for project leadership to answer those questions and be clear so that there is no grey area. I think that's what we've done. Though I always invite more questions.1 point
-
Not even one year ago there weren't any repeaters in PW. And still, we were all happy1 point
-
Welcome to the forum ohthanks! I recommend using pages instead. Maybe something like this: product-page - table-page (data-template) - row-page (data-template) - row-page (data-template) - row-page (data-template) - row-page (data-template) - table-page (data-template) - row-page (data-template) - row-page (data-template) - row-page (data-template) - row-page (data-template) - table-page (data-template) - row-page (data-template) - row-page (data-template) - row-page (data-template) - row-page (data-template) fields in the template: - data1 - data2 - data3 - data4 In the table-page (parent) it is used for the headers. The row-page (child) it is used for data. The template doesn't need a file, only used for storing data. Only populated fields in the table-page (parent), filled with header names are used for the table headers Now you know wich fields to use from the child pages. Each child page is a row in your html table. --- For large amount of data, you can use the import CSV to pages module. ---- I like to use the MarkupAdminDataTable. look in: /wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module it's straight forward & not that difficult to understand. here some sort of example: $table = $this->modules->get("MarkupAdminDataTable"); $table->setEncodeEntities(false); $table->setSortable(true); $table->headerRow(array('name', 'of', 'header', 'items')); foreach($table as $row) { $table->row(array($row->data1, $row->data2, $row->data3, $row->data4)); } echo $table->render();1 point
-
Maybe the chat button on the forum could be replaced by the irc channel. See this http://community.invisionpower.com/files/file/4888-irc-chat-32/1 point
-
It's possible to use <repeater-name>.<field-in-repeater> as a field name. For example: $matches = $pages->find("title|my_repeater.my_field~=$q");1 point
-
Not sure that I know enough about the use case here, but you can get all the fields to edit a page by doing something like this: $page = $pages->get('/'); // get some page // make a form $form = $modules->get('InputfieldForm'); $form->method = 'post'; $form->action = './'; // add the page's fields to the form $form->add($page->getInputfields()); // add a submit button to the form $submit = $modules->get('InputfieldSubmit'); $sumit->name = 'submit'; $form->add($submit); // process the form if it was submitted if($input->post->submit) $form->processInput($input->post); // render the form output echo $form->render(); But I'm not sure how useful this would be on it's own, because it would be lacking all the admin CSS and JS files that make the forms what they are. So these forms may not be all that useful outside of PW's admin side, as many inputfields go well beyond basic form controls.1 point