Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/21/2015 in all areas

  1. New year, new site online http://schutzbelueftung.de/ This time industry client, they build ventilation systems for diggers, earth movers and stuff like that. Pretty interesting. English version is in the works, should be ready by march. This is the second page featering my pagetable extended module, with which the client can easily build an individual layout out of predefined layout elements. That means: Everything on the site is filled by the client, all images and text. One special thing is the database of their installations: http://schutzbelueftung.de/aufbaubeispiele/ Here you can filter by company, type field of application. This is done by ajax in the background, so easy to build with the PW selectors <3
    8 points
  2. since everyone is trying to make themes based on their own wishes and needs, I tried to have a view from our clients: what do they really need? how often? what should they see and what not...? so I ended up with a really clean theme. the trash page will not be shown in the page tree. I'll move it in the right bottom corner. some footer informations are not necessary to be visible all the time (eg. pw version, copyright). I want to hide them behind a button. I often see people looking for a "back button" because they don't want to use the browser back button (don't know why - maybe just my view?). some ideas for other features (like custom colors)? let me know what you think. thanks
    6 points
  3. -------------------------------------------------------------------------------------------------------------------------------- for PW 3.0+ please follow this link! -------------------------------------------------------------------------------------------------------------------------------- Croppable Image Module for PW >= 2.5.11 and PW <= 2.7.3 Version 0.8.3 alpha Hey, today I can announce an early (alpha) release of CroppableImage, what was forked from Anttis Thumbnails module. Until now there was a lot of work done by owzim, Martijn Geerts and me. We have solved the issues regarding the list from here: The modules are bundled together so that you only can and have to use FieldtypeCroppableImage for install, uninstall & configure. It uses new naming scheme that was introduced with PW 2.5.0 that supports suffixes. The complete image rendering is delegated to the core ImageSizer, or to any optional hooked in rendering engine. Template-settings are now fully supported, including removing variations when settings have changed. It fully respects settings for upscaling. If upscaling is set to false, you cannot select rectangles smaller than the crop setting. We implemented these enhancements: The GridView now is very nice and compact, and also benefits from the lately introduced setting for $config->adminThumbOptions. Permanent storage of the crop coordinates, quality and sharpening settings are now implemented native. No need to use PiM for this anymore. The usage/display of the Quality and Sharpening DropDown-Selects can be globally disabled/allowed in the modules Configpage. (additionally to that a setting on a 'per field base' is planned.) And the most wanted feature by the community: It gives back a pageimage and not the URL-string. This way you can use it like this: // get the first image instance of crop setting 'portrait' $image = $page->images->first()->getCrop('portrait'); You can further use every pageimage property like 'url', 'description', 'width' & 'height' with it: // get the first image instance of crop setting 'portrait' $image = $page->images->first()->getCrop('portrait'); echo "<img src='{$image->url}' alt='{$image->description}' />"; And you can proceed further image rendering with it: // get the first image instance of crop setting 'portrait' and proceed a resize with imagesizer $image = $page->images->first()->getCrop('portrait'); $thumb = $image->width(200); // or like this: $thumb = $page->images->first()->getCrop('portrait')->width(200); // and if you have installed Pia, you can use it here too: $thumb = $page->images->first()->getCrop('portrait')->crop("square=120"); The only downside with this is that when you (as the site developer) have enabled the usage of DropDown-Selects in the images editor, you do not know the values the editors have chosen for the images. As a workaround for this you can use the getCrop() method with a second param. This is a PW selector string. It can contain as many of the known pageimage options like 'quality', 'sharpening', 'cropping', etc, as you need, but none of them is required. But required is at least one setting for 'width' or 'height': $image = $page->images->first()->getCrop('portrait', "width=200"); $image = $page->images->first()->getCrop('portrait', "width=200, height=200, quality=80"); $image = $page->images->first()->getCrop('portrait', "height=400, sharpening=medium, quality=75"); . . You can get the module from GitHub: https://github.com/horst-n/CroppableImage (Better Docs are coming soon) Screenshots Related Infos A good setting in site/config.php for the AdminThumbs are: (height=>200 and scale=>0.5 !) $config->adminThumbOptions = array( 'width' => 0, 'height' => 200, 'scale' => 0.5, 'imageSizer' => array( 'upscaling' => false, 'cropping' => true, 'autoRotation' => true, 'sharpening' => 'soft', 'quality' => 90, 'suffix' => array(), ) );
    4 points
  4. Hi, Another way to do this is to use subselectors, which were introduced in Processwire 2.5. The code would then be: $pages->find("parent.id=[pagefield1.pagefield2.field=value]"); I love subselectors...
    4 points
  5. Okay, so I've actually decided to rename the module to ProcessJumplinks. I prefer it. https://github.com/mike-anthony/ProcessJumplinks Hit counter is done. Still need to work on importing from Redirects module - I'll do that tomorrow as I'm super-tired now. I don't think I'm going to make this compatible with the current stable (2.5.3). If you really want me to, please let me know. Will also work on docs soon - though my intro post covers a lot. Nice to have docs, however.
    3 points
  6. I see. Yes that's somewhat different to what WireArray does, but you're way is fine then. You can add your own method to PageArray using hook then instead of a new class. wire()->addHook("WireArray::addUnique", null, function($event){ $item = $event->arguments(0); if($item instanceof WireArray){ foreach($item as $p){ if(!$event->object->has($p)) $event->object->add($p); } } else { if(!$event->object->has($item)) $event->object->add($p); } }); $pa = new PageArray(); $pa->add($pages->find("template=basic-page")); $pa->addUnique($pages->get("/about/")->children); $content .= $pa;
    3 points
  7. @ESRCH That login code will throw error if you login 3 times with wrong credentials... I already tried to put a note in those various (dozens already and lost track of) threads that use this "exact" frontend login code, which works but has one flaw. Problem is that once the login throttle kicks in you're left with a exception error. It's not obvious and I think posting that code in the forum over and over just creates problems in the long run for everyone copy paste such code. Funny thing is that the code originally is from Ryan himself. Either Ryan should change the behaviour of the throttle code or you need to use this code instead with a try catch to catch the login throttle error: if ($user->isLoggedin()) { $session->redirect($pages->get('/')->url); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; try{ $u = $session->login($username, $password); if ($u) { if ($redirectUrl = $session->get('redirect')){ $session->remove('redirect'); $session->redirect($redirectUrl); } else { $session->redirect($pages->get('/')->url); } } else { $error = "Wrong username or password. Login failed."; } } catch(Exception $e){ $error = $e->getMessage(); } }
    3 points
  8. One last attempt to suggest using the api, then I'm gone Instead of changing your source data, you can let the API create the pages for you when needed. So for a (simplified) table like this: Bibliography Type Document Title ----------------- ---------------------- Book Interesting Book 1 Book Interesting Book 2 Magazine Fascinating Magazine 1 .... you could use the following code, which automatically creates the pages for you function getBibliographyType($name) { $template = 'bibliography-type'; $parent = $pages->get('/bibliography-types/'); static $bibliographyTypes = array(); if (isset($bibliographyTypes[$name])) { return $bibliographyTypes[$name]; } else { // Create the bibliography-type page $p = new Page(); $p->template = $template; $p->parent = $parent; $p->name = wire('sanitizer')->pageName($name); $p->title = wire('sanitizer')->text($name); $p->save(); // Save bibliography type id for future calls, avoiding calls to the database $bibliographyTypes[$name] = $p; return $p; } } $f = $page->import_file->filename; $csvDelimiter = ','; $csvEnclosure = '"'; $templateName = 'Document'; $parent = $pages->get('/documents/'); while (($data = fgetcsv($f, 0, $csvDelimiter, $csvEnclosure)) !== false) { $bibliographyType = getBibliographyType($data[0]); $title = $data[1]; $p = new Page(); $p->template = $templateName; $p->parent = $parent; $p->name = $sanitizer->pageName($title); $p->title = $sanitizer->text($title); $p->bibliography_type = $bibliographyType; $p->save(); }
    3 points
  9. Your method seems secure enough. You are after all not sending a 404, so your user already knows that the url that they originally requested exists. Another method is to use the session to store the redirect url. So in the restricted page you would do: if (!$user->isLoggedin()) { // Store requested url in the session, then redirect $session->set('redirect', $page->url); $session->redirect($pages->get('template=login')->url); } and on the login page you could have // Edit: This code is not correct as-is, please note Soma's post below including the try-catch block around the login code! <?php if ($user->isLoggedin()) { $session->redirect($pages->get('/')->url); } if ($input->post->user && $input->post->pass) { $username = $sanitizer->username($input->post->user); $password = $input->post->pass; if ($session->login($username, $password)) { if ($redirectUrl = $session->get('redirect')){ $session->remove('redirect'); $session->redirect($redirectUrl); } else { $session->redirect($pages->get('/')->url); } } else { $error = "Wrong username or password. Login failed."; } }
    3 points
  10. Check your image's fields Input Tab and tick checkbox at 'Overwrite existing files?' Since version 2.5.1
    2 points
  11. Peter, I've added a lot of custom fields to my blog-post template, so my template file for the blog post itself is going to have a lot of calls to the fields listed for the template so that I can't rely on the module to output everything I want in the way that I want. It should be totally possible, and the module has a lot of other features that make it worth my while (multiple authors, the dashboard, etc). Unless you're stripping even more off the blog than just the template output for the individual posts, I think I'd stick with using it. My 2¢!
    2 points
  12. @Peter Knight I can confirm that Kongondo's example gist works no problem. Can easily add mark up to the necessary parts of the function. In my case I've added divs to suit bootstrap. No problem. And if you wanted to create separate markup for a single post you could either do it with a separate function or with a conditional statement within the renderPosts() function.
    2 points
  13. I find it easier to manage these things in a module like this. Also you need to use a before hook, as saving the page with the new title after saving would trigger an infinite loop. See next posts <?php /** * ProcessWire 'Hello world' demonstration module * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class PutYourNameHere extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => '', 'version' => 1, 'summary' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('Pages::saveReady', $this, 'doStuffOnPage'); } public function doStuffOnPage($event) { $page = $event->arguments[0]; if($page->template->name === "blog_page" && $page->blog_categories == "Swatch"){ // Do your thing } } }
    2 points
  14. There's a really great and simple example given by ryan here that can help you understand. In your case, you should be able to do the following (not tested): $pages->addHook('saveReady', function($event) { $sanitizer = wire('sanitizer'); $pages = $event->object; $page = $event->arguments(0); if($page->template == 'blog_page' && $page->blog_categories == 'Swatch') { // You can build the string as you wish, here is an example $concatenatedName = $page->blog_date; $concatenatedName .= '-' . $page->createdUser; $concatenatedName .= '-' . $page->blog_brand; $concatenatedName .= '-' . $page->blog_name; $page->title = $concatenatedName; $page->name = $sanitizer->pageName($concatenatedName); } });
    2 points
  15. I’m not exactly sure if that’s what you want, but if you just want to generate a bunch of nested <ul>s, you should recursively travel around the page tree. Something like: function siteMap(Page $root) { $out = "<li>{$root->title}"; if ($root->hasChildren) { $out .= '<ul>'; foreach($root->children() as $child) { $out .= siteMap($child); } $out .= '</ul>'; } $out .= '</li>'; return $out; } Uuuuh… at least I think that should work. Untested It should give you the complete branch starting at whatever you plug into $root. edit: Actually. Something is bound to be wrong with this. And you need to supply the outer <ul> yourself. edit: Tested it. Fixed it because it was stupid.
    2 points
  16. Nice idea, but I would personally go for a dedicated table for this. Perhaps you could steal some ideas from teppo's ChangeLog module: http://modules.processwire.com/modules/process-changelog/
    2 points
  17. In the "Extra Allowed Content" section on the Input tab of your field's settings, add the following: span{!color} That will allow span tags so long as the color style attribute is set. You can get more details here: http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules-section-2 If you want to allow span tags no matter what attributes they have, then use this: span[*]{*}(*)
    2 points
  18. Hello, all! Sorry if this should be in another forum, but I didn't see one for general introductions, testimonials, and the like. I actually don't need help yet (the documentation and existing forum threads have already been immensely helpful), but I am just finishing up my first project using ProcessWire and felt the need to come here and say thanks. I've been designing/developing websites for several years now, and this is by far the most intuitive CMS I've used...from both a development and end-user standpoint. I just showed my most recent client the backend a couple of days ago and he was amazed at how easy it was for him to update content. So, thank you!
    2 points
  19. Welcome chadamas, I've been using PW since late 2011, and I don't think about CMS's anymore. I suspect you will never look back.
    2 points
  20. Haha, sorry about that. I knew that title was misleading, but used it anyway! Wordpress more than anything else, but I've tried several over the years. Drupal and Joomla (of course), CMS Made Simple, Textpattern, a couple of flat-file systems...for two projects I even built a basic CMS on top of forum software (SMF and MyBB). I think my search might be over, though. Thank you all for the warm welcome!
    2 points
  21. Inputfield Page Source Display a string with the rendered output of the Page (per it's Template) in an Inputfield. The markup could be copied with a button click (flash enabled browsers) and/or copied manually from the Inputfield. The rendered output is a runtime only value which is not stored in the database. Potential Use Provide an easy way for editors to copy the sourcecode of the page for the use in newsletter services and such. Note ! This Inputfield should not be used in the page template directly. (could give some “funky” results ) Download on GitHub
    1 point
  22. Hi Folks, today we will learn how to set up a simple jquery plugin called calendario and fill events trough our admin backend. || ATTENTION || Modern Browser needed First of all, we need the jquery plugin. Grab your copy here: http://tympanus.net/...alendar-plugin/ Now create a new template file, lets call the file calendar.php In the next step we have to include all the needed files from the .zip package. You need the following .css files: calendar.css custom_2.css demo.css Just include them in the <head> </head> of your template file. Feel free to merge them together, so you could save some http connects. Now we need to include the needed javascript. Make sure you have included the latest jQuery library. Include the jquery.calendario.js and the modernizr.custom.63321.js right into the bottom of your template file. Save the calendar.php Now we will set up Processwire where the magic wil happen. We just need one new template. Create a new template called calendar. Assign the field headline to our template. Allow children to just use this template. Hit the save button. Now create a new Page as child of home and call it Calendar. Assign our calendar template to this page. Almost ready. Now we have to do some little scripting in our template file calendar.php Add this html markup to our calendar.php <div class="custom-calendar-wrap"> <div id="custom-inner" class="custom-inner"> <div class="custom-header clearfix"> <nav> <span id="custom-prev" class="custom-prev"></span> <span id="custom-next" class="custom-next"></span> </nav> <h2 id="custom-month" class="custom-month"></h2> <h3 id="custom-year" class="custom-year"></h3> </div> <div id="calendar" class="fc-calendar-container"></div> </div> </div> Now we have to call the javascript function, to get the calendar running. Just put this snippet right under the included jquery.calendario.js <script type="text/javascript" $(function() { var transEndEventNames = { 'WebkitTransition' : 'webkitTransitionend', 'MozTransition' : 'transitionend', 'OTransition' : 'oTransitionend', 'msTransition' : 'MSTransitionend', 'transition' : 'transitionend' }, transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], $wrapper = $( '#custom-inner' ), $calendar = $( '#calendar' ), cal = $calendar.calendario( { onDayClick : function( $el, $contentEl, dateProperties ) { if( $contentEl.length > 0 ) { showEvents( $contentEl, dateProperties ); } }, caldata : { <?= getEvents(); ?> // this is our function to grab our events }, displayWeekAbbr : false } ), $month = $( '#custom-month' ).html( cal.getMonthName() ), $year = $( '#custom-year' ).html( cal.getYear() ); $( '#custom-next' ).on( 'click', function() { cal.gotoNextMonth( updateMonthYear ); } ); $( '#custom-today' ).on( 'click', function() { cal.gotoNow( updateMonthYear ); } ); $( '#custom-prev' ).on( 'click', function() { cal.gotoPreviousMonth( updateMonthYear ); } ); function updateMonthYear() { $month.html( cal.getMonthName() ); $year.html( cal.getYear() ); } // just an example.. function showEvents( $contentEl, dateProperties ) { hideEvents(); var $events = $( '<div id="custom-content-reveal" class="custom-content-reveal"><h4>Termine am ' + dateProperties.day + '. ' + dateProperties.monthname + ' ' + dateProperties.year + '</h4></div>' ), $close = $( '<span class="custom-content-close"></span>' ).on( 'click', hideEvents ); $events.append( $contentEl.html() , $close ).insertAfter( $wrapper ); setTimeout( function() { $events.css( 'top', '0%' ); }, 25 ); } function hideEvents() { var $events = $( '#custom-content-reveal' ); if( $events.length > 0 ) { $events.css( 'top', '100%' ); Modernizr.csstransitions ? $events.on( transEndEventName, function() { $( this ).remove(); } ) : $events.remove(); } } }); </script> We are almost finished, but we are missing some very essential, have a look to our javascript. We are calling a function named getEvents() This function will grab our events and fire it right to our calendar. So here is the code: function getEvents() { $events = wire('pages')->get("/calendar/")->children(); foreach ($events as $event) { echo "'$event->title' : '<span>$event->headline</span> ',"; } } Put this snippet above the javascript includes. We will now create our first entry. Go back to the PW admin backend and create a Child of Calendar. Title and name need the Date on which the event has to be displayed. You have to form a date in this format: mm-dd-yyyy e.g. 12-27-2012. The headline field is our Event description. Hit the save button, go to your site and enjoy your event calendar. With a little coding you could extend the calendar to let it look like mine attached as screenshot. Hope this was useful to somebody. Cheerio.
    1 point
  23. 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!
    1 point
  24. 2.5.3 is the stable version, so this should be included even there.
    1 point
  25. What I do often is taking the hooked method name and put before or after before that name. This way I don't have to think about a name (laziness) and I can see when or if the method derived from a hook. In this case I would have chosen afterSaveReady.
    1 point
  26. You should maybe echo something, just to check whether the function gets called at all. Also a dumb question, but have you installed the module that you are developing?
    1 point
  27. This is fantastic Martijn, thanks so much for creating it. Just set it up for exactly the purpose you mention - creating an html email based on content coming from PW. Well done!
    1 point
  28. Okay, should be better now. Thx you both!
    1 point
  29. Seems really fast here. I'll take a longer look later, but looks/feels really nice so far. Great work as always!
    1 point
  30. @everfree.. did you see my version of this - might be similar.. (yours looks a lot more definitive..) my version is super simple, just enables a feature that as Soma pointed out is already in the core; and then using some jQuery, enables the editing of pages in other types of page selects like autocomplete, page list select etc.. https://processwire.com/talk/topic/8477-adminpageselecteditlinks-module-for-enabling-edit-links-on-multipage-selects/?p=82020
    1 point
  31. Oh, OK, in over my head then Thanks for the reply anyway!
    1 point
  32. after years working on PW it's always a bit difficult get in mind all the new stuff inside new versions, but it's a pleasure of course
    1 point
  33. New additions arrived in April 2014 https://processwire.com/talk/topic/3768-processwire-dev-branch/?p=58722 (grouping) https://processwire.com/talk/topic/3768-processwire-dev-branch/?p=64049 (or-groups and sub-selectors) And are now documented here: http://processwire.com/api/selectors/ (but still missing grouping) OR-groups: matching one group of selectors or another Sub-selectors: selectors within selectors
    1 point
  34. Maybe you need to read this....http://processwire.com/api/arrays/page/. There is a sort function there if that is at all useful.
    1 point
  35. Something like this. Only 3 FieldSetTabOpen. For Category A we just rename 'Content' to something else in the template blog-post advanced settings. Category A Category B Category C Category D
    1 point
  36. Look at my selector, my selector is amazing ( ): $favorites = $user->favorites->find("sort=title, private=0, start=".$start.", limit=".$limit); Favorites is Page field with settings: Multiple pages (PageArray). Private is an checkbox on every page which are listed on favorites. My test user has two(2) favorite pages. One public and one private. And it works great! Thanks bye! Wait.. I had a problem with this code: $favorites->getTotal(); I'm in the belief that this should return the amount of pages based on the selector excluding limit-selector. So the result should be one(1). But I'm getting two(2). Am I missing something or is this a bug? Even this one gives me two: $favorites = $user->favorites->find("sort=title, private=0"); echo $favorites->getTotal(); # 2 What I want is the total number of favorite pages. This of course works: $user->favorites->find('sort=title, private=0')->count(); But I would like to avoid making several finds if I could use ->getTotal. And why I can't do this? Because I'm using start/limit for pagination..
    1 point
  37. Not directly related to your question, but if your tag list is getting too long, it might be useful to activate the "Page Auto Complete" module from Core, which allows you to type in the tags that you want to add, instead of clicking through the list. I find this much easier when I have long lists of tags. Using this module, an approach that I often use for tagging is the following: Create a "tag" template with only a title field Create a "Tags" page under which you will put all the tags Create a "tags" Page field with the following options:Multiple pages allowed Parent of selectable pages: Select the "Tags" page created previously Template of selectable pages: Select the "tag" template Input field type: Select "PageAutoComplete" Check the "Allow new pages to be created from field" option Now, when entering tags, you can type in the name, if it exists already you an select it, otherwise press "Enter" and the tag will be created automatically.
    1 point
  38. Nice! The dev branch commit that adrian linked to above will make importing Page fields easier because it will allow the title string to be used instead of the page ID, but your code for creating new select options is a real bonus. Thanks!
    1 point
  39. This is a really great idea. Thanks Pete!
    1 point
  40. Might not be as comfortable as similar solutions mentioned here (the generated subdomain URLs are pretty long and clumsy to type on mobile devices), but http://localtunnel.me is another node.js thingy to forward your local dev server.
    1 point
  41. http://visualizingmodernchina.org The Visualizing Modern China web site is the online companion to an academic book by the same name. The web site presents images beyond what would have been economical to print. The pages are pregenerated. ProcessWire is on a different domain on the same server. (You will have to trust that ProcessWire is involved, because there is little evidence of it!) I used the CropImage module. Images are stored in the usual place in ProcessWire, then copied to the /images directory when a page is viewed or generated in PW.
    1 point
  42. I added two config options: 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) Field settings: Select Lists: (settings above -> first one)
    1 point
  43. Hi adrianmak, This seems to be a bug, I submitted a pull request to correct this. The problem is that when logging out, the user is changed to guest, and the language is set back to default. Interestingly, the $user variable still points to the logged out user (adrian in your case), while wire('user'), which is used by the __() translation function, points to guest. While waiting for the correction to the core, you can solve this issue by adding the following line after $session->logout(): wire('user')->language = $user->language; This will set the language back to what it was before logging out, and the correct translation will be shown.
    1 point
  44. Thanks! It would be great to have a link of the developer page to the forums member page and if the developer created some modules the reference as well. (And I miss my module author icon )
    1 point
  45. Thanks for the replies. Issue 1 is now solved - I tried playing around with some of the options for the field I'm using as my select and setting "Deference in API as" to "Single page (Page) or empty page (NullPage) when none selected" allowed me to use $page->bibliography_type->title This setting isn't mentioned in the Wiki article (whoops, it is ), and I think it would be useful to have some documentation for the Page fieldtype in the API seeing as the ProcessWire method for creating common controls like select and select multiple is a bit unorthodox (although powerful). Any advice for issue 2? I'm going to need to import a large number of pages from CSV (using the ImportPagesCSV module I expect) and if that's going to be problematic to do in conjuction with using the Page fieldtype I had better rethink how I set up the fields.
    1 point
  46. Hi Cerulean, echo "<p>{$page->bibliography_type->title}</p>"; Should do the trick. The number you were getting it the page ID of the selected item. This should give you the title. Can you attach more of your code so we can have a closer look? Maybe there's a typo somewhere?
    1 point
  47. Had to do this yesterday. But this works only on the newest dev version of processwire, because Ryan just implemented the removeTab() method. Older versions will still show the tab, but no actual form to delete something. <?php /** * ProcessWire 'Hello world' demonstration module * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class RemoveDeleteTab extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'RemoveDeleteTab', 'version' => 1, 'summary' => '…', 'singular' => true, 'autoload' => true, ); } public function init() { // Remove Settings Tab in Global settings for non superadmins $this->addHookAfter('ProcessPageEdit::buildForm', $this, "removeDeleteTab"); } public function removeDeleteTab(HookEvent $event){ // check what role the user has, if superuser do nothing if($this->user->isSuperuser()) return; $page = $event->object->getPage(); if($page->template->name === "settings"){ $form = $event->return; $fieldset = $form->find("id=ProcessPageEditDelete")->first(); $form->remove($fieldset); $event->object->removeTab("ProcessPageEditDelete"); $event->return = $form; } } }
    1 point
  48. So I spent some time fiddling around with this tonight and managed to get modal editing of page field pages working with the addition of just a few lines of code in InputfieldPage.module: InputfieldPage.module The modified file is attached. I commented the lines that I added with /* MJS 1/15/15 */ You'll want to put this file into /site/modules/ so you don't overwrite the core. Once it's up there, you should see an option in the field config settings for your page field that says 'Allow pages to be edited from field?' Check the box. This only works if you're using ASMSelect with your page field. The catch is that you have to save the page before the modal edit links become available (like when editing fields in the template editor). I think the only way around this would be to significantly re-engineer the ASMSelect inputfield with some AJAXy stuff. Not my strong suit. EDIT: There is a module for this now with more features. Use it instead! https://processwire.com/talk/topic/9857-module-page-field-edit-links/
    1 point
  49. SEO Module? What is this? 1999 again? But seriously:
    1 point
×
×
  • Create New...