Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/19/2014 in all areas

  1. Hi, After the move to ProcessWire on one of our major websites, I had to build myself a module/plugin so I could use the Amazon S3 / CloudFront infrastructure. The module/plugin uses Amazon S3 PHP SDK and the idea was to provide a clean way to upload/backup files to S3 and distribute the assets via Cloudfront. The current version of the module/plugin will copy the page files to Amazon S3 so you can then serve the via Cloudfront automatically. Note that the files are still also copied to the server where your PW installation resides. There's an option to backup the deleted files to another folder on S3 because when you delete a file on PW via the admin, the file is also deleted from it's folder on S3. The module also supports Apeisa's Thumbnail module so it also stores the thumbnails on S3. Note that the native size() method to create image thumbnails on S3 is currently not supported. As it is, the module will only upload new assets, so beware that if you already have pages created with assets you'll definitely have errors, so my advice is to test this with a blank installation of PW. If anyone wants to test it and contribute to it, I think this provides a good proof of concept for a functionality that is requested by several users (me included). Please note that I'm not a PHP developer, my skills (very) limited and I'm aware that it can be improved and I'm open to suggestions, feedback and most of all, collaborators. The module is hosted on github here and it's available in the ProcessWire modules directory. Nelson Mendes
    13 points
  2. It has been a pleasure to develop our new website with ProcessWire. Welcome! http://www.nordenswansiirila.fi/en/ -- Mikael
    5 points
  3. Manfred62, looks like I broke it in one of this week's commits. I added translation support to uploaded filenames so that you could upload ŖýäŅ-Čřämêŕ.jpg and it would convert to ryan-cramer.jpg rather than ____-______.jpg. It basically runs files through the existing translation engine used by page names (and your settings defined with the InputfieldPageName module). So it was attempting to beautify filenames in the same way as page names, which meant converting things like doubled hyphens to a single replacement character. Obviously that's not compatible with the language JSON file name format, my mistake. I've modified it so that it now allows doubled hyphens, so it should be fixed now on dev. I was also able to duplicate the issue with the Setup and Access page titles/summaries incorrectly displaying in default language, so that should be fixed now as well. Thanks for reporting it.
    5 points
  4. For the record, that issue is out now – Screenguide No. 22. Should be available at larger news stands (usually not in small towns, though), especially those at larger trains stations.
    5 points
  5. You would link multiple users in a similar way - new Page field called users, configured for "template=user", and use the "Multiple pages (PageArray)" option on the field Details tab, and add to the event template. The difference in code would be this: <?php // Loop through all users added to the page. foreach ($page->users as $u) { // Use $u (or whatever you like) but not "$user" - it is a ProcessWire system variable (current logged in user). echo $u->name . " is a member of this event.<br>"; } ?> Locations with the same name would not be permitted to have the same direct parent - so the name would have to be changed when adding it. Each page still has its own ID, name and path which can be used to identify and load them within code. For example: ID: 1042 Name: concert-hall Title: Concert Hall Path: /locations/concert-hall/ The ID cannot be changed, but the name can. And the path is built up based on the name of the page and the names of it's parents. By default, names are automatically generated from the title field value, but can be overridden if necessary, generated yourself, or automatically using datetime values.
    3 points
  6. Hi tehandyb There is a rough translation between traditional terms and ProcessWire's, which is: Templates = tables Fields = columns Pages = rows Template files = controllers & views In ProcessWire, you would create the necessary fields for your content, add the to one or more templates (to define your "schema" in a way), and you create pages based on those templates. The page output is handled by it's template's file. The fields you add to the template can vary from integers to text input to map markers (and more). In your example, you would probably want to create templates for at least event and location. Users, roles and permissions already exist in PW, but you can extend these for your own needs if you have to. The key to linking pages together (individual users, locations and events) is the Page fieldtype. This allows you to create a field that can reference one or more other pages of a type of your choosing. Back to your example, I'm going to presume an event might have one location or none at all. First, create a location template with the basic fields you need. Create a section of your page tree to store them. If you don't want them to show up in lists or searches, set the parent to Hidden. Then, create a new field called location and add it to your event template. Configure it to list pages with a template of location and the parent page where they're stored in your tree. You can also choose what type of inputfield it will use - a Dropdown or PageListSelect might be appropriate depending on how many you have. When you have done that, creating or editing an event will allow you to choose a location from the list. In the event template file, you would access it like this: <p>This is the <?php echo $page->title ?> event.</p> <p>The venue is: <?php echo $page->location->title ?>.</p> I'd recommend reading some more documentation and this brilliant thread on categorising your content.
    3 points
  7. After months of silence on the forum I've decided to speak out and introduce a brand new admin theme for ProcessWire 2.4.x I've made the theme initially for our internal business project and I've decided to share it with you all The theme itself is designed only for ProcessWire 2.4.x and up because it's wrapped as a module (new theming design approach introduced in ProcessWire 2.4) and it also has it's own options you can configure. It has all the bells and whistles as Default Admin Theme of PW 2.4 as well as some of my own You can download it from here: https://github.com/nvidoni/AdminThemeModesta and please let me know of any mistakes you find during your workflow... Changelog: v1.0.1 Added unpublished pages status icon next to username (fires modal window with unpublished pages list that you can edit) Improved PageList (children are more indented with arrows before them, hidden pages have more lighter color and icons have more darker color - by suggestion from Martijn Geerts) Other CSS improvements UPDATE: You can find version compatible with Processwire 2.4.4 and up on dev branch: https://github.com/nvidoni/AdminThemeModesta/tree/dev and also let me know about any mistakes that should be fixed. Dev version isn't updated to v1.0.1 yet because of strange problem with theme not switching right (doesn't activate) - it started to happen from 2.4.5 dev version of PW...) and it seems it happens only in Windows environments...), hopefully we'll fix this soon. To sum it up and let the images do the talking, here we go:
    2 points
  8. I can't tell for sure what the problem is, so I think you should try to simplify things down and debug each variable to figure out where things are going wrong. Bring it back to this: foreach($page->children("category=$input->urlSegment1") as $preview){ echo $preview->title; } Things to check are that the name of the category field is correct. Remember this must be the name of the field that is used in the template on the current page and not the name of the parent page that houses the child categories. Also try echo'ing $input->urlSegment1 to make sure it actually contains the name of the category you are looking for. If not you can firstly replace this with a hardcoded category name to make sure your selector is working, then track down why $input->urlSegment1 is not being populated. Hope that helps to get you sorted.
    2 points
  9. Hi Manaus, I'm italian too and I'd like to help you out to make your estimation, but I can't understand why you told your client you would search someone else to make another estimate on top the one you did on your own. Sounds kinda like a self admission of guilt over your initial cash request.
    2 points
  10. https://processwire.com/talk/topic/4420-page-list-migrator/
    2 points
  11. Having run a couple of MODX Evolution sites in the past i can confirm that this system was/is pretty snappy on both the manager part and frontend rendering. I'm guessing that this is in part because of the relatively simple nature of the beast. Remember MODX Revolution? With it came more power but also backend performance and frontend rendering times took a dive. There is maybe another thing to consider, which you are probably aware of but maybe not. In Evolution, documents (think PW pages) are set to 'cacheable' by default. This means that all page output is cached. What was nice about the system was that, if needed, you could still call uncached snippets and such from within an otherwise cached document. But most of the times you would call snippets cached, i.e. without the exclamation mark. So in reality, in Evolution, most documents tend to be cached, either wholly or at least in part. So if you compare Evolution <--> PW with regards to total rendertime on the frontend (which is the only thing Google and end-users really care about) you should take caching into consideration for a fair comparison. Use template caching where possible and if not Markup Cache, at least for PHP/API/DB stuff. I see that with some use of Markup Cache you were already able to get within 200 ms of the comparable Evolution site. Maybe with Ryan's optimizations to the bootstrap this will only go down. That's pretty good if you ask me. Another thing to consider is that suboptimal use of the PW API in temlate files or other places and loaded modules can affect performance negatively. So be sure to scrutinize your PW projects for this stuff. In the end i think the power to performance ratio that PW delivers is pretty awesome!
    2 points
  12. Recently I got a brand new iMac so I needed to install PHP SQL and configure Apache. I'm using the same web develop environment for years and I'm really happy with it. Raymond is also using this and Arjen did the same recently. I love to share how I setup this environment in a step by step tutorial. Let's setup PHP, MYSQL and activate mail using gmail smtp for OSX 10.6 and up, perfectly suitable for ProcessWire. It doesn't install Apache, it uses the Apache installation, which comes with OS X. The PHP installer package is created by Liip and it is based on entropy's php package. For MYSQL we gonna install the DMG Archive (x86, 64-bit). After we installed PHP, we configure Apache & PHP so that we’re able to run the ProcessWire sites in our own ~/Sites directory. For El Capitan see Arjen's https://processwire.com/talk/topic/5797-setup-a-processwire-environment-on-a-fresh-macos-x-install/?p=103674 Install PHP We gonna use the PHP installer created by Liip. (more information) Go to: /Applications/Utilities/ Open: Terminal.app Type: curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5 Press: RETURN Type: your admin password Press: RETURN ( download starts and continues with a the install ) note: If you want to have an older PHP version, replace 5.5 with 5.4. (PHP 5.5 is the current stable) After the install is completed Apache is restarted and complains about “Could not reliably determine the server's fully qualified domain name, using your-computer-name.local for ServerName”. This notice is not a problem, we only use this Mac for local website development. Setup Apache Open a new finder window. Press: shift + command + g ( Go to folder ) Type: /etc/apache2/ Press: go Open: httpd.conf Find the line: #Include /private/etc/apache2/extra/httpd-vhosts.conf Remove the # infront to enable. Press save and enter your password when asked. Enable the use of ~/Sites folder:Open the folder /etc/apache2/users/ * Duplicate the Guest.conf and name it martijn.conf Open the duplicated file that we created * Change: <Directory "/Users/Guest/Sites/"> to <Directory "/Users/martijn/Sites/"> Change: AllowOverride None, to AllowOverride All Save the file. The file should look like: <Directory "/Users/martijn/Sites/"> Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all </Directory> Configure the vhosts includes Open /etc/apache2/extra/httpd-vhosts.conf Comment out the 2 VirtualHost examples by putting a # in front Be sure that NameVirtualHost *:80 doesn’t start with a # sign. * Add the include: include /Users/martijn/Sites/_vHosts/*.conf at the bottom of the file. Save the file, password will be asked. The file should at least have these two lines: NameVirtualHost *:80 include /Users/martijn/Sites/_vHosts/*.conf * ( Replace martijn with your short admin name ) The ~/Sites folder (Users/martijn/Sites) Goto your user Home folder. Create the Sites folder in your user home ( if not exist ) Create inside the Sites folder a folder called _vHosts Create the folder domains inside the ~/Sites folder Create a folder inside the domains folder called processwire ( processwire will be the domain name ) Inside the processwire folder create 2 directories: 1. htdocs 2. logs ( make this writeable by right click the folder and choose Get info ) Create inside the htdocs folder a file called index.html with some content. The folder structure should look like: ~/Sites |`-- _vHosts | `-- domains | `-- processwire | |-- htdocs | `-- index.html | `-- logs Configure PHP Open the file: /usr/local/php5/php.d/99-liip-developer.ini ( This file is the last ini file that gets loaded, so perfectly suitable for your personal settings ) Make your personal changes here. ( setting xdebug.max_nesting_level=1000 for example if needed ) Save the file ( password will be asked. ) Make an alias the this file by right click and choose: Make Alias Name the alias _settings.ini or what ever you want to name it. Move the alias to your ~/Sites folder Create a vHostIn our ~/Sites folder we created a folder named _vHosts. This folder we gonna use for the vHosts. All files ending with .conf in this folder will be loaded when we (re-)start Apache. Create a new file with your favourite text editor. Type the following in the file: ( Replace martijn with your short admin name ) <VirtualHost *:80> DocumentRoot /Users/martijn/Sites/domains/processwire/htdocs/ ServerName processwire ErrorLog /Users/martijn/Sites/domains/processwire/logs/error.log.txt CustomLog /Users/martijn/Sites/domains/processwire/logs/access.log.txt common </VirtualHost> Save the file with the filename processwire.conf in the folder _vHosts The hosts fileGo to the Finder Press: shift + command + g ( Go to folder ) Type: /etc/hosts & press return Open the hosts file with you favourite editor Type 127.0.0.1 processwire below 127.0.0.1 localhost but above 255.255.255.255 broadcasthost Save the file Right click the file & choose: Make Alias Move the alias that you created to your ~/Sites folder Rename it to _hosts The file should look like: ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 127.0.0.1 processwire 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost Test the Apache & PHP setup Go to: /Applications/Utilities/ Open: Terminal.app Type: sudo apachectl restart Press: RETURN Type: your admin password Press: RETURN At this point Apache & PHP will be up and running.Go to a browser and type: processwire/ in the address bar and press enter. MYSQL For managing MySQL databases I use Sequel Pro it's a very handy tool and in this tutorial we set the root user password with it. For the SQL server we gonna use the MySQL DMG Archive (x86, 64-bit) Download the following: MySQL DMG Archive (x86, 64-bit) Sequel Pro Open the mysql-5.6.16-osx10.7-x86_64 image * install mysql-5.6.16-osx10.7-x86_64.pkg, MySQLStartupItem.pkg & install the prefPane * if MACOSX complains about: ( mysql-5.6.16-osx10.7-x86_64.pkg” can’t be opened because it is from an unidentified developer. ) You should open your System Preferences, go to Security & Privacy and Allow apps downloaded from: Anywhere Set the root user password Double click the sequel-pro-1.0.2.dmg. The disc image will mount Drag'n'drop the Sequel Pro.app to your /Applications/ folder. Open Sequel Pro Type by name: 127.0.0.1 Type by host: 127.0.0.1 Type by username: root Login Press command + u Select the root user on the left side Fill in the password Press apply We're Done ----- Todo how to use it after the setup is complete
    1 point
  13. I have build another non-profit website http://www.fmgcs.com with ProcessWire 2.4 completely free! This my community website which I redesigned and hookup with ProcessWire. Before it was static html pages. I have spent quit a bit of time on designing and customizing templates. Please provide your feedback as you normally do. Thank you!
    1 point
  14. I’m seeking for your advice. I want to create a module that will allow generating unique IDs to fill different fields (in my specific case page names) according to different templates. Here’s the workflow I’m looking at: User creates a rule through Configuration -> Field generator that, given a template, will generate an ID. Here’s a mockup: I’d like if the page name could be automatically set right when the page is created. Also, what do I need to care about when updating the page, is there a risk it can be overwritten and is there a way to prevent that at all. They need to be permanent. I’d just like to know if it’s possible. I’ve begun looking at the different hooks, but there’s an overwhelming amount of them and I’m not sure where to begin. Would appreciate your input.
    1 point
  15. new german updates for actual PW dev 2.4.5 (19 June 2014). Zip contains only updated/added files (in comparison to the default 2.4 lang pack). updated files: wire--modules--inputfield--inputfieldselector--inputfieldselector-module.json wire--modules--process--processtemplate--processtemplate-module.json pw-lang-de-dev-update.zip
    1 point
  16. You can access the user template by going to the Admin > Templates page, click the Filter section at the top, click Show system templates, and then Yes. A new group of templates will be shown (with the "system" tag) - user is one of them. Click that to view the user template
    1 point
  17. Oh I see, so your selector is relative to PageA and PageB as the current $page ? In that case this should work when run from PageA or PageB: foreach($page->children() as $c){ or foreach($page->children("template=basic-page") as $c){ Do the "Child Pages" ever get loaded by their URL? If so and because they have the same basic-page template, you need to do something else to prevent them for looking for child pages. You could simply do: if($page->numChildren()>0){ foreach($page->children() as $c){ } Or perhaps it would actually make more sense to have a separate template for the PageA and PageB parents? Lots of options really
    1 point
  18. Ryans fix in latest dev works! ...and I just want to say how thankful I am that Ryan is such a responsive developer. One more thing: I did some speed benchmarks on 2.4.5 and can say that 2.4.5 is approximately 30% faster compared to 2.4.4 on my projects. Awesome!
    1 point
  19. Hello, is there any way for AIOM to accept a FilenameArray object for minifying or do I need to convert the object to an array manually first?
    1 point
  20. NooseLadder - the link to the module the horst provided is designed primary to migrate page content and as a result it also grabs changes to fields and templates that are used by these pages. You can use the "Changes Since" option during export to grab all the changes to your site since that date/time and things should work as expected. The one thing thing that might seem confusing is that if you only make changes to template or field settings, you still need to export a page/pages that contain these templates/fields to capture these changes. Mindplay's work in progress module might also be useful here: https://processwire.com/talk/topic/2117-continuous-integration-of-field-and-template-changes/ although his is only about field/template changes. Personally I can see using both options depending on the needs. I still don't consider Migrator release worthy, so you should definitely test the import to a test PW installation before trying it on your live site. I do hope to get it finalized sometime in the next few weeks or so..... There are some small outstanding issues (like template context field settings) and also I need to test support for all the new pro fields which I haven't done yet. One thing I really need is help testing it
    1 point
  21. Ciao 3fingers, well thats the usual compromise between getting less money or getting no money. An external source could prove that my estimate was not self-serving but objective. I'm going to make the video of the public and admin side Grazie!
    1 point
  22. Good question. Just wanted to ask the same..
    1 point
  23. Another quick update to this problem - in that it should not be a problem any more! Ryan's changes in ProcessWire 2.4.5 (commit) has moved the modules cache file into the database using a new cache module - removing the problem caused by the file not getting written properly in certain environments. Thanks Ryan!
    1 point
  24. Due to an error on my side, I deleted a file before backing up. So, I had to make my page from scratch... but using the code below, I cant access the $input->value to check for errors. Tried $input->post / $input->get. Either with "contract" and ->contract. Must be forgetting something... It's driving me nutz! -- EDIT -- Forgot I first have to submit before getting value back. lol. really stupido! Answer in API: if ($input->post->submit_details){ $value = $input->post->contract; // access as object property echo $value; $value = $input->post['contract']; // access as array index echo $value; $value = $input->post('contract'); // access as function echo $value; } $form = "<div class='row'><div class='medium-8 columns'> <form action='./' id='details' method='post'> <fieldset><legend>Details of {$user->name}</legend> <div class='row collapse'><label for='contract'>Contract <small>Required</small> <select id='contract' name='contract' ><option value=''>Please select</option>"; foreach ($pages->get("/contract/")->children() as $child) { if (!empty($member_page->get('contract'))) $selected = $child->name == $member_page->get('contract')->name ? " selected='selected' " : ''; $form .= "<option$selected value='{$child->name}'>{$child->title}</option>"; } $form .= "</select></label></div> </fieldset><button class='button tiny' type='submit' name='submit_details' value='submit_details' id='submit'>Submit</button></form></div></div>";
    1 point
  25. I've created a module that works with S3 and Cloudfront. See this topic.
    1 point
  26. Yes, I've come up against that a couple of times myself but in slightly different situations. Glad you managed to sort it
    1 point
  27. oh yes, now I realize the other filenames. Tested: delete all lang-files under site/assets/files/... Then copy translation files into existing directory. All working now. But under setup/languages/... the file-names don't change. Means the files cannot be edited. Also the headings under setup and access are no more translated. Hmm, seems there's something broken since the last update. We have to inform Ryan about this problem.
    1 point
  28. Hi Craig a Rodway, thanks for the reply, tried your modification but threw another warning. But it definitely had to be in that direction, same as the hints I found on the net. (You get the report when you are trying to use this reference as an argument to function, without storing it at variable first.) So this time I tried to define everything in that line outside of it and that seems to work, warning messages no longer popup I changed, return '<ul>'.do_print_categories_list(explode("\n", $cats), $stack=array(0), $arr=array(), $cat_params).'</ul>'; into: $exploded = explode("\n", $cats); $stack=array(0); $arr=array(); return '<ul>'.do_print_categories_list($exploded, $stack, $arr, $cat_params).'</ul>'; Being only a php rookie I feel good about this Oh and if you look with google, you'll be amazed how many times this warning message pops up "Strict Standards: Only variables should be passed by reference in . . ."
    1 point
  29. I found my mistake. I assumed adding the names of the custom fields to be displayed in the admin would automatically add them to the selected template. This, however, is not the case. So after also adding each custom field to the template, everything was working.
    1 point
  30. For those who want to try it, I have uploaded the project on GitHub. https://github.com/plauclair/FieldGenerator I strongly recommend you don’t use it in production for now. It runs correctly without problems, but the module doesn’t have an uninstall method yet. Since it creates system templates and fields, you won’t be able to delete those without going through a big hassle. Currently it also doesn’t have an administration panel, you’ll need to go (in tree) to Admin > Setup > Field generator, and create a new page using the fieldgenerator template. Page title has no effect apart from helping you remember what the rule is.
    1 point
  31. Is that blue highlighted line, line 32? Try it like this instead: return '<ul>'.do_print_categories_list(explode("\n", $cats), array(0), array(), $cat_params).'</ul>';
    1 point
  32. The easiest way to link to one specific page would be by ignoring PW entirely and just typing href="/service/" in your template file. Slightly more complex, but giving you powerful advantages would be to grab the page with $pages->get(). You can pass the get function either the page's path as above, or its numeric ID, or a full blown selector string. Then you can use ->url on the resulting page object. At first sight this may seem like an overcomplication when you can just link to the path, but since it gives you the full page, you can make your link text multilingual or display whatever fields alingside it.
    1 point
  33. http://processwire.com/api/variables/pages/ $skyscrapers = $pages->find("template=skyscraper"); foreach($skyscrapers as $s) echo "<li><a href='{$s->url}'>{$s->title}</a></li>";
    1 point
  34. TemplateBy adding the fields you desire to a template you basically model the content/data that you want to manage. Template file Associated to a Template, a template file is where most of the view and controller logic takes place. PW is very flexible so you can also make this more MVC-like, look at this for an example: https://github.com/fixate/pw-mvc-boilerplate/tree/develop Page A page is a data object that always follows the rules and data structure of the associated Template (you could say model). In PW pages are tree based (parent-child relationships). This gives powerfull options of organizing and relating content. Routing PW has a default way of routing following the page tree, but by utilizing urlsegments or hooking into the routing mechanism you can define your own if needed. So PW has it's own way of doing things. It may take some getting used to, but in my opinion it is a very nice way to model and manage your data. I believe one should always choose the right tool for a certain job, so there might be projects that are better suited to build from the ground up using a general purpose framework like Laravel or Symfony. But in my experience PW is the right tool for a whole lot of stuff.
    1 point
  35. The links you generated with <a href="<?=$property->url;?>"> don't go there? Where do they go then? Does the template "properties" have a php file associated with it? That's where you would echo the details using something like echo $page->myDetail;.
    1 point
  36. I've been working hard on this module this week, and so far, so good - it's now recording and can repeat most changes to Fields, Templates and Fieldgroups. One remaining issue is foreign keys... some field types store Template IDs, Page IDs or other types of ID within the Field data. For the known field types such as PageReference, I can handle those cases explicitly, but for third-party types, there is no saying what they're storing, where, how or when. The only real solution I can think of is some kind of hook that permits other modules to support this module explicitly, by implementing methods that clean up foreign keys and replace them with names, and vice-versa... but that's not really elegant and the module won't work generally with every third-party field type out of the box. Any thoughts?
    1 point
  37. I am a bit of a gardener - not a very good one, but I try hard! My main thing is veg up at my allotment, but I have a crappy memory and can never remember what I am meant to be doing to what, when and how. So, I was pleased to see that the Royal Horticultural Society in the UK has released an "app for that." The RHS is internationally renowned for their huge knowledge on all things flora. Unfortunately, it turned out to be iOS only and I use a Kindle Fire (Android) They do like feedback however, so I duly fed back a note saying, "please, please, please, can we have an Android version?" This morning, I had a chatty little reply from them opening with "Dear Joss" and closing with "RHS Webmaster." So nice to know they can't be bothered to say their name. The reply says: "Unfortunately, at the moment we do not have any immediate plans to release an Android version, since Android is still used by relatively low numbers of people in the UK." WHAT??? Which complete idiot is advising them? A sales rep for Apple perhaps? A dev who does not know how to develop for Android so is spinning them rubbish? I have quoted to them two facts: At the end of 2013, iOS made up 47% or the existing UK market and Android 35% When it came to new sales at the end of 2013, Apple made up 29% and Android 54%! Which part of those figures indicates that the number of Android users is too few to consider? By relying on false statistics and bad advice, the RHS is ignoring a minimum of 35% of their potential market, and probably a lot more. Advising clients as to what they need to consider is a vital part of any advertising strategy, whether it is web design or local press or TV, but if that advice is inaccurate or plain rubbish or worse, based on self interest, then the client might as well be throwing their money down the sewer. Meanwhile, my veg are growing, despite the lack of good communications from the RHS.... http://www.foodloversdiary.com Joss
    1 point
  38. Table Use this for tabular data, like rate tables or other things that you might typically represent in a spreadsheet. Use it for situations where you don't need the full-blown flexibility of repeaters, as it's technically more efficient with far less overhead than repeaters. Something like the Events Fieldtype could be very easily re-created via a Table field, but the potential uses are far broader. But for the most part, think tabular data when it comes to the Table field. Multipliers This is good for when you need a range of values (whether text, textarea, numbers, dates, etc.). If you are using repeaters with just one field in them, you might be a lot better off with a Multiplier. Like the Table field, Multipliers are very efficient and low overhead relative to something like Repeaters. Use Multipliers when you need to repeat a single input multiple times, optionally with a min and max number of inputs. Lets say you are building an employee directory, and each employee has between 1 and 3 email addresses. Rather than using 3 separate email fields, you would use 1 multiplier field and specify min=1 and max=3. Repeaters These are infinitely flexible in terms of what they represent, but each row of values is technically a page in the system. As a result, with the flexibility comes significant overhead. This is really only an issue when the quantity of repeater items gets high, or when you have lots (thousands) of pages using repeaters. I recommend repeaters for setting up things like homepage carousels. For example, if you go to the Villas of Distinction homepage, there are 3 separate repeaters in use on that page, each holding a photo, title, description, link. The client can have as many items in each of those sections as they want. Currently it looks like the first repeater as 6 items, the 2nd has 2, and the 3rd has 6. The possibilities of what can be represented with repeaters is endless, but look for potential alternatives when dealing with large quantities (whether large quantities of repeater items, or large quantities of pages using repeaters). PageTable This is one of the ProFields that is available for free (thanks to Avoine sponsorship) on the ProcessWire dev branch. Meaning, it'll be available for everyone to use as part of the core in ProcessWire 2.5. And you can use it now if you don't mind running the dev branch. PageTable has all the flexibility of repeaters, but with lower overhead from the admin/input perspective. Rather than trying to bundle all the inputs on one screen, PageTable shows you a table of items and you click on the item to edit it in a modal window. This enables it to be a lot more efficient from the admin UI perspective. It's also more flexible than repeaters are in terms of where you store your items. PageTable lets you choose where they should live, whether as children of the page being edited, or as children of some other parent page you designate. They might be a little more work to setup than repeaters, but I think that most situations where you need the flexibility of repeaters may be better served by PageTable. PageTable still can't compete with the speed and efficiency of Table or Multiplier, but consider using PageTable anywhere that you might have used Repeaters before. Repeaters and PageTable are fundamentally different from the admin UI/input perspective, so you'd want to compare them yourself to see what suits your individual input needs better. PageTable involves more clicking to create and edit items, making Repeaters potentially faster for entering data rapidly. But PageTable will scale much further in the admin UI than Repeaters will, so I would personally favor PageTable in more situations than Repeaters.
    1 point
  39. If you want to push an image to you better use the enhanced as that one support enclosures. (images, files)
    1 point
  40. The easy way out would be to generate an RSS feed of PW pages: http://modules.processwire.com/modules/markup-rss/ http://modules.processwire.com/modules/markup-rssenhanced/ and push them to FB, Twitter etc using any number of services: https://dlvr.it/ https://hootsuite.com/ or my current favorite - IFTTT https://ifttt.com/recipes/search?q=rss+to+facebook&ac=false https://ifttt.com/recipes/search?q=rss+to+twitter&ac=false
    1 point
  41. Figured it out $field->attr('value', is_array($data['subscriber_number']) ? $data['subscriber_number'] : array());
    1 point
  42. A few new/minor additions on the dev branch: You can now paginate with "limit=1" selectors. Previously ProcessWire didn't build the pagination information when a limit of 1 was specified. Now it does. ProcessWire now preloads pages that it knows it's going to need on every request. This speeds up everything slightly, as what was previously done in 6-7 queries is now done in one shot. Should you want to, you can also specify additional preloaded pages, though I don't think many (any?) would need to. Several optimizations to the PageFinder engine which improves the speed of certain types of queries. One of them is a $pages->count("selector") query, which is now even faster than before. Selector Grouping Added support for selector grouping to change the behavior of how they match. This is best explained by example. Lets say we're building a big news site, and we have a template called news-item that represents each news article. Each news-item page has a field called cats that is a multi-page reference to one or more category pages. This is a pretty common scenario in ProcessWire. The site has a lot of categories, so want to designate some categories as featured so that we can display featured categories on the homepage and elsewhere, with accompanying news items. Rather than just adding a featured checkbox, we add two fields to represent the date range that we want them featured: featured_from and featured_to. On our homepage, we want to display articles from all the current featured categories, so we build a selector like this: $items = $pages->find("cats.featured_from<today, cats.featured_to>=today, sort=-date"); ...but we end up with more news-items than we expect, including some that have categories that aren't actually featured right now. Why? Because each news-item can have multiple categories, and that selector above is saying this: The keywords there are "at least one", as "categories.featured_from" and "categories.featured_to" may not be referring to the same category. The only way to solve it was this: $categories = $pages->find("template=category, featured_from<today, featured_to>=today"); $items = $pages->find("categories=$categories, sort=-date"); That's easy enough... but now you can also do it like this, by prepending an @ to identify a group: $items = $pages->find("@cats.featured_from<today, @cats.featured_to>=today, sort=-date"); The "@" symbol at the beginning of "cats" is telling ProcessWire those are grouped together and "these must match the same exact page". This was added because there are situations where you need to perform your query with 1 selector rather than breaking it up. An example would be when used with the new InputfieldSelector module and Lister, among others. We will likely be adding more ways to perform complex matching scenarios with a single selector as well. Currently this "@" grouping applies only to multi-page reference fields, as I'm not sure yet where else it might be useful. It is only supported by selectors that hit the database at present (though will be completing it for in memory selectors as well). Not planning to extend it into that area at this time, but good ideas to think about for the future or for modules. It should already be fixed. If we're talking about the same thing, someone recently posted this to the GitHub issues list and I added their fix on dev. Adrian already knows this because we've been chatting in the GitHub issues queue, but for anyone else reading this, it has also been fixed.
    1 point
  43. Not really a specific type of music but very much enjoy using Rdio to pretty much stream music all day long. Works very well across multiple devices and you can even use it on one device as a remote control.
    1 point
  44. Introduction Dear community. As some of you may know I've been busy creating a MVC Module for Processwire. I've finished quite a bit of it and I am now ready for a tutorial on a quick website to get you started! For this tutorial I am using a clean install of Processwire 2.3 and my Module 0.2.4 Get the module at Github http://github.com/hawiak/mvcmodule . Main focus of the module is to split logic from design without losing the flexibility of Processwire we all fell in love with. Alright lets get started. Installation Once you have the module downloaded we are going to install it, we need the MvcModule folder in the /site/modules folder. And we need the AppController in the /site/templates folder (You can find the AppController in the /site/templates folder) Once you've put the folder in there we are going to install the module, check for new modules and you'll see MvcModule Click on it and hit install to install the module. Once you've installed the module you'll see some configure settings and you'll notice a new tab on your admin. But click submit, dont forget this or all the paths WONT WORK! Setting up your home controller Ok we are ready to set up our first controller. To easily set up your template to enable MVC we are going to the MVC tab in your navbar. You'll notice a button saying " Create controller" Click on "Create controller" and for this tutorial we are going to use the home template, select the home and click "Create". If everything is correct you will see this: Now we are done in the process side of it and we'll get into the coding. Get your favourite code editor open and lets create our controller. Open the /site/templates/home.php file in your editor. Remove the code thats in there completely. And save it. For the module to work with the template file we need to create a class called HomeController and extend AppController. like so: <?php class HomeController extends AppController{ } Creating Views and layouts If you go to your websites homepage you'll see something along the lines of: Thats because by default you will need an Index method, a home method for your controller, so lets create one! <?php class HomeController extends AppController{ public function index(){ } } Lets try it again! Oops... Well it seems like we're missing a view, so lets create the view, we first need to create a folder with called Home (the same as the controller name but start with capital) And in that folder we'll create a file called index.tmpl Now of you run it you'll see that you are not quite done yet you'll see something like this: I promise after we create the layout we are done. So lets create a folder called layouts and a file called layout.php in there. Displaying data Now we're done with the setup and we can start coding, lets say you want to get the content fromt he field body on your page displayed? Well thats easy put this in your index method. $this->set('body', $this->page->body); What this does is that it sets a variable in the view we can use called body so all we need to do to display this is go to our view. And add {{body}} to the view. Now go and refresh your page! oh wait... nothing shows up...? Oh yes we use Twig template engine we need to add this to our layout.php {% block view %} {% endblock %} (Yes yes I know its complicated for just a simple task but trust me you'll love it later!) Refresh your page and check it out! You'll see that the text is displaying but the markup isn't really working, we need to use the |raw extension in order to make this work, so change the index.tmpl content to this {{ body|raw }} Use |raw for all the HTML markup, always. Styles, scripts and snippets Now this is quite boring, I know but lets start doing some interesting stuff, lets implement Bootstrap! go and download bootstrap at getbootstrap.com Once you've downloaded create a folder in /site/templates called "assets" the dist copy the bootstrap.min.css out of /dist/css to /site/templates/assets/styles and /dist/js/bootstrap.min.js to /site/templates/assets/scripts/ Now we want to use this, MvcModule has some great options for this! Change your HomeController to this <?php class HomeController extends AppController{ public $scripts = array( '1' => 'bootstrap.min.js'); public $styles = array( '1' => 'bootstrap.min.css'); public function index(){ $this->set('body', $this->page->body); } } Now go over to your layout and change the contents of your layout to this: <head> {{ this.render_headers()|raw }} </head> {% block view %} {% endblock %} You'll now see your style (If not try going to the MvcModule configure settings and remove the first / from /site/templates/assets) Now we forgot to include JQuery, so lets download jquery at jquery.com We need to put that in the /site/templates/assets/scripts And we need to put it in the array, you can just do that as follow: public $scripts = array( '2' => 'bootstrap.min.js', '1' => 'jquery.min.js'); The number in this array indecates the order on which the scripts will be loaded. Now you should see something like this! Now lets create a navbar with all the pages using the bootstrap navbar component. To do this we will create a snippet create a folder called snippets in /site/templates and a file called navbar.php Lets first create a variable with all the pages in the index method $this->set('menu', $this->pages->find('/')); Lets now create our snippet, lets just create this first in our snippet navbar.php <nav class="navbar navbar-default" role="navigation"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"><a href="#">Link</a></li> </ul> </div> </nav> We need to tell the controller to use this snippet we do that by using an array. Change your controller to the following: <?php class HomeController extends AppController{ public $scripts = array( '2' => 'bootstrap.min.js', '1' => 'jquery.min.js'); public $styles = array( '1' => 'bootstrap.min.css'); public $snippets = array( 'navbar' => 'navbar.php'); public function index(){ $this->set('body', $this->page->body); $this->set('menu', $this->pages->find('/')); } } And change your layout to this: <head> {{ this.render_headers()|raw }} </head> {% block navbar %} {% endblock %} {% block view %} {% endblock %} You see that I created a block here and called in Navbar. The snippets content (that we assigned to navbar => file_name) will be put in this block! So lets now use our variables and the Twig template engine to the fullest! Change the navbar.php snippet to: <nav class="navbar navbar-default" role="navigation"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> {% for item in menu %} <li class=""><a href="{{ item.url }}">{{ item.title }}</a></li> {% endfor %} </ul> </div> </nav> You see we use a for loop here and use the PageArray menu here and generate the menu here. You can use the variables in the view as well. Setting a title Lets set a title, this is fairly easy, lets define a variable in our controller that will be the same for every view in this controller public $title = "Home controller"; Now go to your layout.php and do add this to the head: <title>{%block title %}{% endblock %} {{ this.controller.title }}</title> Now as you can see we created a block, what this allows us to do is create the same block in the view like this: {% block title %}Index{% endblock %} And you will see that your title is "Index Home controller". This is because the title block replaced the title block in the layout file. Views Inside views you still have access to processwire objects and even to the MvcModule as you've seen with render_headers(). The view template used is Twig, check out more here http://twig.sensiolabs.org/doc/templates.html This is a basic setup for a website with MvcModule. I will extend this tutorial and update it whenever needed!
    1 point
  45. If the number of products isn't large (say less than 100) then the best way is probably to sort them in memory like the way Soma mentioned. But if you need something that can scale infinitely, then you'd want to keep your endprice as a field on the page that you can use for sorting directly from the $pages->find() query. Perhaps as a hidden field that is automatically populated via Pages::saveReady hook. It would be fairly easy to implement, let us know if you'd like an example.
    1 point
  46. I committed a couple small additions this morning: 1. Fieldset indentation in the template editor. Hard to describe, but I needed some way to make the grouping of fieldsets a little easier to see in the asmSelect list in the template editor. Here's a screenshot which describes it better than I can: 2. The InputfieldCheckboxes field now supports columns. This would typically be used if you had a Page reference field using the Checkboxes input. When editing the field, you'll see a new option on the 'input' tab where you can specify a number of columns you want it to use. This is just a way to tighten things up for when you have lots of short-labeled checkboxes (see bottom of screenshot).
    1 point
  47. Actually those were added at the same time as this update. I experimented with it and it works nicely, but decided just to make them bold rather than changing the color. But you can change the color, background color (or the entire row) or anything else with it from an admin theme. Here are the relevant classes: #ProcessTemplateEdit .asmFieldset - applies to both starting and ending fieldsets or tabs #ProcessTemplateEdit .asmFieldsetStart - applies just to starting fieldsets or tabs #ProcessTemplateEdit .asmFieldsetEnd - applies just to ending fieldsets or tabs #ProcessTemplateEdit .asmFieldsetIndent - controls the width of the indent, adjust with css width property
    1 point
×
×
  • Create New...