Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/12/2015 in all areas

  1. MultiValue Textformatter for ProcessWire Set flexible data structures in "key = value1, value2, ..." format to use as variable groups in templates. Great for general site settings, social links, menus, etc. Converts contents of textarea field "social_links" from this: @ url ::: title ::: target Facebook = https://facebook.com/mycompany ::: Follow us on Facebook ::: _blank Linkedin = https://www.linkedin.com/mycompany ::: NULL ::: _blank Email = #contact ::: Contact to an object to be used like this: echo $page->social_links->facebook->title // result: "Follow us on Facebook" echo $page->social_links->email->title // result: "Contact" Putting it together: <ul> <?php foreach($page->social_links as $item) { ?> <li> <a href="<?php echo $item->url; ?>" target="<?php echo $item->target; ?>" title="<?php echo $item->title; ?>"> <?php // name is the original key echo $item->name; ?> </a> </li> <?php } ?> </ul> Syntax: @ header1 ::: header2 ::: header3 Key = value ::: value ::: value [ ::: ...] Another key = value ::: value [...] More info: Modules directory GitHub Feedbacks and suggestions are welcome.
    3 points
  2. The name field is technically not a field, that's why it's not there.
    3 points
  3. I tried the new bookmark system in the dev branch (2.6.17). It's great for quick access, but I have too many parents with the same name "Products" under different parents like "office/products" "home/products" etc. So I needed to change the labels for add new button on Tree view. After a little bit poking I found a solution, so I'm sharing for anyone who might need. public function init() { //hooking the event for editing list of bookmarked pages from my SiteHelper module $this->addHookAfter("ProcessPageAdd::executeNavJSON", $this, 'bookmarksEvent'); } public function bookmarksEvent(HookEvent $event) { $eventReturn = $event->return; foreach($eventReturn['list'] as $key => $item) { //if its a parent url for adding if( strpos($item['url'],'parent_id') > 0 ) { $url = str_replace('?','',$item['url']); parse_str( $url ); //get page in the bookmark $page = wire('pages')->get($parent_id); //my scheme is for a label format: parentTitle - title $newLabel = "{$page->parent->title} - $page->title"; $item['label'] = $newLabel; $eventReturn['list'][$key] = $item; } } $event->return = $eventReturn; }
    3 points
  4. $q = $sanitizer->text($input->get->q); if($q) { $input->whitelist('q', $q); $qs = explode(" ", $q); foreach($qs as $key => $q){ $qs[$key] = $sanitizer->selectorValue($q) } $selector = "title|body|interests*=" . implode("|", $gs) . ", limit=50"; if($user->isLoggedin()) $selector .= ", has_parent!=2"; $matches = $pages->find($selector); if($matches->count) { $content .= "<h2>Found $matches->count pages matching your query:</h2>"; $content .= renderNavPanel($matches); } else { $content = "<h2>Sorry, no results were found.</h2>"; } } else { $content = "<h2>Please enter a search term in the search box (upper right corner)</h2>"; }
    2 points
  5. Hi, I do know that this topic is nor really directly PW related, but yet it's about a well known CMS, releasing these days a major update, and I rarely or never saw such a step-back for a software in terms of "Backend Design and UX". Meanwhile, before even the EE v2, ExpressionEngine was great CMS, the first one I knew (back in times) Custom-Fields centric, and with a well designed AdminZone, focused on the content, and so. The EE2 Admin was designed by Veerle Peters from duoh.com and was close to perfect on some points. --- Enough introduction As a EE dev' I downloaded and installed the EE3 Beta, waiting to the wow-effect and some amazing improvements, but the reaction was more like "Is that a joke?" : *LOGIN page* *DASHBOARD* *PUBLISH* In the end, the bonus track. Responsive? Nope! Well, well, what can I say ? ... Long live ProcessWire
    2 points
  6. You won't find it in the field list - check under "Advanced", like every other template.
    2 points
  7. Thank you all for your suggestions. @horst I'm already storing sessions in the DB. Will have a look into the ini settings. Meanwhile I found and interesting article which talks about using "session_write_close();". I will do some more research and post my findings here.
    2 points
  8. The above advice was very useful to me, thank you all! Given the short turn-around time in my project schedule, I installed and configured MediaWiki, and devoted the bulk of my time on documentation and training instead of development. I found a very simple off-the-shelf skin that seems to be well-maintained, and used MediaWiki's "Common.css" page to add my own customizations. Thank you so much for the help! I'm sure the site could have been a lot leaner had I used ProcessWire, but I'm also pretty sure that I'd still be working on core functionality right now instead of delivering something they can use right away, and they need it. Thanks again!
    2 points
  9. Hi guys, Been "kicking the tyres" on some UI tweaks to the PW image fields and modal windows. Many of these are in-progress designs and to be straight, none of the designs are entirely resolved. At this stage, I thought I'd throw them up (poor choice of words!) and maybe someone can take them further or offer some fresh eyes. I'm not a developer so making these a reality is impossible for me. They're flat designs. Why? PW is an amazing experience for editors. It's just so elegant and beautifully realised (especially with Reno Theme) that often, my training sessions with clients are very brief. One area which does cause friction though has always been concerned images, image fields and image modals. Especially with the latest image modules, I think a lot of inconsistency has crept into the UI. Hopefully these designs can help improve things a bit. A tiny part of the design work is influenced by a similar idea I had for MODX but which never progressed. 1A. Current Image Modal Editor has clicked 'Add image' icon in CK editor. Issues: I believe the Upload Image button can be better placed. It's not clear to users that they have a choice of two actions (Select an Image OR Upload one) To help solve this, I thought we could: Place available images under a Choose tab Create another tab titled Upload Rename modal to just Image (from Select Image) tweak slightly the Images on page path to be less prominent The following image illustrates the result. Clicking the Upload tab would result in: In the above image I've created toggle-able accordians for Drag and Drop and Manual upload. This follows closely the UI an editor is presented with when choosing Insert Link within CK Editor. IE Link to URL, Select Page and Select File and the extra Attributes tab. So overall, it's more consistent. 1B. Alternative to above - combined Select and Drag/Drop I thought it might be worth exploring what modal would look like with no tabs and a single UI for both Selecting an image and Drag/Dropping. 1C. The Image field I then moved onto looking at the Image field in PW. So currently it looks like this (below) for a simple image field called Image Gallery. So although the current Image field works great, I wondered if there was a way to simplify it by Making the drag/drop more visual and obvious Moving the Choose Files button and removing the No file chosen text and the file types allowed Here's the result. Admittedly, this treatment adds more height to the overall field. Here's how it looks when images are uploading (slightly smaller plus icon and "drag and drop..." text. To be honest, I can't recall what other changes I made there! And here's a proposed layout for when there are multiple images. This includes image titles grid layout mouse-over for edit and delete options/buttons 2. Cropping Next thing I looked at was cropping. Native cropping introduced recently is one of my clients favourite features and time-savers and I wondered if things could be improved a little. So heres the current layout (this may have changed further recently) And here's my proposal. Changes are: Width, height and X and Y fields are moved below the image Apply and Cancel placed bottom right of the image Save Crop should be titled Apply. I think that's less confusing as in some instances there are so many Save options Save and Replace should be greyed out further In addition to this, I thought it'd be neat if we had the free-form cropping function introduced by Ryan combined with some kind of list of pre-sets (displayed on right hand side). Forgive the croptions label (Crop + Options pun - I was tired!) The benfit of this I think is that Modules such as CoppableImage and native Crop would be unified in a single UI. Presets (on right) could be a few out-of-the-box presets which come natively. Croptions houses any crop ratios defined in image modules. if CopppableImage isn't installed, they just don't display.. That's it. I wish I'd more time to work on this but it's at the stage where it's ready for some initial thoughts. Hope you guys like.
    1 point
  10. Actually there's no simple answer besides "It depends". The part being responsible for how matches are determined is: "title|body|interests~=$q" or rather "~=", which by the docs means "Contains all the words". To get other results use an other operator in the selector. Also there's no such thing as "search operators" that you can directly enter into the search field. If you want something like that, you'd need to implement that on your own by parsing them down to different selectors in your code. About the two sanitizers: These are necessary to secure you're search from potential abuse. The first one does make sure you're getting text without markup, while the second one makes sure the selector value is properly escaped (e.g. quotes and commas), so it will be correctly parsed by the $pages->find() function and won't break the selector.
    1 point
  11. Most likely you're using Firefox. Somehow firefox thinks it's a good thing to prevent developers from disabling auto-fill-in / autocomplete. https://github.com/ryancramerdesign/ProcessWire/issues/1236
    1 point
  12. When you are logged in as the SuperUser, you have to click on the actual "Bookmarks" item which will then allow you to define (configure) any bookmarks. From my experience, even after you have defined the "Bookmarks", they will not show on the SuperUser display, as shown in your image. You still have to go to the configuration area (click on Bookmarks) and then you can see anything you have defined. I have defined a multitude of bookmarks based on template access. To me it's a great enhancement.
    1 point
  13. I can't believe I've not thanked you Horst for this module. I've been using it for about a year, linked to Mandrill, a match made in heaven and no false-positive spam rejected emails. Thank you again, cheers, -Alan.
    1 point
  14. processwire is love processwire is life
    1 point
  15. @elabx, not possible. We are in one of the interests pages at this point. -- You have only two ways of passing info to the future page when pressing a url: the url itself or session. With session there is no way to create a permanent shareable page, so i would go for the url. you can do this with url segments or using a get in the url referring to the place. -- I would simulate with url segments that interests is at the same level of the tree as (do, see, etc) and link to there instead, leaving the interests pages without a template file. You could do it like this: <?php foreach ($page->interests as $i) { $place = $page->closest("template=place"); //or whatever works $url = $place->url . "/interest_" . $i->name echo "<li><a href='{$url}'>{$i->title}</a></li>"; } ?> On the template from the places pages you would have something like (rough draft): if ($input->urlSegment1) { if (!substr($input->urlSegment1,0,9) == "interest_" ) throw new Wire404Exception(); $reduced = str_replace("interest_", "", $input->urlSegment); $sanitized = $sanitizer->name($reduced); $int = $pages->get("name=$sanitized"); $pois = $pages->find("template=poi, interests=$int"); $content .= renderNav($pois); } Edit: And welcome to PW! Edit2: corrected typo
    1 point
  16. Do you replace double spaces afterwards to? Because a lot of people tend to make a space and than press enter (or Word does this and they just copy and paste it) An maybe you could add a "maxlength" option and do a "nice break" so the last word won't be cut (as explained here: http://stackoverflow.com/questions/79960/how-to-truncate-a-string-in-php-to-the-word-closest-to-a-certain-number-of-chara). This would make sense because meta tags have a length restriction I think.
    1 point
  17. In defense of MediaWiki, it seems that they are dragging their codebase kicking & screaming, laughing & giggling into the present. Their most recent release included API cleanup: "A large amount of time was spent cleaning up the API, making the output saner, and friendlier for new developers to use". They do have a minimum req. of PHP 5.3.3, so way ahead of WP . They want to switch to 5.5 minimum soon. They now use Composer for external deps. The latest beta has initial HHVM support and they are putting a lot of effort on performance improvements. Edit (to add some stuff without spamming this topic too much): they are also looking to improve the development experience in general, not only for MW core devs. So API polishing and documentation will be a long-term commitment. PHP 5.5 minimum is completely reasonable. OVH Hosting will discontinue PHP 5.3 support in September.
    1 point
  18. I think this is your limiting factor here. I have built something similar as part of a wider, integrated intranet system however if your time is short you can't beat using some pre-existing software. Nothing will beat ProcessWire if you are likely to want to introduce functionality not available in some other system as ProcessWire is one of the few platforms where you can change your mind about something or come up with crazy new ideas and it not be a problem to make larger changes, but if you're likely to only need a normal WIKI type system then you probably won't replicate all the functionality you want in just a few weeks. That said, I hate that MediaWiki seems to be the main option out there (there are others, but they all come with their own maintenance issues too) as it's a bloated piece of software (so slow and resource hungry for what it does) on an out of date codebase in my opinion. I would love to have the time and money to develop something in PW as coupled with ProCache you'd be onto a winner and have something infinitely more customisable if a lot simpler, but it would be a project that would take several months at least I would think to cover everything (well, the basics) of what something like MediaWiki can do. Not sure where my train of thought is going, but I guess if you're really tight on time, you should probably invest that in installing, skinning and getting to grips with something that already exists. If the project is longer-term overall (as in you'll be looking after this system for years), then this buys you time to develop something as a version 2 and does you a favour in a way as you'll know what the client does and doesn't use in the system you've installed so you know where to focus your efforts in a custom-built system. Hope that's of some help anyway.
    1 point
  19. I have done something like this half a year ago. I made an intranet for a company with 200 employees. There are no problems I heard of so far. It has a full text search, a searchable image repository with thousands of photos, every user has his own profile with his portrait... Most important thing was: every download of this intranet (PDF, Word, Excel, image files and so on...) is a page. I have build a small multi file importer which allows to upload many files at once, which leads to creation of the according amount of pages with these files attached. I did this to give each file more properties (think of it as an" asset management" - every file can have properties like view rights, tags, relations, descriptions, authors etc.). To assign this download pages to their parent "content pages" (the page the visitor sees in frontend view) I did use page tables very much. I think it works very good and I enjoyed it to develop and customize.
    1 point
  20. u uses title 2 time like.this title%=red, title%=crap If.u no want crap buts do.want reddish crapapples do this title%=red, title%=crap, !title~=crap
    1 point
  21. Well, I'm no pro at this and you could probably improve it, but here's my attempt which serves my current needs pretty well: /** * Creates a repeater field with associated fieldgroup, template, and page * * @param string $repeaterName The name of your repeater field * @param string $repeaterFields List of field names to add to the repeater, separated by spaces * @param string $repeaterLabel The label for your repeater * @param string $repeaterTags Tags for the repeater field * @return Returns the new Repeater field * */ public function createRepeater($repeaterName,$repeaterFields,$repeaterLabel,$repeaterTags) { $fieldsArray = explode(' ',$repeaterFields); $f = new Field(); $f->type = $this->modules->get("FieldtypeRepeater"); $f->name = $repeaterName; $f->label = $repeaterLabel; $f->tags = $repeaterTags; $f->repeaterReadyItems = 3; //Create fieldgroup $repeaterFg = new Fieldgroup(); $repeaterFg->name = "repeater_$repeaterName"; //Add fields to fieldgroup foreach($fieldsArray as $field) { $repeaterFg->append($this->fields->get($field)); } $repeaterFg->save(); //Create template $repeaterT = new Template(); $repeaterT->name = "repeater_$repeaterName"; $repeaterT->flags = 8; $repeaterT->noChildren = 1; $repeaterT->noParents = 1; $repeaterT->noGlobal = 1; $repeaterT->slashUrls = 1; $repeaterT->fieldgroup = $repeaterFg; $repeaterT->save(); //Setup page for the repeater - Very important $repeaterPage = "for-field-{$f->id}"; $f->parent_id = $this->pages->get("name=$repeaterPage")->id; $f->template_id = $repeaterT->id; $f->repeaterReadyItems = 3; //Now, add the fields directly to the repeater field foreach($fieldsArray as $field) { $f->repeaterFields = $this->fields->get($field); } $f->save(); return $f; } And here's an example of calling it: $f = $this->createRepeater("sc_promos","sc_promo_active sc_promo_code sc_promo_discount","Promotional Offer","shoppingCart"); You can then use $f to add your new repeater field to a fieldgroup/template.
    1 point
×
×
  • Create New...