Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/07/2013 in all areas

  1. i don't think there is a way to change things to accommodate your complaint; each element has is dependencies, you'll get used to it... have you looked at information architecture and database design? i always plan out on paper the structure of the site before making fields, templates etc.. oh and another pointer - make sure your data and admin structure is really stable before you write any front-end markup
    2 points
  2. Here are some API additions to the dev branch, primarily for WireArray/PageArray/etc. I've found these very handy lately, and would have on almost any project I worked on, so decided they'd add value to the core. I'll add these to the cheatsheet once 2.4 replaces 2.3, but for now, here they are. The examples here use PageArray, but note that these API additions apply to any WireArray derived type, not just PageArray. WireArray::implode() Implode all elements to a delimiter-separated string containing the given property from each item. Similar to PHP's implode() function. Usage: $string = $items->implode([$delimiter], $property, [$options]); Arguments: $delimiter - The delimiter to separate each item by (or the glue to tie them together). May be omitted if not needed $property - The property to retrieve from each item (i.e. "title"), or a function that returns the value to store. If a function/closure is provided it is given the $item (argument 1) and the $key (argument 2), and it should return the value (string) to use. [$options] - This argument is optional. When used, it's an array with modifiers to the behavior: skipEmpty: Whether empty items should be skipped (default=true) prepend: String to prepend to result. Ignored if result is blank. append: String to prepend to result. Ignored if result is blank. Examples: $items = $pages->find("template=basic-page"); // render all the titles, each separated by a <br>, for each page in $items echo $items->implode('<br>', 'title'); // render an unordered list of each item's title echo "<ul><li>"; echo $items->implode('</li><li>', 'title'); echo "</li></ul>"; // same as above, but using prepend/append options, // this ensures no list generated when $items is empty echo $items->implode('</li><li>', 'title', array( 'prepend' => '<ul><li>', 'append' => '</li></ul>' )); // same as above, but with all items now presented as links // this demonstrates use of $property as a function. note that // we are also omitting the delimiter here as well, since we don't need it echo $items->implode(function($item) { return "<li><a href='$item->url'>$item->title</a></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>')); WireArray::explode() Return a plain array of the requested property from each item. Similar to PHP's explode() function. The returned PHP array uses the same keys as the original WireArray (if that matters). Usage: $array = $items->explode($property); Arguments: $property - The name of the property (string) to have in each array element (i.e. "title"). You may also provide a function/closure here that should return the value to store. When a function/closure is used it receives the $item as the first argument and the $key (if needed) as the second. Examples: // get an array containing the 'title' of each page $array = $items->explode('title'); // get an array containing the id, url and title of each page $array = $items->explode(function($item) { return array( 'id' => $item->id, 'url' => $item->url, 'title' => $item->title ); }); WireArray::data() Store or retrieve an arbitrary/extra data value in this WireArray. This is exactly the same thing that it is jQuery. I've personally found this useful when building search engines: the search engine can store extra meta data of what was searched for as a data() property. Then any other functions receiving the WireArray/PageArray have access to this additional info. For example, the search engine portion of your site could populate an array of summary data about what was searched for, and the render/output code could render it to the user. Usage: // Setting data $items->data('key', 'value'); // Getting data $value = $items->data('key'); // Get array (indexed by key) of all data $values = $items->data(); Arguments: The above usage section explains all that's needed to know about the arguments. The only additional comments I'd make are that 'key' should always be a string, and 'value' can be anything you want it to be. Example: function findSkyscrapers() { $floors = (int) wire('input')->get->floors; $year = (int) wire('input')->get->year; $items = wire('pages')->find("template=skyscraper, floors=$floors, year=$year"); $items->data('summary', array( 'Number of floors' => $floors, 'Year constructed' => $year )); return $items; } // the render function can focus purely on output function renderSkyscrapers($items) { echo "<h2>You searched for:</h2>"; // render the summary of what was searched for foreach($items->data('summary') as $label => $value) { echo "<p>$label: $value</p>"; } echo "<h3>Skyscrapers found:</h3>"; // note use of new implode() function, though a foreach() would be just as well here echo $items->implode(function($item) { return "<p><a href='$item->url'>$item->title</a></p>"; }); } WireArray::and() WireData::and() Return a new copy of the WireArray with the given item(s) appended. Primarily as a syntax convenience for various situations. This is similar to jQuery's add() and andSelf() functions, but I've always felt "add" implied adding something to the original rather than creating a new combination, so went with "and" in this case. The term "and" is actually a reserved word in PHP, so you can't usually have a function named "and()", but through the magic of hooks, ProcessWire can. This function should reduce the instances in which you'd need to do "$a = new PageArray();" for example. Usage: // create a new WireArray with $items and $item (appended) $myItems = $items->and($item); // create a new WireArray with $items and $moreItems (appended) $myItems = $items->and($moreItems); // create a new WireArray with $items and $item (prepended) $myItems = $item->and($items); // create a new WireArray with $item and $anotherItem (appended) $myItems = $item->and($anotherItem); // create a new WireArray 4 items $family = $pappa->and($mamma)->and($brother)->and($sister); Examples: // generate breadcrumb trail that includes current page foreach($page->parents->and($page) as $item) { echo "<a href='$item->url'>$item->title</a> / "; } // check if page or its children has a featured checkbox if($page->and($page->children)->has("featured=1")) { echo "<p>Featured!</p>"; }
    1 point
  3. Just spotted a PW on Nginx installation tutorial on how-to-forge. I quite like that site - find it useful from time-to-time - so big thanks to Falko Timme for taking time to write it up. Nice
    1 point
  4. Hi I contacted bitnami to suggest adding processwire to the bitnami catalog They just contacted me that they have added processwire to their catalog as per the link below https://bitnami.com/product/processwire You can vote for processwire in their monthly contest.
    1 point
  5. Thanks Martijin, It is amazing how fast you this project develops. Bugs fixed faster then I can find them ;-) I'll double check the most updated version before I post next time.
    1 point
  6. I see ProcessWire as a system that you build things on top of, and that's the purpose of it. You don't download ProcessWire to start publishing content in 5 minutes (even if you can), but rather to build a site or application. So ProcessWire is much more of a tool to accomplish some end means, rather than the end means itself. ProcessWire and WordPress are completely different animals in this area (opposites really), and I think it helps to explain why you can't assume that WordPress and ProcessWire would be considered in the same light via the GPL. I think the GPL is flexible enough to handle both. That's not to say we might not switch to MIT in the future, just to avoid even having to talk about it. But I prefer to stick with GPL at this time. When it comes to my own commercial modules, I still consider them open source for the users that have them, and any fees paid are for access to and support of the product. The 1-year timeline applies only to support. You can continue using the products as long as you'd like.
    1 point
  7. This has nothing to do with pw and is a native feature of form selects of your browser.
    1 point
  8. Hello, I don´t know if it is posible to find pages that have a children with name, I mean, something like: $parent = $pages->find("template=opciones, child.name=tarjetas") This of course doesn´t work, but something similar? Thanks in advance, Alejandro.
    1 point
  9. Agreed, currently it takes quite a few steps to delete something. As a side effect of that, cases where our clients have deleted something "by accident" have decreased to near zero. I'd like to argue that it's actually a good thing and destructive things should never be too easy. Trashing pages isn't irreversible, that's true, but as it stands recovering content from trash isn't exactly trivial either (superusers only, unless you're using Trashman module). Another thing to note is that not all content is treated that way: users and templates, for an example, are instantly (and irreversibly) removed. Definitely not something you'd want to happen by mistake. From my point of view PW has good balance regarding this subject right now and it shouldn't be disrupted without careful consideration. If I was asked if something should be changed, personally I'd prefer restoring content not requiring superuser access, but then again, Trashman already handles that part. Still, if it was my choice, it should be baked into core system somehow. Same goes for pages, templates and fields; I feel that they should be recoverable too. Especially users, as I'm seeing more and more people adding extra data for them, thus making them less trivial to recreate. Just saying.. and sorry for taking this off-topic
    1 point
  10. There's no strictly front vs back logins. For front-end only, don't give them any of the default installed permissions, and only give him a guest role. Later on you can expand it, creating own permissions and roles ( sets of permissions ). You can work with these in your templates.
    1 point
  11. users are pages. pages already have auto-id increment
    1 point
  12. The strategy you are describing is somewhat similar to the Multisite module by Apeisa. Read the thread for more info and you'll find that Soma rewrote the module. I don't know how wise it would be to create that many sites using this strategy since you'll end up with a lot of templates and fields if the sites are all different in their approach or needs.
    1 point
  13. Part of the goal with rich text editors (and LMLs even more) is to place limitations upon the input in order to maintain quality and consistency. ProcessWire's TinyMCE and CKEditor come configured to focus purely on portable and semantic markup. Once you start introducing non-semantic things in the markup like inline styles, colors, arbitrary font sizes, etc., then your content is no longer semantic or portable. It becomes essentially anchored to your current site design (if you are even that lucky with the client). You'd likely have to go back and make edits to all those fields the next time the site is redesigned. An even bigger problem is that when you give clients the tools to do these kinds of things, they start to get creative and think of it as an art project. But they blame you 1-2 years later when their site no longer looks professional. CMS control of style in text output ensures degradation of consistency and quality of output over time. For these reasons, you usually want to keep your content management tools (and especially rich text editors) focused purely on semantics of content, and as far from style as possible. This is one reason why I think front-end inline editors are a bad practice, as they keep the focus off the semantics of the content and on the subjective aspects of how it fits the area. Let all the style aspects be handled the site designers, in your front-end CSS stylesheets that accompany the site's design. If you still want to inject style, Hanna code is not a bad way to go because it does at least introduce some separation of concerns. It still leaves the content semantic, even if the underlying Hanna code isn't. If the site is for your own use and you are okay with the compromises, then both TinyMCE and CKEditor can be configured to let you do nearly anything you want. I'm not an expert on how to configure them that way, but if you look at the demos at either site, they have "all options enabled" configurations you can see and these configuration options can be duplicated in PW. Lastly, a plain textarea field (no rich text editor) on it's own also works well for just regular HTML input. This is what I use when I do need something that lets me copy and paste HTML directly, though it's something I'd only do on a site where I'm the only admin/editor (at least for that particular field).
    1 point
  14. The export profile module is 2.3 compatible, but not when it comes to multi-language sites using the core LanguageSupport modules. That's something that's been on my to-do list for awhile. I just don't use the Profile Export module often enough, but hope to update that a little after 2.4 is released.
    1 point
  15. Fay, I noticed your last two screenshots contain a plain HTML field with raw visible HTML tags. Is that what you intended, or is this supposed to be a rich text field? I ask because it's a little unusual to edit raw HTML like that (that's what TinyMCE and CKEditor are great for, or an LML like Markdown or Textile). Always respect for editing raw HTML, but it's not something I see very often, so just wanted to make sure there's not some JS error or something blocking the rich text editor.
    1 point
  16. I quickly looked at the repo and no it's far from good or standard or how it should be or can be. There's just a site folder with modules folder inside that contains a Fieldtype module that is a separate module from another guy. I'm not sure why this module is in the directory and it also isn't installable by ModulesManager for example. I'm sorry as I mind sound patethic, but I always said that we should have clear guidlines how modules repos should be built and that there must be some quality assurance for modules posted to the official directory. This doesn't happen and makes me a little sad. (just a quick glance $pass = $this->sanitizer->text($this->input->post->pass); Just wrong to sanitize passwords...) /rant
    1 point
  17. If you like, please check out our latest project powered by Processwire: http://www.gasthaus-stuhlmacher.de/ A small website to the well known Restaurant Gasthaus Stuhlmacher in Muenster, Germany. It is one the oldest restaurants in town with a long tradition and a great historical background. Processwire is absolutely stunning! It is just unbelievable how fast and clean we are able to develop our projects. The backend is so easy to use. All of our customers are in love with it too. Especially the ones who are coming form Typo3, Drupal or Jomla! Thank you so much for all your efforts and support.
    1 point
  18. There's a closed issue related to this at GitHub; magnific popup has replaced fancybox in dev branch. This issue has also been mentioned here before. On a mobile so I can't link to related posts right now.. try Google search if forum search returns nothing useful
    1 point
  19. Hi Guys! I have been looking at PW Admin Themes for quite a while now. As most of you can appreciate, taste is a somewhat personal thing. Looking at the many themes that have been presented here in the forums and the highly positive comments ( and deservedly so ) that they recieve, I can only surmise that I have very different taste in things and am perhaps in an extreme minority here. And so the following theme being presented here will most probably have very little appeal to 99% of you. So consider this one as one for the 1% non-conformists of you over here ! This theme is 99% based on the outstanding Unify Admin Theme by Adam Spruijt. See here: http://processwire.com/talk/topic/3901-release-unify-admin-theme/ I loved the immediately apparent HTML structure of Adam's theme and decided to just add an extra stylesheet to overide a thing or two and added a few backgrounds here and removed a few backgrounds there... My criteria for an admin theme is that I can stare willingly at it the whole day, day after day, week after week. Most themes here are just way too stark and contrasty in this particular area imo and so this might help explain the color pallete I developed for this theme. Oh... by the way, I work on a Non Retina Maverickded MacBook Air 13" in Firefox and so I know it looks just fine in that No ideas about what you'll see in other environments! This is also the first time I'm putting something up using Git and GitHub. Quite clueless about all this. https://github.com/Majini/Majini-PWadmintheme I've only spent just under a day on this, so Im sure there are a few buttons and places I've missed where the styles / color pallete are not completely applied. Anyhows... hope it is of use to someone and or their clients out there. Cheers And thanks Adam!!!
    1 point
  20. I think Wanze showed me this a while back. <? if ($page->allowedusers->has($user)) { //your stuff } ?>
    1 point
  21. Made some changes to the demo files (CSS, template, readme) having to do with an unfortunate iOS7 discovery. Apple in their way has decided that we must not be allowed to affect volume via Javascript. I've not found a cure. The demo template and CSS are now set to omit audio controls if the user agent string looks like something from an iOS7 device. "On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript." This is unfortunate for web based kiosk applications where you can't expect users to know how to find the iOS volume control and you don't want them using the physical buttons. Any suggestions?
    1 point
  22. Wow guys, absolutely works now! Best team ever here! You guys have helped a lot thank you so much!
    1 point
  23. And you have to change $page to the page you want. The example that I gave above would get the page by name, buy you can get it by ID also $pages->get(1654) besides other ways using the different selectors. The only info that I have from you about that page is the template. Assuming that that's the only page using that template, this should work for you: <?php foreach($pages->get("template=bands")->band_performance->find("limit=5") as $band_performances) { edit: get() returns the first page found that matches the selectors, while find() returns an array (pageArray) with all matches for the selectors.
    1 point
  24. You can use same find method that diogo posted: $featured = $page->band_performance->find("limit=5"); Or you can use slice method to get number of results you need: $featured = $page->band_performance->slice(0,5); http://cheatsheet.processwire.com/#pagearray-wirearray
    1 point
  25. I don't want to alarm you, but suddenly you turned into Mr. Bean! Have a look in the mirror.
    1 point
  26. Hi Jeff, welcome to PW! No need for ajax, you can do it like this on your home template: $featured = $pages->get("/repeaters/page/")->repeater->find("limit=5");
    1 point
  27. I think that it has something to do with (page name) language support. Now your search form points to http://creacc.espaceproduction.com/rechercher/ but because of lang support page actually lives in lang prefixed url http://creacc.espaceproduction.com/fr/rechercher/. Now PW does redirect and thus loses the search query. You could try something like this: <form id='search_form' action='<?php echo $pages->get("/rechercher/")->url; ?>' method='get'> <input type='text' name='q' id='search_query' value='<?php echo htmlentities($input->whitelist('q'), ENT_QUOTES, 'UTF-8'); ?>' /> <button type='submit' id='search_submit'>Rechercher</button> </form>
    1 point
  28. At work I'm mostly listening to some youtube playlists.. For a "relaxed" working athmosphere my favorite yt channels are the sound you need: https://www.youtube.com/user/thesoundyouneed1 (mostly house, some hip-hop) and liquicity: https://www.youtube.com/channel/UCSXm6c-n6lsjtyjvdD0bFVw (liquid drum and bass) For "getting things done" I'm quite a big fan of... "BASS" :
    1 point
×
×
  • Create New...