Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/08/2013 in all areas

  1. I actually have been working on a module called Lister that does much of this. Though it's not yet quite as flexible as I'd like it to be for release, so I'm mostly using it in my own projects until I can get the time to take it all the way.
    7 points
  2. This module does two things: 1. Gives you the ability to perform text matching on page paths/urls with selectors, i.e. $pages->find("path%=blahblahblah"); 2. Adds an index of page paths in a separate table, potentially making retrieval of a page by path faster. Meaning, it can increase the performance of $pages->get("/path/to/page/"); and similar types of retrievals. I honestly haven't used this module all that much. Its performance benefit is theoretical and I'm not sure it's actually measurable. As a result, I'm not sure I'd necessarily install it unless you want to perform text matching on page paths. This one will probably be removed from the core in PW 3.0 and kept as a 3rd party module.
    3 points
  3. This is great and a total no-brainer, very comfortable. I know there are a couple of solutions out there including command line based ones (also within Grunt and Compass), but this has been the most usable for me yet. http://spritecssgenerator.formfcw.com/ You can name your symbols like css selectors, and of course use Sass with it too. I name my symbols like this (Sass placeholders): %sprite-next %sprite-next:hover %sprite-prev %sprite-prev:hover and so on, and then I extend my desired elements like this: .my-element { @extend %sprite-next; } It even summarizes symbols with same sizes into single selectors.
    3 points
  4. This is a bit more complex but works really well (for pw dev version): Create one custom template without fields following my module's instructions and paste this code in the template's file: <dl class="nav"> <?php foreach($page->children as $child) { echo '<dt><a class="label" href="'.$child->url.'">'.$child->title.'</a></dt>'; echo '<dd>'.$child->headline.'</dd>'; }?> </dl> Create a second custom template with the fields "querystring" and "headline" (give them the name you want, but update them in the code above), and paste this code in the template's file (if changed, update "querystring" to the real name of the field) <?php if(!$input->get->q) $session->redirect($page->url.$page->querystring); $page->process = "ProcessPageSearch"; require($config->paths->adminTemplates . 'controller.php'); Create a page under "Admin" and give it the first template. This will list all the children pages of that page using the info from the above fields of each. Create some pages under this page and give them the second template. Copy the query strings (including the "?") from the search pages that you want to recreate and paste them in the querystring field of these children pages. Don't forget that you can remove the sidebar by deleting "show_options=1". Maybe you will also want to update the "children" tab of the first template to accept only pages with the second template as children.
    3 points
  5. Xeto, welcome to the forums. You have a few options: 1. Leave the data in your tables and just query it from ProcessWire using $this->database (PDO) or $this->db (mysqli). 2. Export your tables to a spreadsheet (CSV) and import using the ImportPagesCSV module. 3. Query or export your data out of your existing tables and create new pages from the API. This is the route I usually take. See the cheatsheet. Also see the Data Conversion section (at the top) of the CMSCritic case study, which describes how to query data out of an existing table and create new pages from it.
    2 points
  6. Hi all, You've probably noticed I have been away. I am now back (but will be away here and then). What have I missed please? I have tonnes of posts to wade through (just 15 pages of new threads), thanks Cheers, /k
    2 points
  7. I wanted to give you a little preview of a new module I've been working on recently: the Form Builder module. This module lets you create simple-to-complex forms and place them in your site without any need for development. In this video we show how we can create, publish and test a simple contact form in less than 5 minutes. Then we take a quick look at a more complex form (already produced). I recommend viewing the full screen + HD 720p version so that you can see it more clearly than in this small forum embed. (note: there's no sound, so no need to adjust your volume) More about the Form Builder The Form Builder has many options for the developer to customize output and create their own themes, markup, etc. But the goal here was to build something that could enable you (or your client) to publish a form in less than 5 minutes, so that's the focus of this video. This tool is literally easy enough for your clients to create and manage their own forms. Or from a developers perspective, it takes something that used to consume hours and makes it happen in minutes. Form results save in the database and optionally can be CC'd to you by email. Result entries and be viewed, filtered by date, and even edited in the admin. You can export results to a spreadsheet as well. I'm working on the ability to export to pages, though that isn't quite ready yet. How the Form Builder will be licensed This module will be individually licensed on a per-site basis for a small license fee. It will also be available for free personal use to established forum members. Basically, I want to see if I can substitute some of my client work to focus on ProcessWire instead. And in order to do that, I need to have an income (I have a family to support). So I thought that building a special tool like this would be a way to make a go of it. A lot of you have asked to make donations to the ProcessWire project, and while we still won't be able to take donations, you will be able to support the ProcessWire project by purchasing and using the Form Builder in your own client projects. So a lot of motivation for this module came from wanting to provide something really special for all that had wanted to support ProcessWire. After a few months of work, I'm pretty happy with how this module has turned out -- it's already saved me tons of time in my client projects. So I'm thinking and hoping you guys will really like it too. I look forward to your feedback.
    1 point
  8. ProcessWire is fast. With ProCache, ProcessWire is insanely fast! ProCache provides the ultimate performance for your website by completely bypassing PHP and MySQL and enabling your web server to deliver pages of your ProcessWire site as if they were static HTML files. The performance benefits are major and visible. Using ApacheBench with the homepage of the Skyscrapers site profile, we completed 500 requests (10 concurrent) to the homepage. The amount of time occupied to complete each of these was as follows: 29 seconds: no cache enabled 6 seconds: built-in cache enabled 0.017 seconds: ProCache enabled As you can see, the performance benefits are substantial. ProCache gives you the ability to drastically reduce server resources and exponentially increase the amount of traffic your server can handle. This is especially useful for traffic spikes. Beyond measurements, ProCache makes your website feel faster to users, respond faster to search spiders (which can help with SEO), and helps to conserve server resources for requests that actually need PHP and MySQL. ProcessWire is already very fast, and not everybody necessarily needs what ProCache delivers. But regardless of whether you need it or not, there is little doubt that you can benefit greatly from ProCache. For an example of ProCache in action, visit processwire.com or the skyscrapers site. Look in the lower right corner of the page (in the footer). If it says "ProCache", it means the page was delivered via ProCache. We did this for demonstration purposes (ProCache does not put anything in your markup unless you tell it to). More information about ProCache can be found on the ProCache documentation page. Please note There is a known issue when using ProCache with the LanguageLocalizedURL module. I hope to have this figured out soon, but for the moment you should not use ProCache in combination with that module as it doesn't appear to work in full. ProCache does not yet support multi-host capability (i.e. cache and delivery of different content per hostname), but it will very soon. How to get it Like with Form Builder, ProCache was produced as a commercial module to support development of ProcessWire. It is now available for purchase here. ProCache is in a beta test period. As a result, it's being offered with introductory pricing that may increase once we're out of that period. During the beta test period, I just ask that you let me know if you run into any bugs or issues during your use of ProCache. I also recommend that you follow the usual best practices with regard to backing up your site and testing everything before assuming it's all working. Beyond the introductory pricing, you may also use coupon code PWPC-BETA for 10% off the listed prices at checkout. This code will expire as soon as we're out of beta. When you get ProCache, you'll also get 1-year of access to the ProCache-members support and upgrades board, available here in the ProcessWire forums. Upgrades to ProCache will also be posted there for download. Disclaimer: At the date/time that I'm writing this, I think that I am currently the only one using ProCache in production use. That's why I'm providing it with the lower costs and coupon. If you are running production sites where everything must always work perfectly, you will either want to: 1) wait to install on important sites till it's out of beta; or 2) test thoroughly on a staging server or localhost before taking it to production use. In either case, always make sure you have good backups anywhere you install new modules, and always test to double check everything works how you want it to. Get ProCache Now ProCache Documentation Below are a few screenshots that show the configuration screens of ProCache. Have questions about ProCache? Please reply to this topic. Thanks for your interest in ProcessWire ProCache!
    1 point
  9. I have a big database full of various tables that I plan to import to ProcessWire as CSV. Each record/row has a field corresponding to an image number. Then I have a folder full of the numbered images. After importing the CSV, I am planning to import these image like so: foreach $imported_pages as $page { if ($page->image_number) { if (file exists with image_number in the filename) { //Code below from Ryan $page->images->add("path or URL to image"); //save the page $page->save(); } } } Does that look right? Thanks!
    1 point
  10. Hello there! To get the full URL of page, try this: echo $page->httpUrl; // Current page URL echo $pages->get(1)->httpUrl; // Home URL
    1 point
  11. // prependFile: Filename to prepend to output, must be in /site/templates/. (default=$config->prependTemplateFile) PageRender.module #302 $output->setPrependFilename($config->paths->templates . wire('sanitizer')->name($options['prependFile'])); It runs the value through $sanitizer->name which doesn't allow "/". So no it's not possible.
    1 point
  12. trackChange() is a method on every Wire derived object, which includes most of ProcessWire's objects. The question would be what you are calling trackChange() on and whether the change tracking state is on or off? Also, there are related methods, also accessible everywhere that trackChange() is: // turns change tracking ON or OFF $obj->setTrackChanges(true|false); // returns TRUE if change tracking is ON or FALSE if off $bool = $obj->trackChanges(); // returns an array of changes that have occurred $array = $obj->getChanges(); // tracks the change, only if change tracking in ON $obj->trackChange('field_name'); // clears the list of tracked changes $obj->resetTrackChanges(); // hook that is called anytime a change occurs: only useful if you want something to be notified of a change $obj->changed(); My best guess is that you may need to call $page->trackChange('field_name'); rather than the form itself. That's because the form is managing most of that on it's own, and may be clearing/resetting the trackChange call you did. Also, a page's changes are cleared after a successful save(), if that matters.
    1 point
  13. There really isn't much point in a cropping=false value to this particular call, because that would force a stretched image... something that there is almost never a practical use for. You'd be better off just specifying only a width or height, to ensure you don't get a stretched image. But you are correct in that for the most part, ProcessWire only maintains one thumbnail per dimension. There is one exception: if you specify details about where it should crop, it should keep separate copies, i.e. $img1 = $image->size(200, 100, array("cropping" => "center")); $img2 = $image->size(200, 100, array("cropping" => "northwest"));
    1 point
  14. Try on a smaller set of rows and see the magic happen ;-) looks good to me, did something similar just yesterday with success (of course). Even large MB-sized PDFs were downloaded from a external server smoothly.
    1 point
  15. I look forward to getting ProcessWire compatible with Composer. That's one of the things I'd wanted to do with 2.4 though other priorities for ProcessWire have gone ahead of it and likely won't be supporting it till after 2.4, but hopefully soon after. We may need to make changes to directory structure, but I'm averse to doing anything major there as I think we need to give priority to what's best for the web sites that ProcessWire powers over what's best for Composer. But we'll do what we have to do, just always in the context of our intended audience over Composer's (which have crossover, but are also different in many ways). Our audience veers much further towards web developers than dedicated PHP coders. Most of our audience is not integrating multiple PHP projects, but we do want to better support the few that are. 2.4 development is pretty much finished. Just trying to work out all the bugs before releasing it. Though I think it is already just as stable as 2.3 for the most part. I am also very interested in evaluating PSR-4 for ProcessWire. With regard to PSR-2, I'm less enthusiastic. Standards are great, and I support the PSR-2 standard for new projects looking to adopt a standard. But I think it's silly for projects that have already adopted a standard, as PSR-2 is a lot of compromise. ProcessWire's own code standard doesn't compromise so much, and in our context PSR-2 is a downgrade. However, I also see it as largely a non-issue. I don't care what standard people contribute code in, as IDEs make it largely irrelevant, at least for the way we merge code here. PhpStorm converts code to ProcessWire's standard automatically. I just encourage people to code in a standard that they find most readable and usable for them, so long as it's consistent.
    1 point
  16. Good to have you and josh back again
    1 point
  17. SOOO sorry about that Alxdre' I recently pushed compatibility fixes for Unify with the 2.3.5 dev version of PW and it seems I missed this error coming up with the current master. I pushed a quick fix.
    1 point
  18. I'm building up a ProcessWire boilerplate for quick starting the post-installation work. I've got a basic .gitignore which covers ProcessWire ignores, as well as other ignores for the rest of the project. You can find it here: https://github.com/fixate/pw-boilerplate/blob/master/!root/.gitignore It's based off of Ryan's SkyScrapers .gitignore: https://github.com/ryancramerdesign/ProcessWire/blob/master/.gitignore but keeps certain files, such as .htaccess (we use a custom one which extends ProcessWire's with H5BP's), in the repo so that they are available to team members. For this same reason, we never ignore .gitignore itself; it must be available to all team members. You can safely remove the styleguide and Grunt stuff if they're not part of your projects.
    1 point
  19. i used soma 's AJAX PAGE SEARCH module today i found a issue after test: when i type a keywords not use letter or number (chinese keywords) ,the result will return "Please enter a search term in the search box (upper right corner)...", obviously the search.php cant get inputbox "q"'s value..thise issue just happend on IE. Chrome and FireFox work ok. then i open AjaxSearch.js, find "data: param_name+"="+value," (line 76) replace into "data: param_name+"="+encodeURI(value)," and its working.. nice module, thank you ,soma!
    1 point
  20. add a question , this code not work( jquery version: 1.9) $('.ajaxSearch_close') .live('click',function(){ $(this).closest('#ajaxSearch').fadeOut(); }); you can use this replace it $(document).on("click", ".ajaxSearch_close", function (e) { $(this).closest('#ajaxSearch').fadeOut(); });
    1 point
  21. http://www.tamperemusicfestivals.fi/jazz/ The four-day jazz festival starts today. There will be a lot of traffic on the website, but I'm sure everything will run smoothly since ProCache makes the site run very lightweight and fast. In previous years this website has been running on WordPress or MODX. This year we switched to ProcessWire, and it has been a huge improvement. Everything on the site is fully editable, which makes the client very satisfied. Also, PW has revolutionized my workflow as well. I have quite the same feeling as when I switched from Windows to OS X : ) Logo is designed by the artistic director of the festival, everything else by me.
    1 point
  22. Now you've got me confused. I think there's an error in your logic that can't be solved - not with a generic solution anyway. At first you said: And then later on: So, you'd like "harry" to return all pages with "harry" in any of your search fields. This could be interpreted as one of the following: give pages with all words in any of the search fields ​$ret = find("title|author*=$q") // exact phrase actually, but #1 isn't the right one anyway OR give pages with any of the words in any of the search fields $ret = find("title|author*=" . str_replace(" ", "|", $q)); // first solution by diogo OR give pages with at least one of the words in all of the search fields (not necessarily the same word matching all the fields) $q = str_replace(" ", "|", $q); $ret = $pages->find("author*=$q, title*=$q"); // what I proposed earlier Now, if I've understood you right, making a search "rowling potter": should not give all pages with "rowling potter" in any of the search fields (#1) should not give all pages with either "rowling" or "potter" in any of the search fields (#2) should not require "rowling" or "potter" in all of the search fields (#3). Instead, you'd want it to give, hmm, all pages with one of the words matching the title and another one matching the author, unless there aren't any when it should give all pages matching any of the words in any field - or something like that. And we're talking about two words and two fields in this example, while your code example mentions actually four fields already. Looks like an impossible job for a generic selector/code solution. Now looking again what Wanze said I feel like he's been right all along: if you need anything more than a trivial match (one of #1..#3 given above), your only option may well be multiple search fields. One for each search field you need to handle in a special way that is. Then the search would be for example author:"rowling", title:"potter" and you could even give an option to choose whether AND or OR should be used (author: "rowling" AND title:"potter" <--> author:"rowling" OR title:"potter"). Now you actually could build a generic handler. Multiple fields lets the user define more precisely what they're after but then again they also require the user to understand which field to use for different searches. Maybe a generic search field + solution #2 for those who just want to find what they're looking for and an advanced search for those who need to refine their search to get only the results they're really after? If there's lots of data and giving some extra matches along with the exact ones (#2) really is a problem, then an advanced search could be the way to go. My personal preference is one single search field giving properly ranked results instead of a monstrous hard-to-fill form maybe giving me only the one match I'm after, but I see there's a place for the latter as well. Sorry for the (too) long post. I got a little carried away.
    1 point
  23. Thanks ryan! I have done.
    1 point
  24. This should do it: ^(?:0?[0-9]|1[0-2]):[0-5][0-9] [ap]m$
    1 point
  25. Getting stoked The latest version on github now supports migration of repeater field page content and fixes the problems with migrating page field content. That should take care of migrating the fields, templates, and page content for all the field types, not including page content for file and image fields as obviously these can't, or more accurately, shouldn't be included in a json file. Multi-language fields should migrate perfectly so long as you have the required language support modules and languages installed on the destination PW installation. Let me know if you have any troubles here - I did see some weird errors during early testing - I hope they are all fixed now. Please note: that most of my testing of late has been with the "Everything, including all data pages" option on export and import. I need to go back and test the other options soon, but I'll probably do that when I start implementing the series of checkboxes allowing you to select exactly which fields, templates, and pages to be exported and imported. Also, I have been testing with the latest dev version of PW (downloaded today). Not sure if anything is critical, but if you are getting errors, please try upgrading PW first.
    1 point
  26. Ah the pixel coordinates were indeed not working correctly, the following code should fix that: if(strpos($this->cropping[0], '%') === false) $pointX = $gdWidth * ((int) $this->cropping[0] / $this->image['width']); else $pointX = $gdWidth * ((int) $this->cropping[0] / 100); if(strpos($this->cropping[1], '%') === false) $pointY = $gdHeight * ((int) $this->cropping[1] / $this->image['height']); else $pointY = $gdHeight * ((int) $this->cropping[1] / 100); Though if you want to specify a crop without resizing, it should be a different function in the Pageimage class or an extra option for the size function ("resize" => false or something?). I've created a GitHub repository for the FieldtypeFocusPoint module I'm developing. It's my first ProcessWire module so I hope I've done everything correctly. Maybe u guys can take a look at it? All suggestions are welcome https://github.com/u...FocusPointImage Usage: $page->image->sizeWithFocusPointCropping(704, 165);
    1 point
  27. Very much like that. I have common includes (/templates/includes/common.inc) where I keep my most used functions (ie. renderList, renderItem) which can be used with almost any kind of content (blog posts, news, events etc..). I have some more spesific functions also (like renderCalendar etc) which require some spesific kind of content (like event here). I currently keep them in same file, but I might put those as separate file (like events.inc).
    1 point
  28. I should probably clarify that I'm interested in methods to abstract these elements outside of the templates, so I can reuse them. Perhaps I'm overthinking it...do people just do something like this? blog_entry.inc: function blog_entry_markup ($x) { echo "<strong>$x->title</strong><br />$x->body"; } blog_template.php: include('blog_entry.inc'); foreach ($page->children as $child) { blog_entry_markup ($child); }
    1 point
×
×
  • Create New...