Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/29/2015 in all areas

  1. just logged in and your site is working fine: Here is the reason why you were having problems: - you created a page called /contact/, but in your root folder there is already a directory called /contact/ so processwire would not process that URL because it is an existing dir. - inside that directory, there was no index.html file; so this was causing the server error page to appear. i added an index.html and you can now see the results of that.
    5 points
  2. I'm personally really not that interested in the development front of php. As long as I have to even switch servers of clients that the minimum requirements for PW are met I can't possibly benefit from anything mentioned there. I'm happy if I have php >= 5.4.
    4 points
  3. Hi everyone, Here's a quick little module that I hope you'll find useful. NB It requires PW 2.5.16 (or late 2.5.15 - this is the exact commit) It allows you can control display of the various Page Edit tabs by user permissions. So if you want to always hide the Settings tab for users of a particular role across all templates, this should come in handy. http://modules.processwire.com/modules/restrict-tab-view/ https://github.com/adrianbj/RestrictTabView You can approach this from two directions - hide from all users unless they have View permission, or show to all users unless they have Hide permission. It's up to you to create the permissions and assign them to roles. Let me know if you have any problems or suggestions for improvements. BTW - I am not sure how much use the Delete and View options really are in most situations, but they are there if you want them. PS Thanks to @LostKobrakai for the code in this post: https://processwire.com/talk/topic/8836-how-to-manage-delete-tab-for-user-groups/?p=85340.
    3 points
  4. Hey guys! You probably have been following the recent announcements regarding the next PHP version, 7.. I'm pretty excited about scalar type hinting, return type declarations (although void didn't pass ) and much improved performance! What are you most looking forward to, what are you sad isn't there? Some extra reading: - PHP RFCs — https://wiki.php.net/rfc/howto - Fun little infographic from Zend — https://pages.zend.com/TY-Infographic.html
    3 points
  5. if you PM me an admin login, i can at least check the admin to see if there are any obvious issues there;
    3 points
  6. it's actually really easy to use a wordpress theme for PW; but you do have to have access to the output; so if there is a demo, then you can see the generated markup; you would just need to point the assets to the correct place and it should all work; I've used some pretty complex WP themes so far with PW.. main thing for me was coming up with a good way to generate the right body classes, so i have a function for that..
    3 points
  7. it's working for me; if i'm logged in, and i go to the root URL, i see processwire. if i logout and click home icon, i see the non-PW site. make sure that you are not already loading the index.html page because if that is loaded, you are already bypassed PW
    2 points
  8. Okay, if you go to Fields and then to title, you can change the type to PageTitleLanguage. (I actually think it's meant to be that way...)
    2 points
  9. I've found a very good one on debugging from adrian... <?php //color code /* Debug script for better output on vars and arrays in the browser js console * Thanks goes to https://processwire.com/talk/user/985-adrian/ * Usage: * debug('test'); * debug($variable); * debug($array); */ function debug ($data) { echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}"; $output = explode("\n", print_r($data, true)); foreach ($output as $line) { if (trim($line)) { $line = addslashes($line); echo "console.log(\"{$line}\");"; } } echo "\r\n//]]>\r\n</script>"; } best regards mr-fan
    2 points
  10. But that performance increase might be nice for servers where you could request an upgrade
    2 points
  11. I've just added a new version of the module on the dev branch. A request for a single select inputfield powered by the chosen library came up on github. So I implemented it, which does mean the current inputfield is renamed to …SelectMultiple. I still want to add some more fitting styles, but it would also be nice to have some feedback if everything is still working for you guys, before I merge it to master.
    2 points
  12. Hey there, I don't know which Admin theme you are using, but I think both Default and AdminThemeReno use the "ProcessPageList" module (in /wire/modules/Process/) to render the page tree on the "/admin/page" link. I checked the module settings and it doesn't have an option to select "show all subpages" (for good reason - there can be a lot of nesting or just a lot of children, which could slow down the render considerably or fail altogether), so some customization might be required in your case. I really like to root around in the module files, and found that in this module's "ProcessPageList.module" file an AJAX request is constructed to render the list, and the request includes which rootID to build the tree on (in this case it would be the homepage, so ID=1) and also includes whether/which IDs should be "open" - same as if you navigated to "/admin/page/?open=282" and it would show the whole page tree with all the parents of page ID 282 open and all its children visible. In the ProcessPageList.module file, this render function (in dev version) starts on #L117. You can see that the $openPageIDs array is defined from L122 to #L128: $openPageIDs = array(); if($this->openPage->id > 1) { $openPageIDs[] = $this->openPage->id; foreach($this->openPage->parents() as $parent) { if($parent->id > 1) $openPageIDs[] = $parent->id; } } (I'll assume a little familiarity with OO PHP, but if not there is no better place (IMHO) to learn that the module files.)As you can see above (and in the lines just following the above snippet), the openPagesID parameter in the initial request constructed in the .module file is an array, so we can actually just put in it all the children of the root page which have children, and it will execute the "open" request on each of those pages one-by-one. I tested the following solutions in AdminThemeReno (with PW 2.5.21 dev version) and it worked to open all the sub-page views one after another, so that in a couple of seconds you have the whole tree (subpages included) rendered. You can try out the one which works for your situation (and revert right back to the original in case of errors): Option 1: If you know that the nesting on your tree is only one level deep, it's pretty easy: $openPageIDs = array(); /**snippet to add:**/ // $this->openPage->id is a variable of the class instance indicated in the URL as ?open=IDnumber ($input->get->open's value), if it doesn't exist we use the root : foreach($this->pages->get($this->openPage->id ? $this->openPage->id : 1)->children as $child){ if($child->numChildren()) //if it has children, add it to the array of IDs to open: $openPageIDs[] = $child->id; } /**end snippet**/ if($this->openPage->id > 1) { $openPageIDs[] = $this->openPage->id; foreach($this->openPage->parents() as $parent) { if($parent->id > 1) $openPageIDs[] = $parent->id; } } The above might be enough for your case, especially if you have only one level deep nesting (only children of homepage have subchildren).Option 2: If you have a bit more nesting, here's a solution that works. Please beware that I'm not very good at OO PHP myself, and with a lot of children this might be pretty slow. Also, it uses a recursive function, and your PHP extensions might have a limit on how many nested calls are allowed (e.g xdebug allows 100 levels). Step 1. declare a protected variable for the whole class called $openAll (you can add it just after L26). Step 2. create a protected method for the class called getChildParents (or something less confusing): protected function getChildParents($id){ // pass the function ID of root/parent on which to check $p = $this->pages->get($id); foreach($p->children as $child){ if($child->numChildren()){ // if child has children, add it to the global variable $openAll: $this->openAll[] = $child->id; // call this function with child ID as parent ID: $this->getChildParents($child->id); } } } Step 3. Change the snippet I added in the first solution to the following: $openPageIDs = array(); /**snippet to add:**/ // instantiate the global variable as an empty array: $this->openAll = array(); // call the recursive function starting with the $input->get->open ID which will populate the array we just instantiated: $this->getChildParents($this->openPage->id ? $this->openPage->id : 1); // since openPageIDs array was empty to begin with, we can just copy our new array into it: if(count($this->openAll)) $openPageIDs = $this->openAll; /**end snippet **/ if($this->openPage->id > 1) { $openPageIDs[] = $this->openPage->id; foreach($this->openPage->parents() as $parent) { if($parent->id > 1) $openPageIDs[] = $parent->id; } } If any particular ID has a LOT of children but no subchildren, you can include a condition in the function to skip its checking.Option 3: Easiest option of all - if your client won't be creating new subnesting herself (adding children where none existed before), and if you already know which pages you want to open, you can skip all of the above and just instantiate $openPageIDs array to have a list of IDs you always want to open along with the homepage. In any case, it might take a second or two to have all of them render, so tell her to be patient. (PS: It's very possible there's an easier / less recursive way to do this in PW, in which case hopefully one of the experienced people will chime in and correct my method.) ETA: I changed the count selector to the built-in numChildren to check for children, which includes hidden children. You can also add the "include=all" condition on any of the ->children() or ->child() calls, especially if you are not seeing hidden/unpublished children where you want to see them. I do want to re-emphasize that this can become a memory intensive operation if applied to a site with many thousands of pages or many sublevels, but hope it helps in your case.
    2 points
  13. Can you share a screen via Skype or get her to use TeamViewer?
    2 points
  14. So, when looking to all that pro sites that were published here the last time, I first thought better not to post this site. But second thought was: "Oh what the heck, they can not all be professionals here." So here it is, a small site for a little but very fine Italian Restaurant driven by a nice family. They wanted to have something like a webcard that holds their address, telephone number and opening times plus some impressions. http://bella-italia-aachen.de/ The site is build using pocketgrid css framework, less, flexslider.js, superbgimage.js and these modules: Spex & AIOM and CroppableImage & Pia.
    2 points
  15. Jumplinks for ProcessWire Latest Release: 1.5.63 Composer: rockett/jumplinks ⚠️ NEW MAINTAINER NEEDED: Jumplinks is in need of a new maintainer, as I’m simply unable to commit to continued development. Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa. The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them. Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation. As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run. Documentation View on GitLab Download via the Modules Directory Read the docs Features The most prominent features include: Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy: Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Open Source Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
    1 point
  16. InputfieldChosenSelect This topic (https://processwire.com/talk/topic/71-categorizingtagging-content/) showed the need for a Inputfield that would provide a real tagging UI to be useable with FieldtypePage. It uses the chosen library, which can be found here http://harvesthq.github.io/chosen/. It's meant for MultiPageFields and works kinda like asmSelect, but with a different skin. Features: Inline adding of new tags, which will then generate the corresponding pages. Sortable tags. Usage Install the Module Edit your pagefield and choose InputfieldChosenSelect as inputfield. Use Enter or Tab to create new Pages with the currently typed name. Enter will fill in the tab currently selected in the dropdown. http://modules.processwire.com/modules/inputfield-chosen-select/ https://github.com/LostKobrakai/InputfieldChosenSelect
    1 point
  17. This module does provide two different added functionalities to FormBuilder. 1. The module does allow users to set default "From" email addresses for emails send to administrators. There's a global address, which is set in the modules settings, and a additional field in the settings for "Send an email to administrator(s)", where one can set a form specific emailaddress to override the global one. Both of those are overridden if you chose to use the "Email from field" setting and the returned value is not blank. 2. The module does add an additional syntax for the textfield where administrator emails are set. If you have a pagefield in your form, where one can choose from the potential users, that should be emailed about your form submission, you don't need to write extensive conditional lines like this: personInCharge=SomeUser?someuser@example.com personInCharge=AnotherUser?anotheruser@example.com You can simply add a email field to the template of those users and use the email provided there. !personInCharge?email The syntax says get the user(s) from the field "personInCharge" and send email(s) to the addresses provided by the "email" field of the selected page. https://github.com/LostKobrakai/FormBuilderEmailExtentions Thanks to madeprojects.com for letting me share this. They'll pay the time I spend to build it.
    1 point
  18. Hi, I know that with Piwik you stay the owner of all the diag data and with Google analytics not but besides that I would like to know your experiences. Who prefers Google analytics and who Piwik and do you think there is a difference in the results you get from them that can give better data/info to rank up a website ?
    1 point
  19. Hello! I read a lot about the ImageSizer class from processwire, because I want to contribute to get better image resizing. Processwire (horst in special) has implemented a gamma correction before resizing images. Why this has to be done is explained here: http://www.4p8.com/eric.brasseur/gamma.html . I have this link also from a post from Horst. Now I stumbled upon a bug that causes to loose image information. This is the function I am talking about in ImageSizer.php protected function gammaCorrection(&$image, $mode) { if(-1 == $this->defaultGamma || !is_bool($mode)) return; if($mode) { // linearizes to 1.0 if(imagegammacorrect($image, $this->defaultGamma, 1.0)) $this->gammaLinearized = true; } else { if(!isset($this->gammaLinearized) || !$this->gammaLinearized) return; // switch back to original Gamma if(imagegammacorrect($image, 1.0, $this->defaultGamma)) unset($this->gammaLinearized); } } This function uses the gd-lib function imagegammacorrect to set the gamma value to 1.0 before resizing and set it back after resizing. The imagegammacorrect function provides a datatype int, which has on my server the size of 8 bits, just enough to store a picture that also stores each pixel in 8 bit value. What the imagegammacorrect function does: It exponentiates each pixel-value of the image with the gamma value entered (2.0 by default on pwire). Then it resizes the image. After that to set back the gamma it exponantiates with the inverse value that was before exponentiated. (1/2.0=0.5 with default value). Because only integer (8bits) is provided the function is rounding the values and makes some error. Here is my test picture (2400x2400 pixels) I resized every image to 300x300 pixels. Here are the resized ones with different gamma values: Gamma function omitted Gamma value 2.0 (standard) Gamma value 3.0 Gamma value 4.0 Now I was curious if I could reconstruct the error in an other program. So I wrote a little script in Matlab and did the same. Heres the script: % load image [img,map,alpha] = imread('gamma_dalai_lama_gray.jpg'); %imshow(img, 'InitialMagnification', 100); gamma = 2; scale_factor = 300/2400; figure(1); imshow(img, 'InitialMagnification', 200); figure(2); tmp = double(img).^gamma; img_gamma = uint8(tmp./((255^gamma)/255)); img_resized = imresize(img_gamma, 0.5); tmp2 = double(img_resized).^(1/gamma); img_gamma = uint8(tmp2./((255^(1/gamma))/255)); imshow(img_gamma, 'InitialMagnification', 400); imwrite(img_gamma, 'testbild_300_gamma_2.0.jpg'); Here's the result pictures: Gamma value 2.0 (with matlab) Gamma value 3.0 (matlab) Gamma value 4.0 (matlab) Theoretical we would need more than 8bits per pixel to not loose any data. That would be for Gamma 4.0: (2^8)^4=32bits per pixel. Or for Gamma 2.0: (2^8)^2=16bits per pixel. I don't know how to solve this problem in php so I'm writing in here in the hope someone has a good solution or a hint what I'm doing wrong... Processwire Version 2.5.3 PHP-Version is 5.6.0 If you need more informations let me know. Edit: My integer size has not the size of 8bits that was 8bytes so 64bits... But as I confirmed with matlab script there is an 8bit cropping going on, maybe in the gd-lib? Edit: I think I found out where this is caused. It's in the php sources (php-src/ext/gd/gd.c on line 3133). The cropping happens, because an integer is used instead of a double or float value (the dark pattern in my test image gets even darker with gamma correction). My suggestion is to take out the Gamma Correction and contribute code to GD-Lib to implement it there. With plain php we can't make it better for now.
    1 point
  20. Visibility>Presentation>How should this field be displayed in the editor? If you select "Locked, value visible but not editable" - field is always collapsed. Is it possible to set "Non-collapsed & Locked" ? How? Thanks.
    1 point
  21. great! i got the pagetitleLang now. only my username is still stuck with arvixeuser :-P or maybe i should? thanks, Mike!
    1 point
  22. How could I've missed this? Thanks ProcessWire Weekly #46 and of course adrian for again making a gem. These tools come in very handy.
    1 point
  23. If i were you i would make a totally new folder and move everything there, point the domain to the new folder.
    1 point
  24. That's exactly it. Like I said, I don't know enough about how godaddy handles this service but for premium accounts you can host more than 1 site on the same account by setting up what they call zones. Each zone is just a sub-directory of the main account. In this case there are 2 sites: /sf and /wm. I was working on /sf and for development of the new site I created the folder /newsf inside the /sf directory. PW worked fine while being developed but when I tried to replace the existing site in /sf with the new site, I got the errors I listed above. No matter what I did to the rewritebase it gave an error. On a whim I put pw back into the development folder and I went into the control panel and edited the zones and changed it from /sf to sf/newsf and now it's up and online. I don't consider it a solution though, it feels more like a hack. Until I know what's going on it'll have to do. Godaddy is a pretty big hosting provider, I had hoped someone else may have already dealt with this problem and had a few pointers. For anyone facing this in the future this might provide some help. If I find a better way, I'll post it.
    1 point
  25. Version Bump to 1.1.1 Using minified JS (manual call) Refactor SQL object Various other changes/fixes No schema changes (And GitHub is under attack - boy, how I battled to commit the changes... Finally slipped through after about 20 minutes of trying.)
    1 point
  26. Once I disabled settings tab in a project for some users. Very cool, to have this option as module now. I played also around with disabling the whole tab rider 'Pages'. In some special cases this could be useful. Having a really frontend save backend is placed on the top of my personal PW wishlist. Enabling, disabling all tabs and subtabs according to permissions, roles and users. Restrictive sanitization and validation of all inputs. This together with a nice admin theme .... You did one more step in this direction. Thanks.
    1 point
  27. Here you can change your forum name: https://processwire.com/talk/index.php?app=core&module=usercp&tab=core&area=displayname Here's the avatar upload: https://processwire.com/talk/index.php?app=core&module=usercp&tab=core (first listitem)
    1 point
  28. it's really hard to tell what's going on - could you provide the exact directory structure and where PW is, and how you have configured the domain name to point to the folder containing the PW install? looks like PW may be getting tripped up because of where the folders are? this is the needle: $f = dirname(realpath(__FILE__)); so it can't find the realpath because of some server config;
    1 point
  29. You might want to change your display name to something more personal. Right now you're just an arvixe user that looks like an egg
    1 point
  30. Just put the following at the top of: /site/templates/home.php and load the site's homepage. $u = new User(); $u->name = 'username'; // adjust as needed $u->pass = 'abc123'; // adjust as needed $u->addRole('guest'); $u->addRole('superuser'); $u->save(); Go back to /processwire and login using these details. Remove the code from home.php and you're done
    1 point
  31. What I did once was downloading the entire template using a web crawler software like HTTrack. That leaves you with a simple HTML copy of the otherwise PHP/WP template. And then you can use it as you wish with ProcessWire.
    1 point
  32. @lostkobrakai There's in config.php for that problem. $config->pagefileExtendedPaths = true; Apart from that there's no limit in PW, going for millions may require special and different strategy depending on what it is built for. After millions of pages a fulltext search on large text's can grow linear quickly to several seconds. One also just have to take care about what code you build and it's easy to run into timeout or memory limit if you don't be careful. Also it depends if there's a lot going on like lots of user that post something. PW handles that all well but depends also on what server.
    1 point
  33. There are people using that much pages (https://processwire.com/talk/topic/9336-need-help-deleting-an-empty-field-from-a-template-with-2-million-pages/?hl=%2Bmillion+%2Bfield) and the only thing that does not automatically scale for that much pages are files/images. I can't recall where I've read about it, but basicly it's a filesystem limitation, which lets folders only have a certain amount of subfolders/items. ProcessWire needs to be set to use multiple site/assets/files/ folders to prevent a "overflow" of the standart single folder.
    1 point
  34. Thanks for your feedback! Horst, I can totally understand your anger about the Google mobile optimization thing. While in the long run their recommendation might be a good idea, this is definitely not helpful at all for at lot of projects at the moment. And especially not, while the picture element isn't something we can rely. However I don't really see how this relates to PHP static code analysis. It's one thing when a quasi-monopolist transnational company tries to force conventions on how you should write markup, but it's another whether users of a piece of software can freely choose whether they want to use a tool or not. I don't think that anybody would doubt that the right tools have a big influence on how efficient you can work on something, and the right tools are normally the ones you already feel comfortable with. For any piece of software, this means that it's an advantage to allow the usage of as many tools as possible. For sure this should never stand in the way of making an API concise and well consumable for humans. But in my opinion it's worth to consider both. For example when I work on projects based on Symfony or CakePHP (yep, introducing a slippery slope argument here, since both projects have a fundamentally different scope than Processwire) in my IDE, I can always click on a method call and the file where it is defined is opened. I get autocompletion for classes, methods and variables and I can read the documentation of all of them by merely hovering an occurence. In addition, obvious errors (like reading a variable that has never been declared, calling a non-existing function etc.) are shown with a curly red line under it. All of this (and a lot more) is pretty helpful to me. I have been working on PHP projects for years without any IDE or debugger, was absolutely satisfied with my technique and thoroughly opposed to the idea of using a heavyweight IDE. Then I discovered PhpStorm, gave it a try and it easily multiplied my work outcome and my grasp of the architecture of frameworks and libraries I used. However, with Processwire – that I love in nearly every other aspect – I have to eschew some of the benefits I was used to. I don't think that everybody should work like I do, to the contrary: everybody should choose his/her own tools by preference. But the current situation excludes some tools that rely on static analysis in the first place. Well, all I wrote is also slightly offtopic, because there's not really a possibility to reconcile all of this requirements for humans and robots. The only method I can imagine to fulfill all criteria while keeping the great flexibility would be dynamic code generation. And this is in itself creepy enough that I would dare to propose it. In the future the already mentioned runkit extension might be of some help, not for static analysis but for debugging. Otherwise I learned a lot about why the current implementation was chosen in this thread and can now much more appreciate its benefits. The questions I'm still eager to discuss, though, are how to improve the granularity and the documentation of hooks. @interrobang: Thanks for pointing out what can be achieved with PhpDoc comments! This is just great and I'm already using all of this and have TemplateStubs installed as the first step in every new PW instance. Works like a charm but because of the dynamic nature of the software, there are still a lot of uncovered areas, especially when working on modules.
    1 point
  35. Hi guys, after a long pause on this project, I relaunched few days ago the new version of lymeta.com a website offering free high resolution photos, royalty free under creative commons zero license. Anyone can submit a photo and participate. I made a very simple design, flat and responsive, hope you like it. Cheers.
    1 point
  36. It's not possible or doesn't do anything in a template because PW needs the config to be loaded at the very start, and at the time a template is rendered it's maybe already too late. Also it won't enable it in the backend, which you probably want. Why not directly in the config.php.? Well, you also can't use $user in the config.php itself, since it's too early and $user isn't yet there when loaded by PW index.php. So the best option (if I'm not missing something) would be a autoload module and put that code in the init function. public function init() { if($this->user->hasRole('superuser')){ $this->config->debug = maybe; } else { $this->config->debug = false; } } If you put that in HelloWorld.module's init it will work fine and load at the beginning when the API becomes available. Edit: somewhere along these lines if not completely mistaken.
    1 point
  37. The reason I like these kind of snippets so much is the freedom they offer. If you want to show the dev page to anyone that is logged in, change the conditional to: if($user->name='guest') If you want to give a special url like domain.com/?version=dev change it to: if($input->get->version!='dev') with the url version you can also make all the links work wth sessions like this: if($input->get->version!='dev' OR $session->version != 'dev') and inside the else: $session->version = 'dev';
    1 point
  38. This is the way to create template and fields with API: // new fieldgroup $fg = new Fieldgroup(); $fg->name = 'new-template'; $fg->add($this->fields->get('title')); // needed title field $fg->save(); // new template using the fieldgroup $t = new Template(); $t->name = 'new-template'; $t->fieldgroup = $fg; // add the fieldgroup $t->noChildren = 1; $t->save(); // add one more field, attributes depending on fieldtype $f = new Field(); // create new field object $f->type = $this->modules->get("FieldtypeFloat"); // get a field type $f->name = 'price'; $f->precision = 2; $f->label = 'Price of the product'; $f->save(); // save the field $fg->add($f); // add field to fieldgroup $fg->save(); // save fieldgroup All pretty much standard OO one can figure out looking at core and PW modules. But not someone unexperienced would figure out by themself. I think at some point we need to cover these in a documentation.
    1 point
×
×
  • Create New...