Leaderboard
Popular Content
Showing content with the highest reputation on 11/25/2012 in all areas
-
For those that wanted field/template categorization, I've got them implemented for fields and now development the same for templates. This is one of those features that don't take effect until you use it. The hope is that it won't add any complexity for those that don't need it. There is now a "tags" field on the 'advanced' menu of any field: You can populate that field with one or more tags. Read the description in the screenshot. When you populate that tags field, suddenly the fields list starts grouping them by tag, like this: You can make a tag group appear collapsed by default by prepending a "-" to the tag. Any field can have multiple tags. It'll appear in as many groups as it's defined in. This isn't yet on the dev branch -- I will push it tomorrow after finishing up the Template tags. Can anyone else duplicate in 2.2.10 dev branch, DB session support module installed? I've never been able to duplicate it, but followed the official instructions on the solution to this issue so afraid to change much more until it's repeatable.4 points
-
I have just finished (ish) my first Processwire website: http://www.stonywebsites.co.uk/ It is a very basic site, but it uses Twitter Boostrap for the framework and also the Bootstrap Carousel on the front page. Graphics are all mine, though I am no artist, I am a writer and composer, so be kind. This was a rebuild of a site that was originally on Joomla with Seblod, but I decided to move to PW. One Problem: I used the Profile Exporter to move the site from development. But I had one issue - the paths to the images were wrong. The site was developed in a sub-directory on my local machine, and the image paths had that sub-directory as part of their address. I assume that on the dev site I had something wrong somewhere - what should I have done to stop this happening? Joss3 points
-
Hey, the art is better than anything I could draw~ But it DOES give me a bit of a clip art feel, perhaps photography would be more effective? Works well as icons though. I think its good you help write copy... I'm just starting out, and copy is where project flow really suffers a lot of variance depending on the client~ I'm looking to better that process Also, I noticed a little typo: "who has been in the advertising, marketing and media world for thrity five years"1 point
-
My apologies since I misunderstood you. The way you've done it seems fine to me. You can also create a pageArray: $happyPeople = new PageArray(); foreach($items as $people) { $happyPeople->add($people); } Now you manipulate the array like sorting, shuffling or all other stuff using the API. Not tested, written in browser.1 point
-
There are a growing number of JQuery HTML5 editors out there that are worth looking at. Aloha has already been mentioned and the Developer is really up for getting it into other systems and can be pretty helpful. Redactor is nice, but it is not free. wysihtml5 is a straight forward choice and there is a version for Bootstrap that would be interesting if the admin was using Boostrap. Mercury is an amazing editor, but would need a bit of thought as visually it works as a top browser bar. It works on rails, but can be used without at well. There are a lot of others out there. I think it depends what you want, really. If you are using textarea fields and only want very basic formatting, then these JQuery editors are very good indeed. But, if you want all singing and dancing, which is fine for a personal site, then CK and TinyMCE are still the ones. Offering a selection would certainly be useful! joss1 point
-
Do you want to build a form to edit data on a page or is it on another page? Is it possibly a PW user? So it's not the "page" you're looking at, like in the admin backend edit screen? In this case you could load the edit screen of PW with /processwire/page/edit/?id=$page->id and add a &modal=1. If you load that edit link using fancybox iframe feature you get something like adminbar module. So if you enter /processwire/page/edit/?id=1&modal=1 you'll get the edit form without the layout around. Of course this is only for trusted users, as you could remove the param and edit other things like publish, hidden etc. But it's a nice alternative to edit pages data without leaving the frontend page. But if you are wanting a community user to edit his "profile data", which isn't necessary on the page he's viewing or only part and you will code a form to edit the data he can, you simply make a file with the view profile and for edit profile. In your page template for the profile you then simply include one or the other depending on the url segment. Or make the two views they're own physical page. Kinda obvious it would look like this with segments and include. if(count($input->urlSegments) == 0){ include("view_profile.php"); } else if($input->urlSegment1 == 'edit'){ include("edit_profile.php"); } In a edit template to edit profile user data, I for example do something like this: if($user->isLoggedin() && $user->hasRole('beratung-user')) { // logged in $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'profil-form'); $field = $modules->get("InputfieldText"); $field->label = "Last Name"; $field->attr('id+name','last_name'); $field->required = 1; $field->value = $user->last_name; $form->append($field); $field = $modules->get("InputfieldText"); $field->label = "First Name"; $field->attr('id+name','first_name'); $field->required = 1; $field->value = $user->first_name; $form->append($field); $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $field->value = $user->email; $form->append($field); $field = $modules->get("InputfieldText"); $field->label = "Username"; $field->attr('id+name','name'); $field->required = 1; $field->value = $user->name; $form->append($field); $field = $modules->get("InputfieldPassword"); $field->label = "Password"; $field->attr("id+name","pass"); $form->append($field); $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Save"); $submit->attr("id+name","submit"); $form->append($submit); // process form if($input->post->submit) { $form->processInput($input->post); if(!$form->getErrors()){ $user->of(false); // outputformatting off $user->name = $sanitizer->username($input->post->name); $user->first_name = $sanitizer->text($input->post->first_name); $user->last_name = $sanitizer->text($input->post->last_name); if($input->post->pass; != ''){ $user->pass = $input->post->pass;; } $user->email = $sanitizer->email($input->post->email); $user->save(); $user->of(true); // outputformatting on $session->message("Profile saved"); $session->redirect("./"); // redirect to get rid of double post when refreshing } else { // error message are already added by form->processInput() call } } $out .= $form->render(); } else { $out .= "<p>You don't have permission to view this page.</p>"; } ?> <section class="clearfix"> <h1>Edit your Profile</h1> <?php if(count($notices)) include($config->paths->templates . "inc/notices.inc"); ?> <?php echo $out; ?> </section>1 point
-
Here are some more recent 2.3 additions that are currently in the dev branch. This list is far from complete, but covers the more interesting ones: Admin Theme The default admin theme now handles long titles better. If you are editing a page with a really long title, it will dynamically reduce the size of the headline in the admin theme so that it can fit. After a certain point, if it still won't fit, then it will wrap it. If you try to make a headline as long as a paragraph, then you are on your own though. Inputfields Added the 'side-by-side' (inline) option to Checkboxes and Radios Inputfields. This lets you have them all display on one line, floated, rather than placed in columns. To do this, specify "1" for the optionColumns setting. Added ability for PageEditImageSelect to select images from within repeater fields on a page. Update InputfieldDatetime to support i18n jQuery UI translation files with the datepicker. TinyMCE: Add config option to ProcessPageEditImageSelect enabling you to turn off the population of width/height attributes in TinyMCE inserted images. This is desirable for responsive images. To configure this go to Modules > Process > Page Image Select. Sanitizer Added new $sanitizer->entities($str); method, which is the same thing as htmlentities($str, ENT_QUOTES, 'UTF-8'); Added $sanitizer->emailHeader($str); method that does what it says (sanitizes an email header). $sanitizer->url(); will now optionally accept query strings. Comments Fieldtype Add new 'redirect after post' option which makes the Comments form perform a redirect after a comment is submitted. This prevents the possibility of duplicate submissions and enables the user to see their posted comment immediately (when applicable). To enable, see the 'details' tab of your comments field. You can now search the contents of comments fields from $pages->find() selectors in the same way you search text fields. Example: $pages->find("comments*=some text"); Added new 'website' field option to comments fields. To enable, check the box in your comments field 'details' tab. Added Gravatar support to comments fields. To enable, select the Gravatar rating in your comments field 'details' tab. Added option to not send notifications to admin when comment is detected as spam. Some of us were getting dozens of emails a day from spam bots making the rounds through our sites, so this prevents that from annoying us. Added new gravatar() method to Comment class that returns the Gravatar image URL (this is a convenience for those implementing their own comment output). File and Image Fieldtypes Add new 'tags' option to FieldtypeFile. This gives you the option of specifying a 'tags' field with each file/image. From the API, you can then retrieve a files/images by tag using $page->files_field->getTag('some-tag') to retrieve first match or $page->files_field->findTag('some-tag') to retrieve all matching files. Previously you could only retrieve files/images by filename or index. You can also use "[field_name].tags=[tag_name]" in $pages->find() type selectors. To enable tags for any files/images field, see the checkbox on the field details tab. (Note that this also affects InputfieldFile, Pagefile, Pagefiles, FieldtypeImage, InputfieldImage, Pageimage, Pageimages). Add support for secured pagefiles. Now unpublished or non-public pages may have their files (in /site/assets/files/...) protected from direct URL access. For existing installations, you need to add $config->pagefileSecure = true; to your /site/config.php in order to enable this capability. See also $config->pagefileUrlPrefix and $config->fileContentTypes in /wire/config.php, if interested. Files become secured when the page is not accessible to the 'guest' role. Functions/Methods Add new methods to WireArray class: replace(), findRandom() and findRandomTimed(); Name of the last one may change to findRandomInterval before 2.3 is final. Add new wireRmdir() function, to go along with the existing wireMkdir(). The wireRmdir() function works the same as PHP's rmdir() except that you can specify a second boolean argument to make it recursive. This essentially results in a directory prune function that not just removes the directory, but everything in it, recursively. Be careful with this! Add new wireSendFile($filename); function that works as a file passthrough script. This is used by the new secured file functions, but also available for your use should you want it. Add new wireRelativeTimeStr("timestamp or date string"); function that provides a relative time string like "1 minute ago" or "10 hours ago" or "5 minutes from now" type string.1 point
-
That's correct, when you add new permissions (via Admin > Access > Permissions) you are adding it for your own use so that you could check if a user has it. You would edit any user roles that you want to have the permission and check the box so they have the permission. Then in your template code, you would check if the current user has that permission via a check like in Diogo's example. You can also just specify the permission name, which is more common to do: if($user->hasPermission('spam-nico')) { for($n=0; $n<999; $n++) mail('hi@nico.is', 'Hi Nico!', 'Would you like some spam?'); }1 point
-
[quotamos]This is really interesting stuff and I'm learning so much from it. I've already tested Soma's code and it works very well. Is there a way of configuring $form->render() so that it outputs different html (divs for ul/li etc.)? [/quotamos] you.can usage. $form->setMarkup(); und $form->setClasses(); two.set markups und html caresses. see.eliamos /wire/core/InputfieldWrapper.php1 point
-
Do you get paid for the sites that you would with PW? When you come to the forums to get help, do you limit your questions purely to development work that you are doing for free? I originally developed PW to help us all create better sites in less time, and with more fun. I'm hoping that PW is helping others to be more competitive in all ways, including financially. But recognize that PW did not come into existence on its own. Years worth of time and money has gone into making ProcessWire happen. If you are using ProcessWire to develop sites you get paid for, then you are profiting from ProcessWire. And that's fine with me, no ROI is expected or wanted--I've never asked anyone for anything. But it is disheartening to hear a user make a statement with the implications yours makes. Form Builder is not about making a profit. I don't expect that I will ever make enough on it to offset the actual time investment on it. My hope is that eventually it will be something where the community and myself have split the cost to create. If I wanted a profit, I would go make a Form Builder for WordPress or Drupal where the user base is large enough for that potential to exist. Form Builder is a tool that wouldn't exist if I had to fully self fund it. It's also an experiment to determine if I can reduce my client workload and substitute some of it with ProcessWire-related development that benefits all of us. But I can't substitute something that supports my family with something that doesn't. Form Builder is here to benefit you, not me. If you build sites for a living (or even a hobby) it's going to pay for itself the first time you use it. If you previously spent half a day building a form, now you can spend minutes and get a better, more secure and capable result that can do all sorts of things with the results it collects. Also want to note that Form Builder is something completely different from the original subject of this thread and I don't view them as similar products at all. Likewise, Form Builder is completely different from something like Zend Form or others like it. One does not preclude the use of the other and we should all keep more than one tool in our forms toolbox. I fully support Clinton's project and any others that benefit forms in ProcessWire. Forms are one of the most diverse and important aspects of web development. I feel very confident about the value of Form Builder in your toolbox, so have made it 100% refundable if you find it isn't for you (this type of return policy is pretty rare with digital products).1 point