Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/29/2014 in all areas

  1. Ryan's Hanna Code module is a seriously useful bit of kit, not just for blog type systems where you want to insert a gallery or something clever, but for business websites where consistent branding and messaging is paramount. Lack of consistency can do a surprising amount of damage to a brand - if the way you refer to a company is inconsistent or unusual, for instance, you can confuse the visitor or split your messaging. Likewise, important messaging statements (keyword phrases in SEO), need to be kept consistent and current. It is all a bit obvious really, but it is amazing how easy it is to get wrong. And if phrases or contact info or even the company name changes, then trying to update the site with hundreds, perhaps thousands of pages could be a nightmare. Using the Hanna Code Module creatively, but very simply, can save you a lot of heartache and keep things on track. This is probably the simplest use of the module since all you doing is using it as a text replacement rather than for entering complex code. If you have created some sort of central settings page in your page tree that is for global values like Site Name, or main background image or whatever, consider adding a bunch of simple text fields for things like: Company Phone Number Company Name Company email address CEO's name Small company logo (that would be a single image field, of course) Company slogan Then, using the Hanna Code Module, set up hanna codes to retrieve this information. For instance, create a hanna code called "company" Set it for php, save and then under code, add the following: <?php echo $pages->get("/settings/")->company_name; Here I have assumed you have a hidden page as a child of your home page called "settings" and that the field for you company name is called company_name. Now, add the Hanna Code text formatter to every field that you may need to use it in. Within those fields, [[company]] will now be replaced with the company name. If the way the company name is written changes at any point, then it will be changed in all text. While you are about it, you can retrieve the same field without the hanna code module directly into templates where required. Now the company name throughout the entire site is consistent and is controlled by one simple field on a settings page. All you need do is take a very large rock to any authors who do not use it! Branding is important, more important than pretty pictures, clever JQuery, responsiveness and even SEO. Giving the client controls so that their carefully worked out brand values are not just used, but used consistently and without errors throughout their site, should be all part of the service, and Hanna Codes give you that. And for small clients who have not quite got their heads round the idea of building a brand, it may help them think about it more carefully.
    8 points
  2. In our company site i'm using Hanna code all over the place for company phone and fax numbers and e-mail addresses. Its very easy to manage when a value needs to be changed. Change it once in the hanna code and ~voila~ its changed site wide Some examples usages in our site: (translated to english for these examples) [[phone nr="marketing"]] [[fax nr="sales"]] [[email address="subscriptions"]]
    5 points
  3. Hey Everyone! right I'm nearing the end of development on this photography agencies site and I was wondering if anyone could have a quick look for bugs etc. http://nicegrp.co.uk/dev/hs/ It's not quite finished so there may be obvious stuff, also there's ALOT, going on in the front end, for example: - pages are cached client side (to prevent unnecessary ajax requests for seen pages) - Ajax page requests & pushstate - pdf module for gallery pages - slideshow animations - add image to your custom gallery - alot of menu logic - responsive - lazy loading images on gallery pages Let me know what you think. Thanks
    4 points
  4. I'm going to require WireMailsMTP anyway and will explain how to add mandrill SMTP to it. So my newsletter module will finally have a solid sending base. Better then php mail() and getting blocked as a spammer. @horst:I still have our conversation about this in my head I even saw the "bulk" mail option in your module which is great for this
    4 points
  5. Hi Joer80, there are several threads regarding user management. No need for modules since PW handles this nicely out of the box on a template basis. If you want to edit on a page basis or even field basis there are already some modules you might want to use. Do a Google search like: "site:processwire.com/talk/ user management". Threads like this one are really wonderful and will point you in the right direction.
    3 points
  6. For anyone that has the map hidden initially before being opened resulting in bad rendering of the map. I tried the following that was mentioned here on this post but with no success. After a while(2 hours ) scratching my head I changed it to the following: setTimeout(function() { google.maps.event.trigger($("#mgmap1")[0], 'resize'); mgmap1.map.setCenter(mgmap1.options.center); }, 250); Now works perfectly.
    3 points
  7. New version available. The module now has the ability to update the filename when a new thumbnail is created via the thumbnails plugin. This is important if you use Amazon CloudFront option to serve the files and want to show the changes you've made to the thumbnails immediately (without waiting for the cache to expire). Because when you create a new image crop it's filename doesn't change, I had to force this change in both the thumbnails files and the source file.
    3 points
  8. https://processwire.com/talk/topic/2505-templates-structure-functions-best-practices/ https://processwire.com/talk/topic/1139-some-generalbest-practices-questions/ https://processwire.com/talk/topic/4507-pw-best-practices-application-structure-form-handling/ https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/
    3 points
  9. Hi jckhmmr, Any value that is posted to a page can be fetched with one of the following manners: $input->post->fieldname; $input->post['fieldname']; $input->post('fieldname'); For GET values simply change post to get $input->get->fieldname; See: https://processwire.com/api/variables/input/ Where fieldname is the name of the form input field. So when you have a form <form method="POST" action="<php echo $page->url; ?>"> <input type="text" name="firstname"> <input type="text" name="lastname"> <input type="submit" name="send" value="send"> </form> You can access those fields as follow: $input->post->firstname; $input->post->lastname; A good thing to do always with user input is to sanitize it like this: $firstname = $sanitizer->text($input->post->firstname); $lastname = $sanitizer->text($input->post->lastname); See: https://processwire.com/api/variables/sanitizer/ and welcome to ProcessWire.
    3 points
  10. If you're asking if embedding YouTube videos in an iframe is safe, yes. If you're asking if embedding iframes is safe in general, yes and no -- content within iframe doesn't have access to your site, so in that way you're safe, but malicious content within an iframe can harm visitors of your site, so naturally you'll have to be picky about what you embed. An even easier way for embedding videos from YouTube or Vimeo is the Video embed for YouTube/Vimeo textformatter.
    2 points
  11. Well there is this module by Adrian: Migrator You can export part or all of a sites page tree by selecting the parent and it has options to export everything, including all data pages, fields templates and structural pages or fields and templates only. You can also select a changes since date and time and you can select any additional files over the template files such as includes, css etc On the import side there are 3 options: APPEND will not change settings of existing fields, nor the content of existing pages. It will append new fields to templates and new pages (and date) to the selected Parent Page. OVERWRITE will change field settings and edit the content of existing pages so they match the imported data. REPLACE will match the destination to the source exactly, by modifying page data, changing field settings, and deleting unused fields from templates. You can import user data and created/modified dates as options. I have tried this with part of a page tree for a single page and it works ok. I haven't had time to test the changes since option, but maybe this module is close to what we need? When I have more time I will carry out some tests.
    2 points
  12. I see that the html is not loaded fully since there are no </body> or </html> tags. The code seems to suddenly stop. Could it be that there is some error which is not visible on first sight, but it viewable in the source of the html? Also the minimum requirements are: PHP 5.3.8 and MySQL 5.0.15.
    2 points
  13. About guest, what Adrian meant is that have you by any chance disabled guest view of the pages within the templates of these pages? Look under Access for the templates of the pages that are not working properly...See screenshot below.. Btw, normally not a good idea to publicly expose your php info like that
    2 points
  14. Nope - can't see it in the latest dev. I'm going to put a note about it on GitHub and then if it gets included you can specify PW 2.5 as a minimum requirement.
    2 points
  15. Very good points, Joss. One of the arms of the company I work for sells advertising, in just 3 standard sizes, each size having a price, and I did the same as you mention above with those sizes & prices, so each mention across the site can be updated in one place. Bonus Suggestion - (along similar lines) One thing I have been doing recently is, in /site/config.php, declare $config->siteName = 'Your Site Name Here'; and then I can use that variable anywhere in the site (navbar brand, meta title etc.etc.). Save typing and ensures consistency. (And makes standard boilerplate site profiles easier.)
    2 points
  16. I come back again since ProcessWire 2.2. Great great update in ProcessWire 2.4. Having "Language Support", it makes creating a multi-language website super easy and clear! Hoping to see more new great tutorials under http://processwire.com/docs/tutorials/ section. I am always looking for "best practices" in using ProcessWire.
    2 points
  17. Introducing ProcessDiagnostics and it's helper module suite. (Is this ProcessWire's first community-created module suite?) Description This suite adds a page under the setup menu that displays information about your installation. Each section's data is provided by a specialist diagnostic helper module but it is all collected and displayed by ProcessDiagnostics. The ProcessDiagnostics module itself does not encode any knowledge about what makes up a good or bad setting in PW - (that's done by the helper modules) - but it does the following... Gather the diagnosics (thanks to PW's hook system) Display the collected diagnostics Provide helper functions for describing some common things Dispatch actions to diagnostic provider modules (again thanks to PW's hook system) And eventually it will: Allow control of the verbosity of the output Allow the output to be emailed to a sysop Store the results between visits to the page Detect differences between results at set times Send a notification on detection of changes Although I am curating the collection, anyone is welcome to fork the repo, make changes in a topic branch, and submit pull requests. I've already had submissions from horst and Nico. Diagnostic Providers The current diagnostic providers include... DiagnosePhp - Simple diagnostics about the PHP envirnoment on the server DiagnoseModules - An ajax based module version checker by @Nico DiagnoseImagehandler - Lets you know about GD + Imagick capabilities by @horst DiagnoseDatabase - Checks each DB table and lets you know what engine and charset are in use DiagnoseWebserver - Checks the webserver setup DiagnoseFilesystem - Looks at how your directory and files are configured and warns of permission issues (currently incomplete) There is also a bare bones demonstration diagnostic module... DiagnoseExample - minimal example to get module authors started. Translations English & German (thank you @Manfred62!) Help translating this suite to other languages is always welcome. On The Net Check out Nico's blog post about this suite on supercode.co!
    1 point
  18. Dynamic Roles are a powerful access control tool for ProcessWire. They pick up where traditional roles leave off, and allow you to assign permissions at runtime based on any factor present with the user. Once a user receives one or more dynamic roles (at runtime), those dynamic roles then specify what pages the user can view, edit, or add children to. If traditional roles are a sledgehammer, Dynamic Roles are a scalpel, allowing nearly any finely tuned access control scenario. Traditional ProcessWire roles are limited to assignment of view/edit/add access on a per-template basis. Dynamic roles go outside those limitations and enable you to assign that access based on any factors present with a page (i.e. match any field values). Dynamic Roles assign new access, but do not revoke existing access provided by traditional roles. As a result, Dynamic Roles can be used together with traditional roles, and the two work beautifully well together. Though Dynamic Roles can also replace all situations where you would use traditional roles for access control assignments. If using Dynamic Roles to assign page-view access, you would typically want to use traditional roles to revoke view access from at least the "guest" role at the template level. Then use Dynamic Roles to assign view access to those pages in a more granular manner. This module directly affects the results of all page getting/finding operations by applying the access control directly to the database queries before pages are loaded. As a result, it is fast (regardless of scale), pagination friendly, and requires no further intervention by the developer other than configuring the dynamic roles as they see fit. Because it relies upon new features present only in ProcessWire 2.4.6+, it requires the current dev branch. Sponsored by Avoine Concept by Antti Peisa Code by Ryan Cramer PLEASE NOTE: This module is in pre-release state (like the PW dev branch it requires) and is not recommended for production use just yet. Though we do appreciate any testing and/or feedback that you are able to provide. While not required, this module benefits from ProFields Multiplier. If you have ProFields Multiplier installed before installing this module, it will make this module more powerful by making all of your access control selectors have the ability to use OR-group conditions. Depending on your access control needs, this enables you to accomplish more with fewer Dynamic Roles. How to install Make sure you are running ProcessWire 2.4.6 (dev branch) or newer. Download from GitHub (we will add this module to the Modules directory later). Place all files from this module in /site/modules/DynamicRoles/. In your admin, go to Modules > Check for new modules. Click "install" for the Dynamic Roles module (ProcessDynamicRoles). Click to Access > Dynamic Roles for the rest (see example and instructions below). Example and instructions Lets say you ran a Skyscrapers site and wanted a role enabling users with "portmanusa.com" in their email address to have edit access to skyscrapers designed by architect John Portman, with at least 40 floors, and built on-or-after 1970. Yes, this is an incredibly contrived example, but it is an example that also demonstrates the access control potential of this module. 1. In your admin, you would click to Access > Dynamic Roles. 2. Click "Add Dynamic Role". Enter a name for the dynamic role, like: "skyscraper-test-editor" and save. 3. Under "Who is in this dynamic role?" section, click "Add Field" and choose: Email => Contains Text => "portmanusa.com". This will match all users having "portmanusa.com" in their email address. 4. Under "permissions" check the boxes for: page-view and page-edit. 5. For this contrived example, we will assume the user already has view access to all skyscrapers, so we will leave the "What can they view?" section alone. 6. For the "What can they edit?" section: Click "Add Field" and choose: template => Equals => Skyscraper. Click "Add Field" and choose: architect => Equals => John Portman. Click "Add Field" and choose: floors => Greater Than Or Equal => 40. Click "Add Field" and choose: year => Greater Than Or Equal => 1970. 7. Click Save. Now users matching the conditions of your dynamic role will be able to edit the matching pages, but not any others (unless assigned by traditional roles).
    1 point
  19. 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
    1 point
  20. +1 cstevensjr Thanks Steve and all others involved. I wish more of my work required spending time knee-deep in PW so I could spot stuff like this superb addition sooner so I could say "Thanks ^_^" in a more timely manner, so I might help occasionally and so I could more often use the awesome stuff produced by this fab community. tl;dr Thanks!
    1 point
  21. Looks and feels great. Immediately browsed through the galleries. Just the tennis background image on the Affiliates page ( http://nicegrp.co.uk/dev/hs/affiliates/ ) ist about 2.3MB. Took a while before it loaded and I'm not sture how mobile users like those large image files.
    1 point
  22. An easier way is to use the video text formatter, I would have thought. http://modules.processwire.com/modules/textformatter-video-embed/ Edit: he beat me!
    1 point
  23. I might be completely barking up the wrong tree here, but some synchronisation shouldn't be too hard using the tools that PW already provides. Thinking out loud here, so please chime in and tell me I'm bonkers or whatever. Some data will only change on the remote server - orders, comments etc. Some will only change on the remote server - editorial changes, new pages etc. And some will change of both - can't think of an example. We can probably specify which group each changed item falls into by PW template - template=order, template=comment for the 1st above, template=basic-page for the 2nd. For each of these we just need to know what has changed since we last synced, which is doable. (I'm thinking some smart cookie can write a module for this, but it might be possible through other means.) We can easily get PW to output JSON, XML, CSV or whatever, which can be read in and the changes made to whichever (local or remote) needs to be updated. The only problem is where both sides have changed, there would need to be a diff file created or something. Your thoughts, people?
    1 point
  24. Until then you may use the WireMailSmtp class. It has to, cc and bcc functions and I think Ryan will use the same names for the functions.
    1 point
  25. Hi Nooiseladder, have you searched the forums? There are plenty of topics discussing your question.
    1 point
  26. A new proposal to refine the "MVC" pattern: Action-Domain-Responder I hope you don't mind me dropping that in your thread, but I didn't want to start a whole new topic
    1 point
  27. Then you need two loops inside: <?php foreach($page->nuoma as $field) { echo '<div class="small-12 columns large-6 columns bobkat-nuoma">'; foreach($field->big_img as $big_img) { echo '<a class="fancybox" rel="gallery1" href="'.$big_img->url.'">'; } foreach($field->small_img as $small_img) { echo '<img src="' .$small_img->url. '" alt=""></a>'; } echo '<h2>'.$field->bobkat_name .'</h2>'; echo $field->body; echo '<span>'.$field->price.'</span>'; echo '</div>'; } ?>
    1 point
  28. You can use Hanna code to replace shortcodes by html tags, or even create a formatter that turns something like (----------) in a closing and opening div. I suspect that Ryan's new Pagination Textformatter could also be a good fit for you, but I'm not sure what it does exactly yet http://modules.processwire.com/modules/textformatter-pagination/ As for me, I prefer the template way whenever I can.
    1 point
  29. Thanks apeisa, That works except that I want to use the resulting pages as part of a $pages->find( ) not just at run time. For example, If I have a Template and set of Pages representing Cities, and another Template and set of Pages representing Laws. I want to have a FieldTypePage in the Laws template that allows Cities as children, and use InputFieldSelector to make it easy to add page references. Then I could use Subfield Selectors to find all Laws for a given city/cities. With just the SelectorFieldType, I could output what Cities apply to a given Law at runtime in a template, but I can't access those values for searching/filtering. Make sense?
    1 point
  30. teppo deserves an extra like for mentioning that new functionality in the dev version. Here's a screenshot of how it looks:
    1 point
  31. No problem, thanks for trying out ProcessWire - a lifesaver in itself. I almost forgot: welcome to the forums, Deyan!
    1 point
  32. Aha! That works. Thank you very much, a lifesaver
    1 point
  33. What value does $open have? I would do it like this: <?php $tenders = $pages->find("template=tender, sort=-created, tender_open=1"); echo "<h3>Tenders</h3>"; if(count($tenders) == 0) { echo '<p>There are no tenders available!</p>'; } else // Otherwise show the output { echo "Output list here"; }
    1 point
  34. What about this: $np = $pages->clone($page); $np->of(false); $np->title = 'New Page'; $np->name = 'newpage'; $np->save();
    1 point
  35. Have a read here as well for 'Best practices before upgrading' https://github.com/ryancramerdesign/ProcessWire#upgrades
    1 point
  36. https://processwire.com/talk/topic/52-how-do-i-upgrade-processwire-to-the-latest-version/ Definitely no data loss
    1 point
  37. I finally found time to try out this module. Congrats to all for the dedication, collaboration and hard work in creating this needed tool. A very useful module.
    1 point
  38. New version available: It now uses an iframe implementation, not as easy as it sounds, because the text area and the iframe somehow need to share the data. At first I went for the session thing (see above), but then realized there would be too many server requests going on. Then I went with cookies, nah 4096 byte limit .. so I now use local storage with a cookie fallback. So now the styles are scoped properly, no clashing of rules. The refresh interval is now configurable. Major code refactoring under the hood and many additions, little optimizations, not so elegant anymore, but whaaateva. It now comes with another optional theme Solarized Dark, it's not as pretty as I thought, will look for better default ones Key strokes of space and enter are ignored, so no unnecessary refreshes are taking place. When updated content is injected (and overflows the browser window), it does not scroll to to the top, but stays at the current position. Summary how it now works (for those interested): The text area is watched for changes, when it changes, the text is sent to the server, converted via text formatters. a local storage item with a unique key of that field and the respective page is set to true meanwhile within the iframe, JS is polling for that value very frequently (no server requests are taking place here), if it's true the text is injected (and only then to prevent constant flickering), the value is set to false so the iframe is only injecting when changes happen in the text area Roadmap: I would love to make the config on a per field basis, but since this module is not an input field but merely hooks into the rendering I am not sure how to, will look into that. Oh, and it's on the module directory now too: http://modules.processwire.com/modules/process-textarea-preview/ Cheers!
    1 point
  39. Can we have options for CC and BCC please ryan (and then Teppo in SwiftMailer )? It's not mega urgent, but these do come in handy in a few situations.
    1 point
  40. It didn't happen when I was doing this in PW 2.3.1. And when editing related pages it happens quite often to do that at the same time in different browser tags or windows.
    1 point
  41. Since you are comfortable with using the MVC pattern, this may be the way you want to go in ProcessWire too. ProcessWire is very much supportive of the MVC pattern, it's just that it doesn't require it. ProcessWire is providing your models, your template files provide your controllers, and you provide the views with the TemplateFile class (or some other view loader of your own if preferred). You can also choose to target some template files/pages as views and call $page->render() on them. If you are interested, the Blog profile does use an MVC-style approach and would be worth looking at. But after you spend some time with ProcessWire, I recommend finding the approach that best suits a particular situation rather than locking yourself down to using the same one all the time. ProcessWire is giving you a lot more in some areas than a typical MVC framework does, so you may find even faster and more maintainable ways to structure your code, depending on the situation.
    1 point
  42. This is the only way I know to create different sizes when uploading images: <?php class ImageCreateThumbs extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'ImageCreateThumbs', 'version' => 100, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHookAfter('InputfieldFile::fileAdded', $this, 'sizeImage'); } public function sizeImage($event) { $inputfield = $event->object; if($inputfield->name != 'images') return; // we assume images field $image = $event->argumentsByName("pagefile"); $image->size(120,120); $image->size(1000,0); } } https://gist.github.com/5685631 What I don't know is if it really makes a difference (I guess), and if using drag and drop ajax upload and old school upload would process image one by one. My suggestion is to also upload image already in 1000x* pixels because if they upload 3000+ px images it will just takes a lot longer.
    1 point
  43. Hi! I'm working on my first processwire project and everything is working ok, but i have a question stuck in mi head: which is the "best" way to organize functions and stuff on php/processwire (is my first php project too). I have something like this: -- functions.inc -- home.php -- foo.php -- bar.php functions.inc have all the "get" functions that pull out content of the database, like: function getHomeNews($posts){ $out = array; foreach($posts as $post){ $out["name"] = $post->title; } return $out; } then in my home.php template i put a "render" function and do the echo thing to show the html on the front end: function renderHomeNews($posts){ foreach($posts as $post){ $name = $post{name}; $out = "<h1>{$name}</h1>" } } $news = $pages->find("template=news"); echo renderHomeNews($news); Suddenly a question comes to my mind, what if i put all the "render functions" of the project on renders.inc and all the "getter functions" on getters.inc, so the code on the template could be smaller and all the functions will be on just two files. That makes sense? is the same stupid thing? How do you organize your projects? Thanks!
    1 point
  44. Good question. I'm not sure there's a simple answer though. What you mentioned about migrating changes directly from the database of WordPress doesn't sound like a safe thing to do with any database-driven CMS. The nature of a relational database is that there will be records in different tables referencing each other, so when you've got two versions of the same database, they would be challenging to merge. As a result, it's a problem if you have two databases going off on different paths of changes if they need to come back together at some point. I use my staging servers for staging things like new template files, modules, new PW versions, etc. I don't usually stage actual content from one server to another. Or if I do, I'm copying and pasting it (in PW admin) from one to the other. But the way I usually stage major content changes is to make them on the live server, but in a staging part of the site (unpublished, hidden or otherwise inaccessible pages). When ready to migrate, I publish or drag the relevant pages to their live home. Note that this is for content, and not for anything that could interfere with the operation of the live site. Anything that could interfere with the live site (templates already in use, modules, versions, etc.) ideally should be staged on a different server. I don't know of a better way than that. It's not perfect, but it's always worked well for me. Longer term, I want ProcessWire to support a workflow that lets a staging server talk to a live server and publish from one to the other (using web services). I already use this workflow on a lot of sites with custom modules, but they are specific enough to the individual sites that they aren't suitable as a broader solution. However, I do think we'll have a broader solution like this in the next 6 months to a year.
    1 point
×
×
  • Create New...