Leaderboard
Popular Content
Showing content with the highest reputation on 07/14/2013 in all areas
-
Just finished another one: http://www.hirschenhotels.com Their styleguide is a bit weird for a "romantic" hotel. Futura as font and these green/red colors are not ideas of mine ;-) On the PW side pretty regular stuff, mostly core functions.2 points
-
Hey all, I thought this might be useful for anyone who uses preprocessing tools (like the excellent CodeKit: http://incident57.com/codekit). I came across Prepros the other day: http://alphapixels.com/prepros/ I always used CodeKit up until recently. However, it's only available for mac and recently I have had to dip my toes into the waters of the dark side again with a PC laptop I needed something that would work cross-platform (Prepros works across PC, Mac and Linux). From what I have seen so far Prepros is growing quickly, free, supports nearly every type compiled CSS, has real time refreshes and works across platforms.2 points
-
Kyle, I pointed you to Soma's Gist that has multiple examples. Am I missing something here? Have a look at these... https://gist.github.com/somatonic/5236008#file-form-php-L88 https://gist.github.com/somatonic/5233338 (scroll all the way down to the next file as well - https://gist.github.com/somatonic/5233338#file-form-upload-php-L30) Edit: More links: http://processwire.com/talk/topic/2597-multiple-image-bug-when-using-api-resolved/ http://processwire.com/talk/topic/1530-setting-image-description-with-multiple-image-upload/ http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/page-2 http://processwire.com/talk/topic/3134-basic-image-file-upload/ http://processwire.com/talk/topic/2217-user-generated-content-with-images/ Google search works better than the Forum search1 point
-
So it is, problem solved. Worst thing, i had read the docs about single and multiple images fields... mmm, guess is a newbie "thing", stuck in a problem with the solution right in front of you. Thank you!1 point
-
Just testing out HTML purifier with a /test.php in my webroot: <?php include("./index.php"); $purifier = wire('modules')->get('MarkupHTMLPurifier'); $text = "<pre class='test' onclick='alert(1)'>Test</pre><script>alert(2)</script>"; $text = $purifier->purify($text); echo htmlentities($text); Result: <pre class="test">Test</pre> I have a feeling it's CKEditor that's stripping out your <pre> class attribute. Try adding "pre[class]" or "pre[*]" or "*[*]" to your extraAllowedContent rules in the latest CKEditor inputfield to see if that corrects it?1 point
-
Thanks for posting this Matthew. A couple things I found that I wanted to mention, since this is a front-end form: // Set a temporary upload location where the submitted files are stored during form processing $upload_path = $config->paths->assets . "files/contact_files/"; You want your temporary upload path to be a non web accessible path. Also, if you've got multiple users uploading at the same time, it seems like there is potential for filename collisions, though not sure how big of a concern that is in this case. But you can at least make the directory non web accessible by preceding it with a period, i.e. ".contact_files" rather than "contact_files". $other_photos->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); Keep in mind that WireUpload is only validating the extension. It is not telling you for sure that it's an image. It could very well be some kind of executable with a jpg extension. I don't necessarily know how such a thing could be exploited, other than that I'm not so comfortable with letting a front-end user upload files that end up untouched in a publicly accessible directory. What would probably be safer is to make a new copy of any uploaded images before adding them to the page, and validate the size is within allowed limits while you are at it. $error = ''; $imageInfo = getimagesize($pathname); if($imageInfo) list($width, $height) = $imageInfo; if(!$imageInfo) { $error = "Image is not valid"; } else if($width < 105 || $height < 105) { $error = "Image is too small"; } else if($width > 1600 || $height > 1200) { $error = "Image is too big"; } else { // create your own, slightly smaller copy $sizer = new ImageSizer($pathname); if(!$sizer->resize($width-10, $height-10)) $error = "Unable to resize image"; } if($error) { unlink($pathname); echo "<p>Error: $error</p>"; } else { // add image to page }1 point
-
What you're seeing happens because your featuredImg returns "Pageimages" (multiple images) instead of one Pageimage object and that URL points to where they all reside. I'm guessing your featuredImg isn't limited to only one image via field settings? You need to do either that or specify which image you want, like this: <?php if(count($page->featuredImg)) echo "<img src='{$page->featuredImg->first()->url}'>"; ?> By the way: when dealing with multiple images / Pageimages object, you'll have to check with count() if any images actually exist. With one Pageimage you can simply check if $page->featuredImg evaluates to true (like you did in your code above.) Edit: looks like I'm too slow today..1 point
-
Hello ideagonal, welcome to the forum! My guess is that the field that you are trying to output is a multiple images field. Try this, and you'll see it will work: echo "<img src='{$page->featuredImg->first()->url}'>"; What I did there was output explicitly the first image in the array. But if you are planning to have only one image on that field, the best would be to limit it to 1 in the field option. This will transform this field in a single image field, which would work straight with the code you used. For how to use multiple images, read this: http://processwire.com/api/fieldtypes/images/1 point
-
@kyle... An example right of the docs to give you an idea..See line 9; it shows an example of adding 1 image. For several, you will want to foreach...there are several posts about this in the forums. Can't find them atm; you might want to search if you are still stuck $skyscraper = new Page(); $skyscraper->template = $templates->get("skyscraper"); $skyscraper->parent = $pages->get("/cities/atlanta/"); $skyscraper->title = "W-Hotel Tower"; $skyscraper->height = 400; $skyscraper->year = 2009; $skyscraper->body = "This is a nice hotel and it has a helicopter landing pad on top of it."; $skyscraper->save(); $skyscraper->images->add("http://starwoodhotels.com/w-atlanta.jpg"); $skyscraper->save();1 point
-
@kyle: Just tried creating pages via API in PW 2.2.9 and 2.3.1 and in both setting template, title and parent was enough, name wasn't needed.. and like @Wanze and others pointed out above that way PW automagically creates unique names. Then again, I can't really remember how this stuff worked in earlier versions, so perhaps it hasn't always been quite as simple.. Anyway, even if setting name and making it unique yourself is necessary, I'd still suggest using built-in $sanitizer (in API context wire('sanitizer')) for sanitizing your page name instead of own custom code. This way you'll get page names that are 100% compatible with PW (and with less code.)1 point
-
Mr. Gazley Dark, I recognize from your picture, you eat at Roderigo kitchen Thursday? Glad you like special meat boat. Good to see a customer here. Maryla talk about you. You availiable for web designing?1 point
-
Hi Barry, Are you saying that you still can't reorder the posts in the admin? I have a test version of the blog profile (latest version) running in PW 2.3 (stable). If I Edit the 'Blog Posts' page and set 'Children' > 'Children are sorted by' to 'Manual drag-n-drop' (under the 'Sort settings'), then reordering works fine for me. However, this doesn't change the render settings for the frontend of the site (which are still rendering '-date' sort order irrespective of the order in the admin area). You can look into 'blog.inc' under the function 'renderPosts' to change this. Set 'sort=sort' instead of 'sort=-date' to ensure that the manual ordering in the admin area is respected.1 point
-
Hmm, I must confess that the PageAutocomplete was in a Repeater that was in a tab . But I'm happy to report that in the dev branch the PageAutocomplete does work in a Repeater which is in a tab. I just realized that I like more to see all the already defined tags, so I'm keeping the AsmSelect. When time and brain allows, I'll try to see if I can cobble together a Page input field like the tags field from MODx 2.x. Also I'm happy to report that my slideshow is coming up nicely. Thank you all! Oh, and I absolutely love the way ProcessWire makes whatever I want it to do. Ryan, you should embed The Three Laws of Robotics in ProcessWire before it's too late!1 point
-
Exactly what diogo said. So if your thumbnail image field is called "thumbnail" then replace the img src with $child->thumbnail->url (or if it hasn't been specifically set to only allow one image to be uploaded to that field it might be $child->thumbnail->first()->url if the field is set to allow multiple images).1 point
-
on the image src you have the child url, when what you should have is the thumbnail url.1 point
-
This might help: http://www.lynda.com/Foundation-tutorials/Up-Running-Foundation/122442-2.html1 point
-
After reading a few more threads relating to this it seems like the obvious answer is to just upgrade php versions on my dev and local servers, which has worked. I think having 5.3.3 was the primary source of my issues.1 point
-
Akismet needs a key, here's a quote from this page: The only thing that has changed is that wordpress no longer provide API keys.1 point
-
Greetings, When I started this discussion, my goal was to pull together various renditions of code that were being discussed in forum discussions and create a single full example people can use to make front-end page submissions, and to also do this with photos. This is a vital part of building the kinds of sites that are really exciting with ProcessWire. I have now used the techniques detailed in this discussion for several projects, including one where I am building a completely custom front-end interface with page submission and page editing (more on that soon). In my first post in this discussion, I have the "unlink($pathname)" included in the routine. This removes the temporary image. Horst makes reference to the same code posted by Ryan. HANDLING MULTIPLE FILE-UPLOAD FIELDS IN THE SAME FORM Since starting this discussion, I have also added multiple file uploads in the same form. The steps are pretty easy. Below is my original code from post #1, with additional code for a second file-upload field (indicated with "[NEW CODE]"): <?php// First, confirm that a submission has been made if($input->post->contactname) { // Set a temporary upload location where the submitted files are stored during form processing $upload_path = $config->paths->assets . "files/contact_files/"; // New wire upload $contact_photo = new WireUpload('contact_photo'); // Reference field name in HTML form that uploads photos $contact_photo->setMaxFiles(5); $contact_photo->setOverwrite(false); $contact_photo->setDestinationPath($upload_path); $contact_photo->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // Second wire upload (other_photos) [NEW CODE] $other_photos = new WireUpload('other_photos'); // Reference field name in HTML form that uploads photos $other_photos->setMaxFiles(10); // Allow 10 other photos $other_photos->setOverwrite(false); // Use the temporary location set above $other_photos->setDestinationPath($upload_path); $other_photos->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // execute upload and check for errors $files = $contact_photo->execute(); $other_files = $other_photos->execute(); // [NEW CODE] // Run a count($files) test to make sure there are actually files; if so, proceed; if not, generate getErrors() if(!count($files)) { $contact_photo->error("Sorry, but you need to add a photo!"); return false; } // Set up submissions in the ProcessWire page tree $np = new Page(); // create new page object $np->template = $templates->get("contact_submission"); // Set template for pages created from form submissions $np->parent = $pages->get("/customer-service/contact-us/contact-submission-listing/"); // Set parent for pages created from form submissions // Send form submissions through ProcessWire sanitization and apply each to a template field for the new page $np->of(false); $np->title = $sanitizer->text($input->post->contactname); $np->name = $np->title; $np->contactname = $sanitizer->text($input->post->contactname); $np->email = $sanitizer->email($input->post->email); $np->comments = $sanitizer->textarea($input->post->comments); $np->save(); // Run photo upload for "contact_photo" foreach($files as $filename) { $pathname = $upload_path . $filename; $np->contact_photo->add($pathname); $np->message("Added file: $filename"); unlink($pathname); } // Run photo upload for "other_photos" [NEW CODE] foreach($other_files as $other_file) { $pathname = $upload_path . $other_file; $np->other_photos->add($pathname); $np->message("Added file: $other_file"); unlink($pathname); } // Save page again $np->save(); ?> <p>Thank you for your contact information.</p> <?php return true; } else { ?> <p> Sorry, your photo upload was not successful...</P> <?php} ?> And here is the updated submission form that would connect with the above code: <form action="/customer-service/contact/contact-success/" method="post" enctype="multipart/form-data"> <p><label for="contactname">Name:</label></p> <p><input type="text" name="contactname"></p> <p><label for="email">E-Mail:</label></p> <p><input type="email" name="email"></p> <p><label for="comments">Comments:</label></p> <p><textarea name="comments" cols="25" rows="6"></textarea></p> <p>Click the "Select Files" button below to upload your photo.</p> <input type="file" name="contact_photo" /> <input type="file" name="other_photos[]" multiple /> <button type="submit">Submit</button> </form> Points to keep in mind: 1. Add a WireUpload action for each photo-upload field, setting the rules for each one. 2. Add a separate "execute" action for each photo-upload field. 3. Add a separate foreach loop for each photo field you need. 4. If the file-upload field is for multiple files, make sure that the setMaxFiles() action matches what you set in the admin panel for that field. 5. In your form, if the file-upload field is for multiple files, specify the name with square brackets, and add the "multiple" designation. Thanks, Matthew1 point
-
Not true. First of all I don't manipulate my prices depending on a potential cash flow. And second, hotels act in a very competitive market, so I wouldn't generalize it ;-) My goal is always to deliver a tool with which my customers don't need any support from me. That's the reason why I use PW. I am not like the old school agencies which deliver TYPO3 only for supporting contracts. My available time is short, I don't want to fix things, I want to create things. Mainly because of another website I did recently: http://hotelderblauereiter.de1 point
-
Don't forget us.. we run on ProcessWire too! http://www.cmscritic.com/feed1 point
-
pjax is ajax + pushstate, a nice way to use regular ajax but having urls changing accordingly to the page you are looking at. ( more here ) Since left sidebar always remains at the same place (and didn't noticed any flashes when i change pages) I thought you were using that method to manage transitions ( it's a good thing IMHO ).1 point
-
Now there's a new idea for a module. I think that regardless of what system you build this in, you'll have a lot of custom work to do just because the needs are quite specific. While this could all be done without add-ons in ProcessWire, it would simply mean that you are coding many capabilities yourself. If you enjoy using ProcessWire, you'd probably love building it. But if someone has already written add-ons for another platform that do exactly what you need, you'd just have to balance that with the cost of your time. By that token, $970 doesn't seem like much. There's no doubt you could build all of this in PW and have a blast doing it, but if you've not used ProcessWire before I'd recommend starting with a smaller project to learn the ropes first.1 point
-
It is technically possible to do all of this in ProcessWire and more, but since some of your needs are unique it would involve writing some functionality yourself. For some of your needs there is likely code available here on the forums which I'm sure someone will point you too soon (I'm typing on mobile), and for everything else the community is here to help you out. The thing with ProcessWire is that almost anything is possible, but I have to ask have you taken a look at the tutorials and familiarised yourself with some of the docs on the website to get a feel for how the system works? At some point early on you will be creating fields and templates to accomplish a lot of this. Of course if you like you could also add your requirements to the Jobs forum and it is possible someone could develop this for you, but it is always good to get stuck in and get a better understanding of the system first if you have the time.1 point
-
Module: TemplateHasTags Simple Module that provides a method for checking if the current template has got (or has not got) one or more specific template tags. Wanted to control the visibility for some blocks on the frontend in the backend without modifying the code. This seemed to be the best way. Returns true if the currently used template: -- has the tag "detail" but not "special" $page->hasTags("detail !special"); -- does not have the tag "listview" $page->hasTags("!listview"); You can also use $page->hasTag("lorem ipsum"); Module link1 point
-
I've always happily used VI (VIM) and always will. But I found a way to make the newest PHPStorm look and behave like VIM, so that's what I'm slowly adapting to. So far I like it, it's a fairly impressive piece of software. Lets me still be in VIM (or at least trick me into thinking I am) while giving me all the power of PHPStorm. I was also motivated by their support of open source–they provided the full license for free for ProcessWire development.1 point
-
Looks like a good creative use of tags there. I hadn't planned on them being used that way, but it seems like a good use case. It makes me think I should add a hasTag() function or something, so you wouldn't have to do something like a strstr() and would instead have reliable word boundaries between tags.1 point
-
ok here's something pulled straight from a place i did this: <?php $gallery = $page->images->findTag('gallery'); if(count($gallery)) { ?> <!-- start gallery --> <?php foreach($gallery as $image) { ?> <!-- image markup here --> <?php } //end foreach ?> <!-- end gallery --> <?php } // end if ?>1 point