Leaderboard
Popular Content
Showing content with the highest reputation on 01/19/2015 in all areas
-
I'm happy to announce that the official ProcessWire Developer Directory has been launched at http://directory.processwire.com It comprises a developer list and a map and is designed to allow anyone developing with ProcessWire to find each other. It also allows potential clients to find developers as well as illustrating how widely ProcessWire is used worldwide. The developer list displays in random order so as not to favour any one developer and is currently quite short, but it should grow nicely as you create your own profiles. The login process is linked to your ProcessWire forum account so the same details you use to login here will allow you to get started. There is a manual approval process as well as some rules so that we can ensure that the directory contains quality content and is free of spam. As a minimum, developers must have 10 posts here on the forums before they can login and post a profile, however after that there are relatively few restrictions - as long as you follow the guidelines on the Profile form and abide by the Terms and Conditions (a condition of submitting a profile) you will be fine. You may notice small icons/badges next to some developers - these are designed to recognise special contributions to the ProcessWire project and are awarded by staff as part of the approval process. Whilst checking each entry's content we cross-check against forum profiles, the modules directory and other sources to determine which badges apply to a developer. There are plans for more features over time which you can be notified about by checking the box at the end of the profile form. I look forward to seeing your profiles soon!7 points
-
The more flexible way would be to not hardcode anything, like this. <a href="<?php echo $pages->get("template=login")->url; ?>">Sign in</a>7 points
-
Thanks to everyone who has submitted profiles so far. As a special bonus, you can go to the main directory page each day tiles photos/logos behind the top button will display up to 39 random developers each day. There is some repetition now as we have less than 39 approved, but it keeps things interesting. It's just some code that loads random dev images and creates a background image using GD on a CRON job at about 5am (Eastern time? not sure what the server is set to) in case anyone was wondering.3 points
-
Hey @sarah_hue, welcome to the forums and thanks for the kind words. The recreation is forced by the optional second param of pimLoad. If you let it out or set it to false it takes the cached variation: $imagewithwatermark = $img->pimLoad('tw'[, false] )-> ... . . PS: viele Grüße in die Narrenhochburg Köln, Tätä!2 points
-
I'm not quite sure if this is worth to be a module. But I needed it... This Fieldtype creates a select list (drop down) in relation to another field (you can restrict the list by setting up certain templates and / or pages). Installation: 1. Clone the module and place FieldtypeSelectRelation in your site/modules/ directory. git clone https://github.com/justonestep/processwire-fieldtypeselectrelation.git your/path/site/modules/FieldtypeSelectRelation (or get it from the module page) 2. Login to ProcessWire admin and click Modules. 3. Click "Check for new modules". 4. Click "install" next to the new FieldtypeSelectRelation module. Usage: After installation, you'll have a new "Select" fieldtype that will allow you to define the items you'd like in the drop down depending on another field. Create a new field and assign type SelectRelation Click on the Details tab, there you find different fields to create your select list Field: required, choose another field you created before from which the select list should be populated Repeater: optional, if the field you chose is included in a repeater, select the repeater here Template(s): optional, restrict your result by setting certain template(s) Page(s): optional, restrict your result by setting certain page(s) Unique Values: optional, check this field if you want to avoid duplicate values (If you enable this, the string value will be saved instead of the ID. You will not be able to reference via ID.) Including not only visible pages: optional, include all hidden and unpublished pages and pages that user doesn't have access to view Multiple Output: optional, multiple selection (using ASMSelect) Unique Values Disabled If this field is not enabled the key is the pages_id and the value is the value from the other field. <select id="Inputfield_chosen_fruit" name="chosen_fruit"> <option value=""></option> <option selected="selected" value="1026">Strawberry</option> <option value="1030">Apple</option> <option value="1031">Banana</option> <option value="1032">Lemon</option> </select> Note: If you change the value of a field the value changes too. If you deleted a value the value now is empty and multilingualism works like a charm. Accessing the value: // single select echo $pages->get((int)$page->chosen_color)->color; // multiple select foreach ($page->chosen_color as $p) { echo $pages->get((int)$p)->color; } `chosen_fruit` and `chosen_color` are of the type SelectRelation. `title` is the page title and `color` a simple input field (TextLanguage for example). In `chosen_fruit` the selected field is `title`. And in `chosen_color` the selected field is `color`. Unique Values Enabled If this field is checked the key as well as the value are the value from the other field. <select id="Inputfield_chosen_color" name="chosen_color"> <option value=""></option> <option value="red">red</option> <option value="green">green</option> <option selected="selected" value="yellow">yellow</option> </select> If you don't check this box you might have duplicate colors (because there is more than one fruit which has a yellow color for example). BUT if you change the value of an field, your already chosen value stays the same, because there isn't a relation via ID. Access such a field like you are used to: // single select echo reset($page->chosen_color); // multiple select foreach ($page->chosen_color as $p) { echo $p; } TL;DR: I tried to save a comma separated list for duplicate values .It works until you change anything. For example, if you have two times the color yellow a key of the kind '1034,1036' may get saved. Now assume you change a basic color (the banana turns brown ), the selected value is now empty because a key like '1034,1036' doesn't exist anymore. And in the frontend you may get a wrong output.1 point
-
Well it's only been around for just over a year https://processwire.com/talk/topic/4203-sublime-text-2-snippets-for-processwire/1 point
-
Great, thank you for the explanation! I completely forgot looking up the parameters for the function.1 point
-
1 point
-
Hey I got FC working! Woohoooo With AdminCustomPages module, in my admin page scripts and styles in its settings: calendar.js: var jq111 = jQuery.noConflict(true); jq111(function() { jq111("#calendar").fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, //defaultDate: '2014-11-12', editable: true, eventLimit: true, // allow "more" link when too many events events: [ { title: 'All Day Event', start: '2014-11-01' }, { title: 'Long Event', start: '2014-11-07', end: '2014-11-10' }, { id: 999, title: 'Repeating Event', start: '2014-11-09T16:00:00' }, { id: 999, title: 'Repeating Event', start: '2014-11-16T16:00:00' }, { title: 'Conference', start: '2014-11-11', end: '2014-11-13' }, { title: 'Meeting', start: '2014-11-12T10:30:00', end: '2014-11-12T12:30:00' }, { title: 'Lunch', start: '2014-11-12T12:00:00' }, { title: 'Meeting', start: '2014-11-12T14:30:00' }, { title: 'Happy Hour', start: '2014-11-12T17:30:00' }, { title: 'Dinner', start: '2014-11-12T20:00:00' }, { title: 'Birthday Party', start: '2014-11-13T07:00:00' }, { title: 'Click for Google', url: 'http://google.com/', start: '2014-11-28' } ] }); }); It's a beautiful start, there are minor CSS fixes to be made but that's the least of my concerns.1 point
-
From what I can tell, mod_php is really less secure in some ways than FastCGI (or SuPHP, for that matter) , thought it's (partly) a question of configuration and environment: Main issue is apparently that mod_php runs as the Apache user (in Ubuntu that would typically be www-data), which means that you'll have to give this user r/w access to various files and folders on the disk. Some articles make this sound worse than it really is, though; you most definitely don't need to give it full access to all your files. Still, this can be a problem, especially in shared hosting environments. Also, unless you set up separate Apaches for each hosted site, if one of those sites has (critical) security issues, it could potentially compromise all other sites too. To answer your question: when you're in control of the whole server and can set up permissions as you wish, I don't see this as a huge problem -- or, rather, I see it as a reasonable compromise. PHP as a module happens to be extremely fast, especially compared to something like CGI. You do want to be careful about what you install and run (and how you setup permissions on your server), but on the other hand, that's common sense anyway. FastCGI needs more memory than mod_php, but provides more security too. CGI is by default both insecure and slow, but can be configured to be somewhat more secure. SuPHP is somewhere in the middle, more secure than mod_php but also slower than FastCGI or mod_php (though SuPHP memory consumption seems reasonable; this seems to be something of a problem for FastCGI). Looks like your best bet would be either FastCGI (for security) or mod_php (for speed); latter requires care when setting up your environment, while former will apparently be slower no matter what you do. Decisions, decisions (Note: I'm not an expert on any of this. I've always used mod_php for various reasons, and am pretty much used to any insecurities it brings about. Right now I'm looking into FastCGI myself, and I know that others have made PW run with it, but this isn't very high on my list to be honest.)1 point
-
What I would try (Never done this before) - Use jquerui sortable. - start drag (or something), get de index of the item in the list of pages - stop drag (or something), get the new index of the dropped item. - then from your list get the Page id's from start drag index till stop drag index and make from all id's a comma separated string. (1234,3241,6473,1001,1234) Then you need to do a post with Javascript to /processwire/page/sort/, use the following variables: sort (comma separated list of ID's) parent_id move_id (dragged page)1 point
-
1 point
-
fmgujju: just reset your password (logout and pretend you have lost your password).1 point
-
Really great this is a trigger to polish my own site up with PW first - and then add my entry Great idea&implementation Thumbs up!1 point
-
1 point
-
1 point
-
Swopping out... $page->children for $page->pagetable throws up errors Error: Exception: Method Page::pagetable does not exist or is not callable in this context I can't find reference for "$page->pagetable" anywhere in the docs/forums? **UPDATE** I got this working by using the name of the pagetable field not 'pagetable' doh!1 point
-
Indeed. Without really looking into it, the Javascript must depend on the position of the buttons. Try this to insert the buttons inside .InputfieldPageTableContainer: public function PageTableRender($event) { $return = $event->return; $from = strpos($return, "<div class='InputfieldPageTableButtons"); $to = strpos($return, "</button></span></div>", $from); $buttons = substr($return, $from, $to-$from) . "</button></span></div>"; $insertAt = strpos($return, "<table class='AdminDataTable AdminDataList'>"); $event->return = substr_replace($return, $buttons, $insertAt, 0); } Instead of this hackish string trickery, perhaps a better way to clone/move the buttons would be to use Javascript in the first place. I’m not sure how to best pull that off. Just append a script tag to $event->return?1 point
-
https://processwire.com/api/modules/multi-site-support/ I use option 1 from here on my production server, works perfectly. Just be aware that all websites that you create using this system will be tied to the same version of PW, so upgrading for one will upgrade for all. I never had any problem with this myself.1 point
-
Thanks every one for replying so quickly, this is Fantastic and thanks to teppo for warning this is getting more interested. i want to know is there a way to have one "wire" directory and run multiple websites ? like one "wire" directory on some main server and only "site" directory in website "public_html" is this possible ? Thanks1 point
-
Not going to argue that you shouldn't try renaming the wire directory (you shouldn't), so I'll just jump in to mention that what @interrobang pointed out above is very, very important. The .htaccess file, among other things, protects ProcessWire's core system. If you do end up renaming the wire directory, make sure that you also make changes to any protective rules in that particular file (and potentially elsewhere too). The important thing here is to understand that by making changes to something like the wire directory location, without fully understanding what it means and how it might affect other things, you could easily be causing new security issues where there were originally none. Just saying. "You've been warned", and so on1 point
-
1 point
-
1 point
-
Yes, it does. I have it run with nginx, so I don't care about the .htaccess Read the instructions on how to get hhvm running here: http://hhvm.com/blog/1817/fastercgi-with-hhvm You might need some tweaking and run into a lot of issues - hhvm has not been tested with ProcessWire. I also chose to let it run at port 8999 to be easily able to switch between hhvm and php5 for reasons of comparison. Your mileage may vary, but with a modern system your chances of getting it to work are better. Some stats using a fresh installation of Processwire with the site-beginner scheme ab -c10 -n500 http://pwtest.gurkendoktor.de/ php5-fpm: Concurrency Level: 10 Time taken for tests: 23.425 seconds Complete requests: 500 Failed requests: 253 (Connect: 0, Receive: 0, Length: 253, Exceptions: 0) Total transferred: 1902241 bytes HTML transferred: 1700241 bytes Requests per second: 21.34 [#/sec] (mean) hhvm: Concurrency Level: 10 Time taken for tests: 8.702 seconds Complete requests: 500 Failed requests: 232 (Connect: 0, Receive: 0, Length: 232, Exceptions: 0) Total transferred: 1900304 bytes HTML transferred: 1700304 bytes Requests per second: 57.46 [#/sec] (mean) This is in no way scientific. PHP does not use an opcode cache, which speeds up things a lot. on the other hand, hhvm gets better the "warmer" it gets (ie. the more load it gets). The nice thing is, that it still works with fcgi_cache: Concurrency Level: 10 Time taken for tests: 5.110 seconds Complete requests: 500 Failed requests: 491 (Connect: 0, Receive: 0, Length: 491, Exceptions: 0) Total transferred: 1912527 bytes HTML transferred: 1699527 bytes Requests per second: 97.85 [#/sec] (mean) Yes, there are some more "failed requests" - I blame this on ab Anyway, this is just plain ol' PHP Code. What would be interesting is to actually write a module in hack (the hhvm language) and see if this actually works. Because then you'll be able to harness hhvm's full power and experience an incredible performance boost. I'll figure this out later when there's time. More interesting it would be to fork the ProcessWire core and move it to hack. This would incredibly boost the performance, but brings other issues. But I guess this is too much of an effort, I myself wouldn't be able to do it1 point
-
Welcome to the forums! You can set it as the default in your config.php file: $config->defaultAdminTheme = 'AdminThemeReno'; User's can change between themes from their edit profile page.1 point
-
1 point
-
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
-
PW's coding style is visible in any core file. But it's the same idea whether we're talking about code, graphic design, architecture or really anything someone would create: When it comes to code, that translates mostly to not adding extra unnecessary bytes: Avoid having an opening bracket "{" on its own line. Instead, just use a single space before an opening bracket. Only closing brackets "}" should be on their own line. Avoid use spaces for indentation, just tabs. This is what tabs were made for, not spaces. Use just one tab per indentation, of course. Avoid extra spaces around parenthesis unless you think it's really necessary. For example, it's preferable to use function(a, b) not function ( a, b ) Put a space after a comma, just so the comma doesn't visually melt into one of the adjacent letters. Don't put a closing PHP tag "?>" at the end of a file. Use camelCase for most variable and function names except for when the variable resolves to a database column or ProcessWire 'name', then use lowercase and underscores. Use camelCase for class names except always have the first character be uppercase, i.e 'CamelCase' (there may be a more specific term for this). Put a space before and after the concatenation operator, as it's small and disappears (or becomes a sentence period) too easily. For example use "a . b" and not "a.b". And of course, comment as much as possible. Comments are bytes that are always appreciated for communication. Outside of internal comments within the body of functions/methods, PHPdoc style is the standard we prefer. Honestly the biggest one for me is just the opening bracket thing. I can't follow code that contains opening brackets on their own line. It makes the opens and closes so visually similar that I can't can't easily tell them apart. It could be that my eyes aren't great, but at least for me that coding style creates legibility problems. I have to "fix" code before I can read it. With the style I'm using, when I see a bracket on a line (before I see the nuances of the serifs), at least I know it is always closing something.1 point
-
oop easier than no.oop. how abowt real objet likes coffey maker. $m=new coffeymaker(): $m->fillcoffey('frenchyroast'); $m->fillwater('750ml'); $coffey=$m->brew(); $me=new WillyC(); $me->drink($coffey); $t=new toilet(); $me->pee($t); and that.all there,^b^b^b oops $t->flush(); and thatall there is now.youknow oop(ee)1 point