-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
you know my dummy data module? showing (random) dummy data on the frontend would be as easy as that: echo modules('RockDummyData')->getDummy()->loremipsum; you would have to provide loremipsum text in the file loremipsum.txt in that case. and it does not support parameters like number of words or paragraphs but that could easily be added.
-
I'm totally happy with the console as it is now usually I'm a fan of having everything in my IDE, but I just don't use the console that way... I'm not really against changing it to a file-based system - just stating that it is not necessary for me.
-
if i understand him correctly this would still not be what he wants, because it would also find this page: title = the red island body = three dogs lived happily... i guess it should NOT find this page? i think proper searching is beyond what can accurately and easily be done with selectors. one forum member recently linked to this search service: https://www.algolia.com/product that is free until 10k records and 100k operations. google custom search could also be an option: https://developers.google.com/custom-search/ and last but not least we have the elastic search module that looks like it could match perfectly for you. i've never used it though, so it would be nice to hear some experiences from others: https://modules.processwire.com/modules/elastic-search/
-
sometimes it can be a little tricky, that's true. but usually it is not. do you know the rendernav function of the default site profile? /** * Given a group of pages, render a <ul> navigation * * This is here to demonstrate an example of a shared function and usage is completely optional. * * @param array|PageArray $items * @param int $maxDepth How many levels of navigation below current should it go? * @param string $fieldNames Any extra field names to display (separate multiple fields with a space) * @param string $class CSS class name for containing <ul> * @return string * */ function renderNav($items, $maxDepth = 0, $fieldNames = '', $class = 'nav') { // if we were given a single Page rather than a group of them, we'll pretend they // gave us a group of them (a group/array of 1) if($items instanceof Page) $items = array($items); // $out is where we store the markup we are creating in this function $out = ''; // cycle through all the items foreach($items as $item) { // markup for the list item... // if current item is the same as the page being viewed, add a "current" class to it $out .= $item->id == wire('page')->id ? "<li class='uk-active'>" : "<li>"; // markup for the link $out .= "<a href='$item->url'>$item->title</a>"; // if there are extra field names specified, render markup for each one in a <div> // having a class name the same as the field name if($fieldNames) foreach(explode(' ', $fieldNames) as $fieldName) { $value = $item->get($fieldName); if($value) $out .= " <div class='$fieldName'>$value</div>"; } // if the item has children and we're allowed to output tree navigation (maxDepth) // then call this same function again for the item's children if($item->hasChildren() && $maxDepth) { if($class == 'nav') $class = 'nav nav-tree'; $out .= renderNav($item->children, $maxDepth-1, $fieldNames, $class); } // close the list item $out .= "</li>"; } // if output was generated above, wrap it in a <ul> if($out) $out = "<ul class='$class'>$out</ul>"; // return the markup we generated above return $out; } another hint that may help: sometimes it is a lot easier to use the has() method to check wheter to append an active-class or not. for example: // create a pagearray that has all the parents of the current page + the page itself, but not the homepage (id=1) $active = $page->parents('id>1')->append($page); // loop all items foreach($menuitems as $item) { // set menuitemclass active if the current item is part of the "$active" pagearray $cls = $active->has($item) ? 'active' : ''; // echo the item echo "<li class='$cls'><a href='{$item->url}'>{$item->title}</a></li>"; } ...would make the code much more readable than a lot of if-statements. also recursive functions help a lot to make the code cleaner.
-
ok, sorry, this was what came to my eyes at first glance... does not sound as if this was the best solution (as you said) but if it works...
-
just replace your find() with a count(). find() returns an empty pagearray so the IF statement is TRUE:
-
great to hear that hm... what do you think of splitting it into 3 parts: some kind of advanced pw-installer a process module to handle multisite installations a single php file that grabs the pw-installer similar to the online installer from soma (https://github.com/somatonic/PWOnlineInstaller/blob/master/grabpw.php) hm... thinking about point 3 i'm not sure if that makes sens, but i'll leave it here for discussion. maybe it would be easier to do a git clone kongondos-great-pw-installer than creating an index.php, copying some lines of php that basically would do the same as my mentioned git clone?! what do you think? i think it would be great to make the installation process as easy as possible and on the other hand more flexible than the one we already have (yes, i know we already have site profiles and whoever likes them please continue using them ). so if the installer was able to install a list of modules it could also install point 2 of my list! i also think that this installer should be able to load standard setups of a pw-site from any url. be it a json file or some php-setup like abdus mentioned - don't know what would be better. but imagine an installer with one inputfield at the top that says: this would make it possible to save your own basic pw-setups as simple gists share setups with others (eg on the forum for debugging, similar to the concept of VMs) and all you would have to do was to put in an URL form the basic setup (that the browser should remember), choose admin username + password and database connection info. done maybe a lot of what i want is already doable by adrians module toolkit? but still i think the process of installing pw in general can be optimized. or am i just missing some great options we may already have (like wireshell for example)? or can we use composer like this?
-
exactly what i was talking about here: see also @abdus comment on top of page2 i don't like site profiles. i think they are far too unflexible mostly because of the reason kongondo said. a possibility to define modules that get installed by default would be great! maybe this module could be extended to a kind of advanced PW installation kit? for example it could also be nice to use it to install a single-site setup in a different directory on the server (in other words, having the possibility to choose wheter the new site should be installed as single or as multisite). it would also be easy to choose the core version to use for single-site setups by defining the URL like this: https://github.com/processwire/processwire/archive/3.0.36.zip or that https://github.com/ryancramerdesign/ProcessWire/archive/2.7.2.zip thanks for creating and sharing this module with us kongondo!
-
so why do you do that?
-
two options come into my mind: hook into the buildform method, get the field and modify the available options modify the dropdown via javascript (at least sorting should be very easy like this - maybe also hiding different options, depends on your usecase and setup)
-
what is the exact usecase? are you talking about changing the template after the page was saved? or are you talking about the process of adding new pages, where you want to limit + sort the selectable templates?
-
FieldtypeHandsontable: Excel-like Inputfield
bernhard replied to bernhard's topic in Modules/Plugins
2 ideas: do you need INPUT in those tables? otherwise datatables would maybe be a better fit: https://datatables.net/examples/basic_init/complex_header.html there is also my datatables module that makes it very easy to create those kind of tables. nested headers is a PRO feature of datatables: https://docs.handsontable.com/pro/1.4.0/demo-nested-headers.html have you been talking about this feature? -
FieldtypeHandsontable: Excel-like Inputfield
bernhard replied to bernhard's topic in Modules/Plugins
would be nice to hear some details about your usecase and why you need merged cells -
LoginRegister customisation
bernhard replied to The Frayed Ends of Sanity's topic in General Support
hi @The Frayed Ends of Sanity and welcome to the forum, of course you can change it! the easiest would be some css: #LoginRegisterForm > h2 { display: none; /* or */ font-size: 14px; color: red; font-weight: normal; } you can also hook into buildRegisterForm() and remove the description of the form. you can also add a markup inputfield to your form for any other HTML you need. or you can modify the markup on the client side via JS (of course that would not be the cleanest solution but sometimes easy fixes have their place...) -
hi @svsmailus and welcome to the forum! totally agree! sounds like you'll like PW if i was you i would create one simple project (personal website, or something for a friend) and then decide if you like it or not. as you can see the community here is great and always offers a lot of very useful help. pwired already linked to the hello worlds planet tutorial that i would also recommend as first step. after that i would continue to the blog-post of markup regions ( https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ ) this post shows a new and easy to understand way of the two main output strategies: direct output (like in the planets tutorial) and delayed output (that offers a lot more flexibility). edit: sorry, early submit - wrong shortcut ^^ 2 general tipps for having fun with processwire: 1) use google to search the forum: i use this approach to search content inside the forum typing "pw my search keywords" and the api by typing "api maxSize()" 2) read through all the blog posts as there are plenty of useful informations around 3) subscribe for pw weekly newsletter 4) read the forum and learn from others 5) have fun
-
in my last update from InputfieldHandsontable I inject the scripts in the init method: https://gitlab.com/baumrock/FieldtypeHandsontable/blob/master/InputfieldHandsontable.module#L26-35 field-specific CSS is loaded inside the render method with jquery like this: https://gitlab.com/baumrock/FieldtypeHandsontable/blob/master/InputfieldHandsontable.module#L61-69 +1 for a comprehensive tutorial on this thanks @abdus sentineljs looks nice!
-
I might be wrong but I think scripts get loaded when added inside the init method of the inputfield
-
FieldtypeHandsontable: Excel-like Inputfield
bernhard replied to bernhard's topic in Modules/Plugins
hmmm... good question. i guess at the current setup this would not be so easy. maybe it would be better to change how the data is stored. it would be nice to let the storage know in wich column the data lives, for example. then it would be possible to move/change a table's setup after data has already been stored. but if you find a quick solution i'm happy to accept a pr on this -
i knew it but still i would prefer a solution during install. the topic is maybe also related to wireshell... personally i don't use either of the mentioned solutions. maybe i'm just too lazy. but maybe there could be a more streamlined or standardized way of doing this... or maybe i should start using moduletoolkit. i'll have a second or third look on my next project
-
@abdus exactly, but we are getting offtopic here
-
Nice idea. And a textarea to post the names of modules to install automatically. And an URL field to post the URL to a gist with a basic setup ^^
-
FieldtypeHandsontable: Excel-like Inputfield
bernhard replied to bernhard's topic in Modules/Plugins
just pushed an update to support ajax fields and also fields inside repeaters -
Subdirectory access with built-in user management
bernhard replied to datomtom's topic in Getting Started
hi and welcome to the forum! you can bootstrap pw from your app like this: https://processwire.com/api/include/ and create a custom login like this: not sure if that's the best solution in your case - you would have to give us more informations but maybe my links already help you a bit.- 4 replies
-
- 2
-
-
- subdirectory
- user
-
(and 4 more)
Tagged with:
-
what about using less.js for development? it would be as easy as adding one line: $config->scripts->add('//cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js');