Leaderboard
Popular Content
Showing content with the highest reputation on 09/24/2013 in all areas
-
Hi everyone, This new video fieldtype extends FieldtypeFile. Video is available via: $page->video_field->url Module automatically creates a poster image of the video on upload and makes this available via: $page->video_field->poster Shows the duration of the video on the title bar, next to the filesize Stores VTT files for subtitles accessed via: $page->video_field->subtitles Formats a transcript from the subtitles, accessed via: $page->video_field->transcript Users can easily upload videos and enter VTT files. The following code is used in the template file. <video src='{$page->video_field->eq(1)->url}' poster='{$page->video_field->eq(1)->poster}' width='720' height='408' ><track kind='subtitles' src='{$page->video_field->eq(1)->subtitles}' srclang='en' /></video> Additional Settings You can additionally set a few different options in the field's Input tab: Number of poster images to generate - if you change from the default of 1, the editing user will be able to select which image they want to use for the poster image Copy poster image to dedicated image field - not necessary but gives you more options of interacting with the poster image(s) Field that you want poster images copied into - only relevant if the option above is checked Try it out (NB: the code is rough - it works, but needs cleaning up. Github: https://github.com/adrianbj/FieldtypeVideo NB: Requirements The module requires ffmpeg and ffmpeg-php, although I can make the latter optional fairly easily. I don't have any requirement checking implemented yet, so if you don't have these, you'll get php errors. Possible future enhancements Ability to specify what frame is used for the poster - either by number, and/or by offering several options to choose from Done! Push poster image to a dedicated image field Done, although could be improved Field for pasting in or uploading closed captions Done, but need to look into multi-language options etc Support for uploading multiple formats of the same video (mp4, webm, etc) and/or automated video format conversion My biggest concern, is how useful this will be to people - how many hosts actually have ffmpeg setup? Do any have ffmpeg-php? Anyone have any ideas for features they'd like to see?8 points
-
A very interesting topic for sure https://www.google.com/search?q=AnnaKus&oq=AnnaKus&aqs=chrome..69i57&sourceid=chrome&ie=UTF-8#q=AnnaKus+how+fast+do+you+type I hope we can stop here.2 points
-
I don't want to complicate things, so until the above is working and understood just ignore this post. If you want the fields to match the theme of the admin, you can use the built in methods to create them. Let's adapt Soma's instructions from here http://processwire.com/talk/topic/2089-create-simple-forms-using-api/ to our example above: <?php if($input->post->submit) { $thought = new Page(); $thought->parent = $pages->get("/thoughts/"); $thought->template = "thought"; $thought->name = time(); // page name can be a timestamp, this will make it unique $thought->title = substr($input->post->thought, 0, 30); // let's make the title match the first 30 characters of the thought $thought->body = $input->post->thought; $thought->save(); // confirmation message with link to edit the new thought echo "<p>A new thought was created. Edit it <a href='{$config->urls->admin}page/edit/?id={$tweet->id}'>here</a>.<br>Create a new one?"; } //create a new form wrapper $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'new-thought'); //create a textarea input $field = $modules->get("InputfieldTextarea"); $field->label = "Thought"; $field->attr('id+name','thought'); $field->required = 0; $form->append($field); // append the field to the form //the submit button $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Submit"); $submit->attr("id+name","submit"); $form->append($submit); //render the form echo $form->render(); ?>2 points
-
Here is an example for how to create the "thoughts pages". Let's say we have all our thoughts as child pages of a "thoughts" page, and that they will have a template name "thought". home -- one page -- another page -- thoughts ---- my first thought (template: "thought") ---- one more thought ---- ... --admin Create a "new thoughts" custom page in the admin (follow the instructions in the module), and paste this to it's template: <?php if($input->post->thought) { $thought = new Page(); $thought->parent = $pages->get("/thoughts/"); $thought->template = "thought"; $thought->name = time(); // page name can be a timestamp, this will make it unique $thought->title = substr($input->post->thought, 0, 30); // let's make the title match the first 30 characters of the thought $thought->body = $input->post->thought; $thought->save(); // confirmation message with link to edit the new thought echo "<p>A new thought was created. Edit it <a href='{$config->urls->admin}page/edit/?id={$tweet->id}'>here</a>.<br>Create a new one?"; }?> <h2>Write a new thought</h2> <form action="" method="post"> <textarea name="thought" rows="4" cols="50"></textarea><br> <input type="submit" value="Send"> </form> What version of PW are you using? Edit: thanks for the edit Pete, I forgot that detail2 points
-
Hey Marty - sorry for taking so long to get back to you - busy day So you could do this with Ajax calls to a PHP script like the following. It would be called whenever someone clicks on a property. This would be a toggle approach, which may or may not be appropriate depending on how the site is set up. In this case, the cookie would store an array of the property IDs. $pid = $page->id; if (!in_array($pid, $favs)) { //add to the array if not already in it $favs[] = $pid; } else { $key = array_search($pid, $favs); unset ($favs[$key]); //remove from array if already in it } $data = base64_encode(serialize($favs)); setcookie('property_favs', $data, time() + 86400 * 100, '/'); Then to read the cookie back in, something like this: $favs = unserialize(base64_decode($_COOKIE['property_favs'])); That will give you an array of page ids that you can use to populate the user's favourites. If you want to go with a combination of javascript and PHP, you can do that also. Firstly, I recommend taking a look at this jquery helper: https://github.com/carhartl/jquery-cookie You can add the property/page id to the cookie using that and then retrieve on page load using PHP. Instead of storing an encoded array, you can also store a separated list of IDs. This example is using raw javascript: if(readCookie('property_favs')){ document.cookie = 'property_favs=' + readCookie('property_favs') + escape('|' + pid) + '; path=/'; } else{ document.cookie = 'property_favs=' + escape('|' + pid) + '; path=/'; } So if the cookie exists, then read it and add on a new pid after a pipe character and escape it so it can be stored in the cookie. If the cookie doesn't exist, create it with the current pid. The jquery cookie plugin will make this cleaner. Remember to use your developer console as it will show you the current cookie contents. In Chrome it is one of the options under Resources. In Firefox I seem to remember installing a plugin for Firebug to analyze cookies. It's really pretty easy once you play around with it. Let us know if you have any specific questions.2 points
-
Here is another thread where we talked about frameworks. If size and flexibility matters, PocketGrid could be a good choice? It's only a grid, nothing more. Very minimal and seems to be very flexible. Looks like you can do anything with it (like doing with PW). But haven't tested it.2 points
-
Field dependencies are coming in ProcessWire 2.4, and I just wanted to give you guys a little preview of it. The development of this new feature is being sponsored by Avoine, the company where Antti works (he also specified how it should work). Field dependencies are basically just a way of saying that one field depends on another. It dictates which fields should be shown in a given context. In our case, it also gets into whether a field is required or not. This short video demonstrates how it works: (switch to the 720p and full screen version, as YouTube's default settings for this video make it impossible to see): // Edit @Adamkiss: Here's link for those on mobile: youtu.be/hqLs9YNYKMM The implementation here is done both client-side and server side. Javascript handles the showing/hiding of fields and the required vs. not required state changes. On the server side, it doesn't process any fields that aren't shown, and honors the required rules. A separate processing occurs both client side and server side, ensuring that the user can't make their own rules by manipulating the markup or post data. These field dependencies can be used with any Inputfield forms. That means you'll be able to use it not just in ProcessWire, but in FormBuilder, and via the API too. It's very simple to use from the API. All you have to do is specify a ProcessWire selector to either "showIf" or "requiredIf" to the Inputfield, and ProcessWire takes care of the rest: // show this field only if field 'subscribe' is checked $inputfield->showIf = "subscribe=1"; // show this field only if 'price > 0' and at least one category selected $inputfield->showIf = "price>0, categories.count>0"; // make this field required only if 'email' is populated $inputfield->required = true; $inputfield->requiredIf = "email!=''"; This feature will be in the 2.4 core (rather than as a separate module), so it will also be ready and available for things like module and field configuration screens.1 point
-
By default, the "Forgot Password" module is not turned on in v2.1. My thought was that lack of such a function is technically more secure (on any site or CMS). Why? Because having such a function active means your password is only as secure as your email (*though see note at end of this message). So I thought we'd start things out as secure as possible and let people adjust it according to their own need. But I'm rethinking that decision, and may change it to be 'on' by default. If you don't already have that "Forgot Password" module installed, it is relatively easy to reset your password with the API. Lets say that you lost the password for your account named 'admin' and you wanted to reset it. Paste this code into any one of your templates (like /site/templates/home.php in the default profile, for example): <?php $admin = $users->get('admin'); $admin->setOutputFormatting(false); $admin->pass = 'yo12345'; // put in your new password $admin->save(); …or if it's easier for you to copy/paste everything on one line, here's the same thing as above on one line: <?php $users->get("admin")->setOutputFormatting(false)->set('pass', 'yo12345')->save(); Replace "yo12345" with the new password you want and save the template. Then view a page using that template (like the homepage, in our example). The password for that account has now been reset, and now you are ready to login. Don't forgot to now remove that snippet of code from the template! Otherwise your password will get reset every time the page is viewed. Once logged in, here's how to install the Forgot Password capability: 1. Click to the "Modules" tab. 2. Scroll down to the "Process" modules. 3. Click "Install" for the "Forgot Password" module. That's all there is to it. You will now see a "Forgot Password" link on your login page. *ProcessWire's "Forgot Password" function is actually a little more secure than what you see in most other CMSs. Not only do you have to have the confidential link in the email, but the link expires in a matter of minutes, and PW will only accept password changes from the browser session that initiated the request. So an attacker would have to initiate the password change request and have access to your email at the same time, making it a lot harder for a man-in-the-middle snooping on your email.1 point
-
Hey guys, another green website from the processwire beginners based near munich. This website is our first REAL PW project - and (for us) one of the biggest sites we‘ve ever built. And actually the first one with a CMS/framework that we did totally on our own. So, don‘t be too negative - but don‘t be too positive either. http://www.roha-gmbh.de There are still many things that are not perfect yet, but since we started to design this website in 2011, it really was time to get it "into the wild" now! Many furniture manufacturers still haven‘t sent their best product images, so that is why there are still some lowres images in there. The project chapter needs some work on the photos as well, but that time will come... The site is not responsive yet, because it wasn‘t our main goal in 2011 - so we only wanted to get it working on tablets and phones, but without any special mobile styles. This will come, but that may take a while. The modules we used: - formbuilder - procache - redirects - versioncontrol - sitemapxml I‘m totally glad I found processwire a few months ago, because at first we planned to get that site done with pure static html. Which would not be TOO nice with about 80 html pages and many, many images (about 400). Finally a few "thank you"s to ryan, soma, diogo (for creating processwire and your help in this lovely forum) and to mademyday (for posting this on twitter, which made me read about processwire). Comments are welcome! Of course!1 point
-
I figured this doesn't trigger when using good old Fredi. The nice thing it would be simple to add support cause of modulotastic PW if($this->modules->isInstalled("FrediProcess")) { $this->addHookAfter('FrediProcess::execute', $this, 'loadTabs'); } Shall I make a PR or would you consider adding it? Thanks1 point
-
Thanks, resetting the passwords through the API worked: http://processwire.com/talk/topic/490-how-to-reset-your-password-how-to-enable-the-forgot-password-function/1 point
-
** UPDATE ** This problem resolved itself. I'm not sure how but I perhaps there was a delay between the files appearing on the FTP server and ProcessWire recognising them...1 point
-
Very nice site! Chapeau, as we say in Switzerland ("hats off"). I especially like the thought-out cross-linking / navigation elements. The bright green + grey texts could be a touch darker, imho (contrast). But that's nitpicking... Content-wise, maybe someone needs to go through the entire site and do some proofreading? i.e. Did Michaela Sell recently marry? Her name on the team-pic is Michaela Krug, not Sell "Individuelle Neugestaltung einer Gewerbefläche in einem Zweifamilienhauses mit einem Empfangsbereich"1 point
-
Just want to add that you can use PW's $input to access cookies: $input->cookie->property_favs1 point
-
Great stuff Adrian. Using cloud service like http://zencoder.com/en/ or http://features.encoding.com/ might be good option too.1 point
-
@adrian: this sounds awesome and definitely fits some of our needs just fine.. so thank you very much for working on this! Regarding ffmpeg and ffmpeg-php, I've just tested two hosts and one had both of those installed. Other host is my Linode VPS which, as expected, didn't (and shouldn't) have them yet. I don't think this kind of requirement is such a big problem really, especially since this kind of field can IMHO be most useful in slightly larger projects, where getting a proper host shouldn't be an issue. YouTube is just fine for most others. Have you seen https://github.com/CodeScaleInc/ffmpeg-php, by the way? I can't speak for it's quality as I've never tried it, but it might be worth considering as an option to ffmpeg-php. Probably not a good default though, as a PHP extension would most likely have some advantages, such as speed (C vs. PHP.) From your feature list "automated video format conversion" sounds like the most important one to me. Unless I'm mistaken, video element only takes us halfway there; visitor's browser still needs to support each video format used and thus conversion + some kind of player sounds like the best option. One system I've been working with has something similar as this, though it by default converts all other formats to FLV and then uses Flowplayer to play those -- this has been in use for years and seems like a solid option. Anyway, I'll be sure to check your code better as soon as I can. Would love to help somehow, too. Edit: almost forgot to add that having an optional, built-in player would be a nice addition. Something like the Flowplayer integration I mentioned above, so that $page->video_field->render() would simply output the player. Just saying1 point
-
Already answered in the posts of this thread: http://processwire.com/talk/topic/4491-unable-to-log-into-processwire-website/1 point
-
Here's an example of the performance boost I gained by doing this... My page was 26kb before, and 4kb after. Page loading time was reduced by almost half. In site/config.php uncomment $config->prependTemplateFile and $config->appendTemplateFile = '_out.php'; /** * prependTemplateFile: PHP file in /site/templates/ that will be loaded before each page's template file * * Uncomment and edit to enable. * */ $config->prependTemplateFile = '_in.php'; //you can name this file whatever you want /** * appendTemplateFile: PHP file in /site/templates/ that will be loaded after each page's template file * * Uncomment and edit to enable. * */ $config->appendTemplateFile = '_out.php'; //you can name this file whatever you want Create two new files in site/templates called _in.php and _out.php. In _in.php add the following at the top of the file (before any code that you add later) <?php if (!in_array('ob_gzhandler', ob_list_handlers())) { ob_start('ob_gzhandler'); } else { ob_start(); } ?> In _out.php add the following at the bottom (after any code you add later) <?php ob_end_flush(); ?>1 point
-
The theme and layout setup is very nice with a very soothing color which is bright and not too focusing. I really like the way you guys have done it. Goog job.1 point
-
Log in in with email address has more overhead so shouldn't be default. Please let the system as it is. ( think ryan won't change it, cause it makes sense ) If your needs for the login with email is that high, write a module for it that hooks in. ( Session authenticate ( not shure about this hook ) ) side note: There are a lot of developers to overcomplicate scripts. (count my self in) Ryan is the gatekeeper of no overhead & simplicity. let it be this way, please1 point
-
I promised I would share my summer-project when I got a bit further along and now most of basic design is up on the test server (still just test content though, only some of it will be there in production). Two pages remain to be styled and some minor touch-ups are left for sure, but the gist of the simple design should be visible. Clean Scandinavian has been the motto. Will update to publishable version over the coming week/weeks. I will also clean up the code and do some validation fixing etc during that time. Any suggestions, pointers and tips from you pros would be much appreciated (tough love is the ticket). Keep in mind that I am not a pro and that apart from a sole static site I helped a buddy with 10 years ago, this is my first attempt at any of this (html, design, php, cms etc), so spare me the sharpest ax. A testament to the Processwire excellence - and to all of you helpful souls on this page - is that I have been able to get at least this far with no prior experience, so I would like to extend a heartfelt thanks to Ryan, Soma, Teppo and all the rest of you that have helped form this product in general, and taken the time to help me out on specific questions. You truly rock! re le vo DOT se/en1 point
-
This classic thread started by Matthew will get your started with #2 and #3 (validation = sanitization + correct input) http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/ PW $input variable: http://processwire.com/api/variables/input/ Great form examples in Soma's Gist: https://gist.github.com/somatonic1 point