Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/24/2014 in all areas

  1. Pageimage Naming Scheme I have created a module that extends the naming scheme for images. It reflects more options within the filename. An example is here: http://images.pw.nogajski.de/new-naming-convention/ The module is on github (zip)- additionally you need PW version 2.4.2 or newer (while writing this, the latest dev version from today) The module is in alpha state, so yet do not use in production sites. To install and start using it works very smooth: It doesn't force to recreate your already cached images, only uses the extended naming scheme when need to create new image variations. Also recognizes both naming schemes when collecting imageVariations. Recognizes PageImageManipulator-files too per update to 0.1.3. If you want to uninstall it, you can run a cleaning script from the configuration screen that removes imagevariations to avoid orphaned files when switching back to the core naming scheme. Running the cleaning script as simulation is supported too. --- There are a new thing to mention: You can send a new option together with your images $options array: "forcenew" => true! This results in recreating these single variation of the image, without dropping all other variations. Now that you can have a lot more variations per image, this should be the preffered way to drop / recreate cached image versions. Questions, suggestions are welcome.
    3 points
  2. Hi forum, got a new one up and running: http://www.praxiskreuzer.de. This is a relaunch, the new side replaces a very outdated one. The client is a very renowned GP in Bonn, Germany with practices on two locations in the city. Lucky I am, she invested in a professional shooting which made it easier to create a bright and nice look & feel. Technically there is nothing particular here as you can see, except that the site features my fabulous Unsemantic site profile ;-) The site runs on PW 2.4. Please let me know what you think.
    3 points
  3. Not hard, but you need to know what you are doing . Changes will be required in both modules - FieldtypeEvents.module and InputfieldEvents.module. Changes needed in the former are slightly more tricky since Fieldtypes describe and create database schemas. Looking at the code, currently the field 'data' that is required by all Fieldtypes is currently being used to store the values of the 'date' field as a unix time stamp. This would probably have to move to another column in the database, e.g. 'date' so that 'data' can instead hold the id of the selected page in your page field type. Changes to the latter are relatively easier. You would need to add a column to the events HTML table. You could then use the API to add, for example, a select field: $f = $this->modules->get('InputfieldSelect'); //more field properties as required... $opts = wire('pages')->find('template=hosts'); foreach($opts as $opt) { $f->addOption($opt->id, $opt->title); } From here it is just a matter of $f->render() in the table column you added (the <td>), to get something like this:
    3 points
  4. Hey, a friend of mine opened a local business because she's giving vegan cooking lessons for some time now and wants to get into professionality with catering, vegan food for events and so on. I did her website with Processwire. In German only, but well. http://www.veganwerkstatt.de Tools: ProcessWire 2.4 FormBuilder Facebook OpenGraph API Inkscape GIMP Raspberry Pi Vim Sublime Text 2 The development process really showed me that Raspberry Pi sucks with Apache2. Well, I'm going to get a vserver. Hope you like it. Regards Tom
    2 points
  5. @Seuche: I recommend getting an uberspace "server" ( https://uberspace.de/ ). They're absolutely awesome guys, their servers are great, their philosophy rocks (pay what you want, use the cli...) and their support is beyond any expectations.
    2 points
  6. Happy easter! Lately I was trying to gain an overview of Open Source projects to join, but didn't succeed (at that time) to find such a directory. In my mind, there would be filtering through both languages/frameworks, difficulty levels and beginning tasks. So I started to write down a concept sketch about such a project list myself, maybe to start as a side project to experiment and learn from. In the meantime I found openhatch.org and up-for-grabs.net. But the early concept in my mind has starting drifting to slightly another approach for supplying OSS project data. Before I go any further down this road I would be grateful if some of you could give the following a read: https://github.com/contriboo/contriboo-concept In this markdown file I tried to sum up the idea. Any feedback on this would be highly appreciated Maybe its a "me too", maybe dead on arrival because of conceptional quirks, but I want to give it a try at least. And why am I posting this on a ProcessWire board? Well, the last weeks I found out that it would be perfect to start such a directory with PW - at least for me not being a backend-guy. But I could have produce nice results/functions in a short period of time. And surely PW cares about Open Source Kind regards! m
    2 points
  7. Just pushing this up, since meetup is getting closer (next week!). I have reservation big enough for 12 people... to make sure we fit in, I hope you guys can confirm your coming by emailing to me: antti@avoine.fi or by phone 041-4383991.
    2 points
  8. Hi Alan, the reason why you have to use eq() is that your images field is set to accept multiple images. You should set the image field to accept only 1 image and then it will work. So "images" probably isn't the best name for the field, but you get the idea
    2 points
  9. First PW-meetup in Finland will take place at Tampere, Friday 2.5.2014, 12:00. I'll give you exact address when it's confirmed, but it will be walking distance from Tampere railway station. It will be free event for everyone. Avoine will offer some coffee and if we get really lucky, some cookies also. I think we will have something between 5-10 people coming, so it will not be that formal event. If you have anything you want to talk or show, please get in touch with me (antti@avoine.fi / 041-4383991). Anything goes - showcase something you have build, tell us about the great idea for module, propose plan that will help PW to spread in Finland etc.. After the 3 or 4 hours we can change location to pub and continue the world changing plans. No registration required, but always to happy to hear if you are coming (here or email).
    2 points
  10. This module provides a way to rapidly generate Page fields and the required templates and pages for use as a drop down select (or any other Page field type). This module will let you create a full page field setup in literally a few seconds To use, run Page Field Select Creator from the Setup Menu Enter a Field Title, eg: Room Types Select Options - These will become the child pages that will populate the page field select options. There are two different options. Option 1. TITLE FIELD ONLY - enter one option per line, eg: Single Double Suite Option 2. MULTIPLE FIELDS - the first line is used for the field names and the first field must be 'Title'. Subsequent lines are the values for the fields, eg: Title, Number of Beds, Number of People, Kitchen Facilities Single, 1, 1, Fridge Only Double, 2, 2, Fridge Only Suite, 3, 6, Full Kitchen Choose the parent where the page tree of options will be created, eg a hidden "Options" parent page Select a "Deference in API as" option depending on your needs Choose the input field type Check whether "Allow new pages to be created from field?" should be enabled. As an example, if you entered "Room Types" as the field title, you would end up with all of the following automatically created: a fully configured page field called: room_types MULTIPLE FIELDS OPTION - 3 additional fields - number_of_beds, number_of_people, kitchen a parent template called: room_types a child template called: room_types_items (with either just a title field, or with the 3 additional fields as well) a parent page called: Room Types a series of child pages named and titled based on the per line entries in the Select Options textarea The templates are configured such that the "room_types_items" child template can only have the main "room_types" template as a parent, and vice versa. Then all you have to do is add the newly created page field to any template you want and you're ready to go! You can grab it from: Modules directory: http://modules.processwire.com/modules/process-page-field-select-creator/ Github: https://github.com/adrianbj/ProcessPageFieldSelectCreator
    1 point
  11. I exported a CSV file from freebase.com that contained all the skyscraper fields I wanted to use. Then I created a simple shell script to import it from the CSV. Note that I only used a shell script for convenience, you could just as easily do this from a ProcessWire template file if you preferred it or needed to do this from Windows, etc. Below is a simplified example of how to do this. The example is fictional and doesn't line up with the actual structure of the skyscrapers site, nor does it attempt to create page relations or import images. If you are interested in how to do that, let me know and I'll keep expanding on the example in this thread. But I wanted to keep it fairly simple to start. First, here is the contents of a CSV file with each line having a skyscraper building name, city, and height. /skyscrapers/skyscrapers.csv (Building, City, Height): Sears Tower, Chicago, 1400 John Hancock Tower, Chicago, 1210 Empire State Building, New York City, 1100 IBM Building, Atlanta, 860 Westin Peachtree, Atlanta, 790 Next, create a new template in ProcessWire and call it "skyscraper". Create a text field for "city", and an integer field for "height" and add them to the skyscraper template. Create a page called "/skyscrapers/" in ProcessWire, that will serve as the parent page for the skyscrapers we'll be adding. Here is the command-line script to load the ProcessWire API, read the CSV data, and create the pages. As I mentioned above, this could just as easily be done from a template, where the only difference would be that you wouldn't need the shebang (#!/usr/local/bin/php -q) at the beginning, nor would you need to include ProcessWire's index.php file. /skyscrapers/import_skyscrapers.sh: #!/usr/local/bin/php -q <?php // include ProcessWire's index file for API access // (this isn't necessary if you are doing this from a template file) include("./index.php"); $fp = fopen("./skyscrapers.csv", "r"); $template = wire('templates')->get("skyscraper"); $parent = wire('pages')->get("/skyscrapers/"); while(($data = fgetcsv($fp)) !== FALSE) { // create the page and set template and parent $skyscraper = new Page(); $skyscraper->template = $template; $skyscraper->parent = $parent; // set the skyscraper fields from the CSV list($building, $city, $height) = $data; $skyscraper->title = $building; $skyscraper->city = $city; $skyscraper->height = $height; // set the URL name, i.e. Sears Tower becomes "sears-tower" automatically $skyscraper->name = $building; // save the skyscraper $skyscraper->save(); echo "Created skyscraper: {$skyscraper->url}\n"; } To do the import, make the script executable and then run it from the command line: chmod +x .import_skyscrapers.sh ./import_skyscrapers.sh OR, if you are doing this from a template file, then load the page (that is using this template) in your web browser, and that will execute it. The output should be: Created skyscraper: /skyscrapers/sears-tower/ Created skyscraper: /skyscrapers/john-hancock-tower/ Created skyscraper: /skyscrapers/empire-state-building/ Created skyscraper: /skyscrapers/ibm-building/ Created skyscraper: /skyscrapers/westin-peachtree/ If you go into the ProcessWire admin, you should see your skyscrapers. I used an example of CSV file for simplicity, but the same method applies regardless of where you are pulling the data from (web service feeds, etc). For the actual skyscrapers demo site, I used Freebase's web services feed to pull the data and images, etc.
    1 point
  12. enable tags on image field.. use tag 'featured' $images = $page->images->findTag('featured'); or get first an array of all images from the template gallery or whatever then run your findTag on that array
    1 point
  13. Thanks for the kudos. Hope you enjoy it. I am hoping to get to those improvements that Steve suggested sometime soon, but just completely swamped here at the moment!
    1 point
  14. Wow, Adrian, I am such a clutz for having not spotted this Module before, thanks SO much for creating it! Cheers, -Alan
    1 point
  15. I like this. The pictures seem to be very authentic which, to me, is very refreshing. Wish her good luck on this important endeavor.
    1 point
  16. It's rare that I need multi-lang support, but I always liked the way it worked in Textpattern. This looks great!
    1 point
  17. It's a returning thing we all have, adding personal/company information on a website. Would it be beneficial to have a fieldtype that handles all that contact information ? What do you think ?
    1 point
  18. Hi everfreecreative, thank you for that catch! I had been switching it back and forth knowing that in some circumstances search is limited in some way when it's only 1 image (although limiting to onl1 one image was just what I wanted) and sure enough the last way I had left it set while trying to debug my own attempts was to 0. Switching it to 1 did indeed make the eq() redundant. Thanks SO much for the simple and quick explanation!
    1 point
  19. @all Just pushed v0.6.0 adding... Config of watches using empty strings (detect changes from empty->non-empty or vice-versa.) Hookable triggerMatch() method - so you can define your own actions when a watch triggers.
    1 point
  20. Hi, First I will like to say my thanks for the module as I am using it in my solution. I needed to crop images based on their width only in some cases, I read the thread and there was a discussion of implementing it, not sure what was the conclusion but looking at code shows me that it is not implemented. As I understand that ImageSizer's resize function can work without providing a height (or providing 0) and in this case it only considers width. Isn't it logical we remove the height condition from condition as follow, ($this->w < 1) { throw new WireException(sprintf($this->_("Width not found for thumb: %s"), $thumb)); return; } and if height is 0, then $sizer->resize($this->w, $this->h) will just work fine based on width. I have tested and it works fine but before I deploy it on production I need an opinion? Thanks
    1 point
  21. Got it - thanks to this lovely site: http://www.flamingruby.com/blog/using-hooks-to-alter-default-behavior-of-processwire/
    1 point
  22. For a recent (low-budget) ... would instead become: echo ul( li( 'Home' ) . li_foreach_page( $page->children ) ); I have collected the code I'm regularly re-using so far in a github repo: https://github.com/samuell/pwutils'>github.com/samuell/pwutils I'm sure many of you are doing things like this already, but I was just thinking that this kind of thing could be a good idea help each other improve upon. I was thinking that having a common such micro-library with all the common cases covered to speed things up, should be a productivity booster that we all can benefit from. What do you guys think? Maybe there is something like this already, that I just missed?
    1 point
  23. I thought you said you could Google the forums with a single 'P'? ...just kidding...
    1 point
  24. I use a mixture of both - oops! I have come to love concatenating though. Using a text editor with syntax highlighting like ST, I can clearly see what is a string and what is a variable, unlike variables within curly braces within a string; these get the same colour as the string.
    1 point
  25. Or you can do: $carouselMarkup = '<div id="carousel-'.$carouselId.'">'; A period in php is a concatenator, same as + is in javascript. The advantage to this approach is that it lets you apply a function to the variable, like: $carouselMarkup = '<div id="carousel-'.strtolower($carouselId).'">'; And actually you don't even need the curly braces inside double quotes if you are using a simply variable. It's only if you trying to do something like: $page->id that you need the curly braces surrounding everything. So this would work just as well: $carouselMarkup = "<div id='carousel-$carouselId'>"; So, it's good to have all these in your repertoire.
    1 point
  26. At the bottom is a link which redirects you to the original "add page" page.
    1 point
  27. So I spent the last couple of hours in creating a module which imitates the Textpattern thing. Take a look. LanguageInstantInstall.module (You have to go to Setup -> Languages and add a new language). It's not completely finished (a function to update, etc. will follow) but it does what it has to do What do you think? / nico
    1 point
  28. I'm actually glad that ProcessWire has a lot of this type of safety features. This particular one has saved me many times. Sometimes I'm very bull headed about things. Even with a warning I would have deleted a template (because of course I know what I'm doing). Whenever I get that error, I have to stop and think "Oh yeah, I forgot about that" and then to proceed to delete the template where it won't affect what I have spent hours working on. I can't speak for everyone, but sometimes I think I'm smarter than I am. The safety feature makes me smile because I know that ProcessWire is a development platform that protects me from myself. Maybe there could be an option to turn off some of these safety features for anyone else. I just hope that one doesn't change anytime soon. As stated earlier, some of these suggestions have merit.
    1 point
  29. What a coincidence, I was reading about those earlier today. Anyway, it's already been discussed here: http://processwire.com/talk/topic/2516-in-page-editing-createjs-createphp/ However, I would like to present you with PW's version of inline editing so far: Fredi. You can read more about it here: http://modules.processwire.com/modules/fredi/ In my personal opinion, Fredi will do the trick. My only concern is that it's still in beta (although I don't have the slightest idea why).
    1 point
  30. I'm not exactly sure how those retina clients are testing for the existence of the @2x version, but if it's doing it by seeing if the request results in a 404 or not (which is what I'm assuming), then you should be able to accomplish this with an Apache rewrite rule in your .htaccess file: RewriteRule ^(site/assets/files/[0-9]+/.+)@(2x\.[a-z]+)$ $1_$2 That would convert a request for /site/assets/files/123/filename@2x.jpg to /site/assets/files/filename_2x.jpg
    1 point
  31. Actually, I believe it should be 'name' rather than 'title: $images = $page->images->sort("name"); //OR $images = $page->images->find('sort=name'); //OR, by the way, sort descending by name $images = $page->images->find('sort=-name'); //OR, by the way, sort descending by name $images = $page->images->sort("-name"); Tested Btw, you can also sort by other properties, including description, height, width, size (see to be different from "filesize"?), etc. See a list here
    1 point
  32. Does all folder in assets have the correct permissions ?
    1 point
  33. i'm not quite sure if i understand right where you are heading for. however, if you have selected "checkboxes" under "input field type" for a page field, than the field returns an array. you'll need to foreach loop it in order to get the value of each title: <?php foreach($page->myRepeater as $repeaterItem): ?> <h1><?php echo "{$repeaterItem->title}"; ?></h1> <?php endforeach; ?> but why do you have grouped several page fields in a repeater?
    1 point
  34. Hey, thanks for the welcome. Now I get it. $page->rootParent by itself outputs an ID and therefor you can check if a page is the current one. Rather trivial, but I really didn’t see it. Thanks.
    1 point
  35. I use this excellent golden module by apeisa master: http://modules.processwire.com/modules/process-redirects/
    1 point
  36. The URL name ($page->name) has to be unique for all sibling pages (i.e. pages having the same parent). I don't usually bother with checking unless ProcessWire throws an error about it during the import. If it looks like there are going to be duplicates, then here's how you'd ensure uniqueness by adding a number to the end of the URL name and keep incrementing it until it's unique: Replace this: $skyscraper->name = $building; $skyscraper->save(); With this (overly verbose for explanation purposes): <?php // just to turn on the forum syntax highlighting // Converts "Sears Tower" to "sears-tower" when setting the name $skyscraper->name = $building; // Retrieve the URL name, which should be "sears-tower" $name = $skyscraper->name; // a counter incremented each time a duplicate is found $n = 0; // find the first non-duplicate name while(count($parent->children("name=$name")) > 0) { $n++; $name = $skyscraper->name . $n; // i.e. sears-tower1, sears-tower2, etc. } // set the page's name to be one we know is unique, i.e. sears-tower1 $skyscraper->name = $name; // now when ProcessWire checks uniqueness before saving, it won't throw an error. $skyscraper->save();
    1 point
×
×
  • Create New...