Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/24/2016 in all areas

  1. Hey guys, another website we want to share with you! http://fiberprofil.com/ This is a website that we released a few months ago for a Spanish company specialised in pultruded fiber products. There is still some content missing in the English version, so you may want to see it in the other languages. The structure of the website is quite complex, and to make it easier and less repetitive for the editors, we implemented a system of fields inheritance, so the images and information can be inherited from the parents when missing. This is useful when products share common properties with it's siblings. For every product there is the possibility to download a dynamically generated PDF. We did it with the pages2-pdf module. The logo and graphic design are also from us. Edit: see my next post for a nice detail
    7 points
  2. see also this post and my javascript solution: https://processwire.com/talk/topic/11538-pagefield-–-limit-number-of-choices/?p=107504 (and also tpr's modification) should not be too hard to adapt the code. putting everything into a modules would also be nice... it was beyond my head then and now i'm really busy, sorry
    5 points
  3. Thanks Charles! I forgot to refer an important detail. All the tables from the products are using the Table ProField. This field makes it incredibly easy for the editors to fill the tables and they are really happy with how it works in the backend. Here is an example for editing this product http://fiberprofil.com/produtos/gradil/gradil-moldado/ra-iso25m3838/ Those dropdowns are page selectors. the editor can add new properties by themselves as pages in the tree:
    4 points
  4. Before I go, here's a preview of a php console that will be released when I am back. Enter code which runs in the background via ajax, with the results displayed below. It will also support ACE editor for code highlighting and other cool things. 10/4, over and out!
    3 points
  5. just a quick reply with some comparisons here also since i have DT running on several sites now... - HTML table (a.k.a DOM) in this case the HTML is already on the page, but DataTables needs to read this HTML table and completely process it, remove it from the DOM, and render it. For any table with a lot of rows or columns, this is a bad option. - JSON Object Instead of using an HTML table, you can spit out the table info as JSON on the page somewhere in a var. Since this is the native language of DT, this is very, fast, for any table data where the total object is around 1MB or less. Still with 1MB you can have a significant amount of rows/columns/markup in your JSON. Also, if you use $cache,or ProCache, then the page load is very fast, and the DT rendering is almost instantaneous. - AJAX Ajax is almost the same as JSON object above but the JSON data lives on a separate URL, like on a service page. Still the JSON object is the full object, and even cached, this method is slower than inline JSON object because then the user is requesting 2 pages. This only makes sense when you have JSON that is probably more than 1MB and you don't want to have a large page load on the page that shows the table. So you have the page load fast, but the user has to wait a while for the server to respond to the ajax, and then for DT to process all of that JSON. Datatables only makes 1 call on the ajax to get the data, so this is why you have to weigh AJAX vs. JSON object and do testing; In all of my tests, JSON object was the fastest and i'm dealing with about 1/2MB size JSON object. - SSP This is completely different than the above, because in this case the server needs to deliver the records only as they are needed to be viewed by the user. Kongondo's example above would be a great way to get into this. It will probably be slower than JSON Object when dealing with small data sets, but for anything significant this is the best and only way to do it. I also wonder how much pages->findMany will make this work better; In the case of SSP, you are always needing to paginate from the server, i guess the findMany would allow you to make less pages->find and thus make the table appear more responsive
    3 points
  6. Alternatevely if($page->parent->numChildren(true) > 1){ // true = only visible ones } This doesn't load the children/siblings pages just count.
    3 points
  7. Hi blacksrv, Sorry you got no answers to your question. Perhaps some people (including myself) have trouble understanding your problem. Could you describe it more verbose? For example: what are internal pages? What kind of error do you get? What are you trying to achieve?
    3 points
  8. Yes I do, using this mixin for Grid (and no CSS framework at all): https://ajy.co/the-simplest-sass-flexbox-grid-ever
    3 points
  9. I wouldn't touch that if I were you. No need to. ProcessWire already has got you covered. You could probably get away with less than 10 lines of code..Something as simple as...OK...before that, let's break this down. Server-side processing: is probably easier than client-side processing. The former is easier (IMO), because PW has got you covered...Throw some PW API in your template file and you are sorted. You only need to send back data in the format requested by the client, in this case DataTables is the client. Client-side: would have been a bit more difficult (for me...because I find PHP easier than JavaScript ). However, in this particular case, we are covered. DataTables does all the heavy lifting. All we need to do is to give it data in the format and structure it has requested. Requesting data: First, the JavaScript needed to request data (i.e. the client requesting data from the server)..Straight from the DataTables example $(document).ready(function() { $('#example').DataTable( {// the ID of your HTML table "processing": true, "serverSide": true, "ajax": "scripts/server_processing.php"// this is the only thing to change RE ProcessWire(template file) } ); } ); Nothing fancy in that code. The value passed to the ajax property is the important thing here. In ProcessWire, we won't be able to access a PHP file directly like that (see forum posts about this). We have two choices. Either, post to self (./) - notice the dot, or post to an existing PW page. So... $(document).ready(function() { $('#example').DataTable( { "processing": true, "serverSide": true, "ajax": "./"// posting to self (i.e. the current page) //"ajax": "/ajax-handler/"// posting to a ProcessWire page titled Ajax Handler that lives off the root } ); } ); Process ajax request: In the template file of the 'page' or the 'ajax-handler' page, depending on the value set to 'ajax' in the JS above, you will have code like so, ready to receive ajax requests..@see if($config->ajax) { // here we are listening to ajax requests sent to this page /* 1. listen (could be POST or GET. in the DataTables example, it is using GET 2. Check and sanitize required parameters 3. Kosher? Send back data in the format requested, i.e. JSON. Otherwise, ignore, show error or tell them to take a hike */ } // output HTML as usual => e.g. @see the HTML tab in the DataTables SSP example OK, the fun part. Fire-up Firebug and go to the 'Console' Tab. Visit the DataTables SSP page and watch the Console. Have a look at: Params tab: DataTables has sent a long request. Most of the stuff we will not need. The key here is to match the parameters to their corresponding ProcessWire terms, i.e. limit, sort and start. That's all we need. This is basically pagination. So, let's match stuff we need for pagination... DT => PW start => start length => limit sort // @note: index-based naming, where 0=first DataTables table column. // In this case, the value is 5 (i.e. the last column in the SSP example = salary) order[0][column] 5 => sort (sort will correspond to whatever property in your selector, e.g. title, some_text_field, etc) order[0][dir] asc => sort order in ProcessWire. if asc, do nothing, if desc then sort becomes -sort So, we get our data as normal in ProcessWire. Note, this code goes within the if($config->ajax){} condition... // @note: here you sanitize inputs + could do some other logic, e.g. check if input present, etc $start = (int) $input->get->start; $limit = (int) $input->get->length; $sort = $sanitizer->name(?)// @this is your homework; how to get to the order[0][column] and order[0][dir] values. ;-) {dir here is direction, btw} $data = $pages->find("template=basic-page, start=$start, limit=$limit, sort=$sort"); if(count($data)) // { // need to send back data with some extras to DataTables // @hint: have a look at the structure of the JSON. // @continued below... } else //error message, nothing found Next, have a look at either the 'Response' or 'JSON' tabs. That is what the server has sent back. The most important thing to note is that that was originally an array on the server (built from our $data above with some extras...). Let's build this next. if($config->ajax) { // @note: this is built from the $data above /* @note: as per the JSON tab in Firebug we need to send back 4 'things' to DataTables. 1. draw (int): I thought corresponds to the page number but seems to increment: I'll let you find out 2. recordsTotal: Number of records found 3. recordsFiltered: I haven't checked what this is 4. data: The ProcessWire find results */ // to get the total number of records: $total = $data->getTotal(); $dataDT = array();// we'll send this back to DataTables as JSON $data['draw'] = $whateverDrawIs;// could be $limit = $data->getLimit(); $data['recordsTotal'] = $total; $data['recordsFiltered'] = $whateverThisMeans; // prepare values to send back that match your DataTables table headers foreach ($data as $d) { $dataDT[] = array($d->title, $d->name, $d->id, $d->parent->title, $d->template->name);// each record } // send data back to client in JSON format (@see the JSON tab in Firebug) header("Content-type: application/json"); echo json_encode($dataDT); }// end if ajax And that's it Written quickly in browser, got carried away...there could be errors, blah blah, the usual disclaimers
    3 points
  10. Just heading out the door - honest , but just wanted to say that I am definitely keen on the functionality being discussed and am keen to build it - I am also not sure if it belongs as part of Tracy, but I do like the idea of having one toolbar that can handle all my needs. As it is, I often also use horst's ALIF for the user switching functionality. I am not sure I would want a third toolbar for viewing TODOs, and posting/reviewing issues/bug tracking. I think that potentially Tracy could morph into something that is all encompassing because I think with the Panel Selector panel you have a very easy way of enabling/disabling tools quickly as needed. I am interested to hear how the discussion has progressed when I am back, that's for sure.
    2 points
  11. Great ideas, but I'm not sure Tracy Debugger is the best place to add them. Perhaps it would deserve a new module. @adrian - Have a nice journey!
    2 points
  12. Yeah, I fixed that a while back - Tracy is now at 1.7.7 Btw - thanks very much to both you and @szabesz for all your thoughts on the notes/issue tracker panel. I am packing to leave shortly, so haven't liked/responded yet, but some great ideas/discussion which I'll respond to properly when I am back in two weeks.
    2 points
  13. This - https://www.cutestrap.com/ - uses flexbox and looks interesting.
    2 points
  14. I'm not using it for global layout, but sometimes for micro positioning or e.g. places, where boxes should be of equal height. So the things which could break without affecting functionality, but rather aestetics.
    2 points
  15. Using it a lot but depends on the project, some you can get away with it (apps for modern browsers etc). Interesting that the most prominent polyfill is nearly ready for an update which may make it usable everywhere https://github.com/10up/flexibility/issues/53#issuecomment-220657562
    2 points
  16. Thanks - if you (or anyone else) get the time that would be great, but don't stress about it
    2 points
  17. I like where you are headed @szabesz - I think issue tracking displayed within the context of the page it refers to could be an excellent tool for giving and receiving feedback to/from clients. I am pretty excited about this because I have a hard time getting clients to interact with trello - maybe having this right on the website will make it more usable for them. I am going on vacation for the next two weeks starting tomorrow, but I would like to look into this when I am back. It would be great to get more thoughts from others before I start coding it, so feel free to continue the conversation while I am gone. Anyone feel like mocking up the UI so we can plan the implementation well? Back to the issue of the core Tracy master branch - that still hasn't been fixed so I have rolled the included code back to the version of the core before the problem showed up. I think that is the best compromise until it's fixed - at least this way you can get most of the improvements of the new version. Be sure to clear your browser cache if you find issues after rolling back - there were some CSS changes that caused the panels to be a bit buggy when I first rolled back. See you all in a couple of weeks.
    2 points
  18. That UI is fricken genius. I love it. Very convenient that I can like it twice now lol
    2 points
  19. +1 for the future compatibility between LivePreview and RepeaterMatrix. For me the two go together, the possibility to allow users to create longf-orm content and build pages by adding and reordering of blocks is a great combination of power and usability (in my mind). Thanks again for all the hard work Ryan!
    2 points
  20. This module adds CSV import and export functionality to Profields Table fields on both the admin and front-end. http://modules.processwire.com/modules/table-csv-import-export/ https://github.com/adrianbj/TableCsvImportExport Access to the admin import/export for non-superusers is controlled by two automatically created permissions: table-csv-import and table-csv-export Another permission (table-csv-import-overwrite) allows you to control access to the overwrite option when importing. The overwrite option is also controlled at the field level. Go to the table field's Input tab and check the new "Allow overwrite option" if you want this enabled at all for the specific field. Please consider limiting import overwrite option to trusted roles as you could do a lot of damage very quickly with the overwrite option Front-end export of a table field to CSV can be achieved with the exportCsv() method: // export as CSV if csv_export=1 is in url if($input->get->csv_export==1){ $modules->get('ProcessTableCsvExport'); // load module // delimiter, enclosure, file extension, multiple fields separator, names in first row $page->fields->tablefield->exportCsv('tab', '"', 'tsv', '|', true); } // display content of template with link to same page with appended csv_export=1 else{ include("./head.inc"); echo $page->tablefield->render(); //render table - not necessary for export - just displaying the table echo "<a href='./?csv_export=1'>Export Table as CSV</a>"; //link to initiate export include("./foot.inc"); } Front-end import can be achieved with the importCsv() method: $modules->get('TableCsvImportExport'); // load module // data, delimiter, enclosure, convert decimals, ignore first row, multiple fields separator, append or overwrite $page->fields->tablefield->importCsv($csvData, ';', '"', true, false, '|', 'append'); Please let me know if you have any problems, or suggestions for improvements. Enjoy!
    1 point
  21. Anyone else looking for a solution for bootstrap navigation? I have found this wiki but it´s not working: http://wiki.processwire.com/index.php/Bootstrap_Navbar#The_Navbar Here is my modified solution, I hope there are no bug´s. The Navbar <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Navigation ein-/ausblenden</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"><img src="#" alt="Logo"></a> </div> <div lass="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <?php include("topnav.inc"); ?> </div><!--/.nav-collapse --> </div> </nav><!-- /navbar --> The Menu content of ('topnav.inc') <?php /* Navigation for ProcessWire using the Bootstrap 3.5 markup This menu was written by Soma based on work by NetCarver and a bit thrown in by Joss | modified by David Schmidt */ function renderChildrenOf($pa, $output = '', $level = 0) { $output = ''; $level++; foreach($pa as $child) { $atoggle = ''; $class = ''; if ($child->numChildren && count($child->parents) == 1) { $class .= 'dropdown'; $atoggle .= ' class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" '; } else if($child->numChildren && $child->id != 1){ $class .= 'dropdown-menu'; } // Makes the current page and it's top level parent add an active class $class .= ($child === wire("page") || $child === wire("page")->rootParent) ? " active" : ''; $class = strlen($class) ? " class='".trim($class)."'" : ''; if ($child->numChildren && count($child->parents) >= 1) { $output .= "<li$class><a href='$child->url'$atoggle>$child->title<span class='caret'></span></a>"; } else{$output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>";} // If this child is itself a parent and not the root page, then render it's children in their own menu too... if($child->numChildren && $child->id != 1) { $output .= renderChildrenOf($child->children, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "nav navbar-nav" : 'dropdown-menu'; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page $homepage = $pages->get(1); $pa = $homepage->children; $pa = $pa->prepend($homepage); // Set the ball rolling... echo renderChildrenOf($pa); ...do something great with it. Regards David
    1 point
  22. Codeacademy ist great! Exactly the right thing for my slow brain Thanks
    1 point
  23. If someone could open a new thread, then all ideas presented could be collected in one place. Once (or if) a module is created, then another thread would be open under the Modules/Plugins category. BTW, this is a good discussion.
    1 point
  24. Yes, "corporate" is a better term. Seems like you had great time developing this site, congrats!
    1 point
  25. Nice work! I prefer more "graphical" designs though but it's not always us who decides I'm also using ProFields Table and it's really great. On this site (still VIP) I used it for GDA tables, where I also use a Page field for assigning for rice types, as many have the same GDA table. Could have saved an hour or two if I had recognized that earlier
    1 point
  26. Very nice work!
    1 point
  27. hi szabesz, of course i meant this panel to appear only for logged in users (clients). i guess it would be VERY good feeling for the client if she is working on the site and has a support or help badge on every site. something like a toggle on the right of every page. when clicking on the panel, there could be something like "ihr ansprechpartner" on this site: https://www.maletschek.at/boote/phobos-dalpol/phobos-21/ do you get what i mean? i think that would build trust and satisfaction for the client (not the website visitor). the most important thing of this panel should be a message box with a button "send comment" something like this: i meant a panel for admins/devs, where they can filter all submitted comments. an example: client comments: - comment 1, page A, url /page-a, template event - comment 2, page B, url /page-b, template guestbook - comment 3, page C, url /page-c, template event - comment 4, page A, url /page-a, template event when fixing comment 1, it would be nice to have a button "show all messages related to this page". also it would be good to see comment 3 as it is related to the same template. clients would of course not need to do anything, as processwire knows all this from the referred page i think such a feature would be great, but i'm not sure if tracydebugger would be the right place. maybe a dedicated support module would fit better? ps: i really like the idea of logging errors on the client side as stated in the link in my posting above. don't know how hard that would be, but think of a comment like "XY does not show up on this page" and you could inspect a log of the clients console like "undefined variable xy..."
    1 point
  28. Pleased to hear it! (Didn't know about false, thanks).
    1 point
  29. You are absolutly right... but it is the default behavior of siblings() to return current page. I have to specify "false" to make it not do that. I missed it. Thank you for your catch https://processwire.com/api/ref/page/siblings/ I think you gave me the way to a solution. solution: <?PHP $sibItems = $page->siblings(false); ?> And now it works as i expected
    1 point
  30. I think page->siblings() returns the current page as well (not sure why) So may have to do something like this (untested) <?php $siblings = $page->siblings()->remove($page); ?>
    1 point
  31. There is also this for dealing with the touch device dropdown scenario https://github.com/dachcom-digital/jquery-doubleTapToGo
    1 point
  32. Not yet on real projects, but I won't wait much longer. By the way, this is a great way of learning how to use flexbox http://flexboxfroggy.com/
    1 point
  33. "...too lazy to use greenshot for screenshots..." I think this is the point! If they can just type their instructions ON the page itself where it belongs to, they do not have to make a screenshot. Sure, they still need to be able to express themselves clearly (they should at least try), but this way we know which page they are referring to (or at least part of it).
    1 point
  34. ok, so here is my letter to santa claus https://usersnap.com/features/feedback-widget-bug-tracking but my clients are even too lazy to use greenshot for screenshots... so i don't know how much they would use such a tool... oh, and of course: enjoy your vacation!
    1 point
  35. I have already given up on them In my experience, only about 5-10% of them take the time to use such a tool (properly) anyway. I have a Word doc dedicated to this, with simple color coding. This is what they can/care to use. Very far from being perfect but at least something. The worst thing of using this "tool" is that my manual maintenance work is needed to keep it in a usable state. Currently I'm struggling with "time", but I'm interested so I will try my best to help. I also encourage others to join in the fun Many thanks, enjoy your vacation!
    1 point
  36. One more thing to mention: personally I've really enjoyed the courses from Codecademy. Their system isn't exactly perfect, but it's still pretty awesome, and "learning by doing" has always worked better for me personally than learning from books. If you enjoy a hands-on experience, I'd suggest giving them a try. It's free and they've got an easy-to-understand PHP course for beginners On a related note I wrote a blog post about PHP templating a few years ago. It's mostly about PHP vs. Twig, but could also work as a kind of an introduction to templating in PHP.
    1 point
  37. I like the idea of turning this module into an issue tracker with debug support Jokes aside: If we could somehow list both php code TODOs and these Notes in an aggregated view, that would be great. When I cannot list all of them, those notes/todos are are kinda useless. Also, I always put my todo list in priority order, my todo items are even further organized into "categories" such as: asap, before launch, after launch, "nice to have in the future", etc... since an unorganized list is not too useful either. But the coolest thing would be to be able to indicate if a Note is only for the developer or for the client too. This way we could place Notes on the pages where they belong to, so that clients checking the site during development can instantly see what is done and what is still under construction, so they do not start reporting bugs, typos, missing elements, etc... in the first place. It could save a lot of time (fewer and shorter discussion/emails exchanged). Better yet, what if clients could also take Notes, I mean open issues belonging to that page? Ok, I stop it here, this is too much already...
    1 point
  38. In addition to this, I also recommend reading up about the very basics of Object Oriented Programming, http://www.tutorialspoint.com/php/php_object_oriented.htm at least the concepts behind it. Although in the case of ProcessWire frontend development you are not "forced" to implement anything in OOP, knowing the fundamentals helps a lot to understand the API and its usage. An often used technique in the OOP world is method chaining. You do not have to use it, but when you want to look up someone else's code, you need to how and why it works: http://www.xpertdeveloper.com/2010/09/method-chaining-in-php/ BTW I highly recommend bookmarking http://www.tutorialspoint.com/php/ You can use this method before you jump into your trial-and-error experiment: Whenever you start working on something unfamiliar, say sending emails, study some basics in pure PHP, say: http://www.tutorialspoint.com/php/php_sending_emails.htm After that, look for alternatives in the ProcessWire world: API support, module support Of course, it is recommended to use the API and/or modules whenever you can, but understanding why is so makes working with them easier. Hope this helps, good luck, and never give up!
    1 point
  39. This jQuery plugin is very nice and handle these issues: http://vadikom.github.io/smartmenus/src/demo/
    1 point
  40. Not sure if this helps, but for custom buttons i have recently made large usage of Kongondo's Runtime Markup field to create custom buttons and many other custom things (special information, tables of other pages, etc) to use on the page edit screen.
    1 point
  41. just bougth a new PI3, setup apache + pw default profile and got the following performance on the homepage on my local network via WIFI (don't know if a wired setup would be faster?! the pi3 has wifi onboard) 60 requests over 60 seconds (1 per second) 300 requests over 60 seconds (5 per second) 600 requests over 60 seconds (10 per second) PW 3.0.15 everything is really smooth only thing that takes a little time is resizing big images of some MB via GD really nice
    1 point
  42. I'm committed to support Repeater and Repeater Matrix with ProDrafts, but don't yet know on how soon it will be. Most likely it will be a little after releasing PW 3.0 as the new stable version, since Repeater Matrix requires PW3. The good thing is that both of those types (and PageTable) are based on PW pages already, and ProDrafts works with PW pages. So supporting it is more a matter of linking and delegating things in the right way, since technically we can already maintain drafts of all those types... but just yet not connected with the owning page. Btw, I'm thrilled to hear how much you like Repeater Matrix. I haven't heard from many people using it since I released it, so it's very encouraging to hear that you are getting good use out of it! I am definitely getting good use out of it here too.
    1 point
  43. I discovered this by chance and wondered why it never got answered. So here it goes: PageTable field is just holding a PageArray. You'd then use $a->remove($key) where $key can be the key or a page object. Then save the page. // remove page $item from PageTable $page->pagetablefield->remove($item); $page->save();
    1 point
  44. Some improvements in the JS: $(window).load(function () { var fieldName = 'tags_recipe', // add field name here limit = 5, // set limit here asmSelector = '#Inputfield_' + fieldName; $(asmSelector).on('change limitItems', function () { var obj = $(this).parent().find('.asmSelect'); $(this).find(':selected').length >= limit ? obj.attr('disabled', 1) : obj.removeAttr('disabled'); }); $(asmSelector).trigger('limitItems'); }); What would be nice is to add the "limit" in the backend to the asmSelect using a "data-limit" attribute and then let JavaScript do its part on all asmSelects which have data-limit set.
    1 point
  45. I wonder if it's better to wrap the whole hook in such a condition: if($page->template === 'basic-page') { $wire->addHookAfter(...) }
    1 point
  46. the mentioned office application is nothing else than a custom frontend - PW original backend is only used for storing the data....so no limts on this side. for the PW backend there are much options on this so you could go: 1. using Lister Pro for creating dashboard like pages in the admin for special selectors you preselect or let the user select... 2. using AdminCustomPages module to simply have the option to work with a "normal" page template in the backend and don't have to code a Process module 3. other options that work but i don't know now....since i've learned that in PW there is always a another way... take a look at existing modules if you wanna learn something about the backend - you could take a look at: - Soma's imagemanager - Code examples from LostKobraKai about using datatable module on own admin pages - renobird's example of a simple process module for admin pages search the forum regards mr-fan
    1 point
  47. You want to display pdf files as pages in frontend? Go here: Create a template file 'showpdf.php' <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="' . basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); Create field 'pdf' of type file and add it to your template. Create a page using the template 'showpdf.php' Add pdf to page field 'pdf'. Done. To get save option instead of display use 'attachment' instead of 'inline' like header('Content-Disposition: attachment; filename="' . basename($file).'"');
    1 point
  48. Hi! Look for Custom Editor JS Styles Set in the field configuration and enter a path for .js file. In this file you can define your custom styles like this: CKEDITOR.stylesSet.add('mystyles', [ // Block-level styles { name: 'Heading 1', element: 'h1'}, { name: 'Heading 2', element: 'h2'}, { name: 'Heading 3', element: 'h3'}, { name: 'Introduction', element: 'p', attributes: { 'class': 'introduction'} }, // Inline styles { name: 'Link button', element: 'a', attributes: { 'class': 'button' } }, { name: 'Highlight', element: 'span', attributes: { 'class': 'highlight' } }, // Object styles { name: 'Stretch', element: 'img', attributes: { 'class': 'stretch' } }, ]); Also make sure you have Styles toolbar item enabled.
    1 point
  49. Zahari, Thanks for writing up about your experience, I have quickly read your post. One thing that sometimes confuses newbies is the so-called "the ProcessWire way of doing things". You will find out that in most things, there is no such way Yes, you will get advice about different approaches to solving a problem. One thing that is stressed though (by the way) is to sanitize your input (this has nothing to do with your post above) - that, perhaps, is one (of the few?) examples of the "ProcessWire" way . What am I saying? Feel free to experiment like you've done above, look at different approaches. The approach above by Ryan is one of the approaches available. When you have time, study also the default profile's template files, then look at the Blog profile and the Skyscrapers profile as well as code by other seasoned guys in these forums. You will see different approaches there. Choose what you believe makes best sense to you and ask questions. Finally, if you haven't already done so, have a read at the below link. This gem of a thread discusses various approaches to doing template files in PW: http://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ Happy coding!
    1 point
  50. I have to admit that I like learning from videos and books. They help to get across bigger picture concepts much better than copying and pasting. They build a foundation. So when it does come time to writing code (or copying pasting it), you've got the understanding of it. The problem with copying/pasting is that it's like building without a foundation, which can be dangerous. When you've got the foundation, all the other pieces just kind of fall into place. I think this is especially true of ProcessWire. If you understand the big picture and how simple it is, the rest of it becomes simple as well. And there's no reason not to learn the foundation, because it's so darn simple. It seems like a lot of people start working with ProcessWire while thinking of it in the context of some other CMS. So there is inevitable "un-learning" that has to take place, as people are looking for complexity where there isn't. This is a recurring theme. What I think would do an even better job of establishing the foundation would be two printable PDF documents that are maximum 1-printed page each: ProcessWire in a nutshell, a cheat-sheet – Covers everything you need to know to understand a typical site profile. Pages, Fields, Templates, then $page, $pages, and PageArray. All you need to know about PHP to use ProcessWire – This one would focus on the general PHP concepts necessary to use it like a template engine with ProcessWire. Covers things like PHP tags, double-vs-single quotes, echo, if(), foreach(), and comparison vs. assignment.
    1 point
×
×
  • Create New...