Jump to content

All Activity

This stream auto-updates     

  1. Yesterday
  2. BillH


    For a basic approach: $breadcrumbs = $page->title; foreach($page->parents() as $parent) { $breadcrumbs = "<a href='{$parent->url}'>{$parent->title}</a> / " . $breadcrumbs; }
  3. Zeka


    @fruid I'm using this function for /** * Render breadcrumb navigation * */ function renderBreadcrumbs(PageArray $items, Array $options = []) { $page = wire('page'); if (!count($items)) return ''; $index = 1; $defaults = array( 'class' => 'breadcrumbs__list', // class for the <ul> 'a_class' => 'breadcrumbs__link', // class for a item 'a_active_class' => 'breadcrumbs__link--active', // class for a active item 'liclass' => 'breadcrumbs__item', // class for li item 'active' => 'breadcrumbs__item--active', // class for active item ); $options = array_merge($defaults); $out = "<ul class='$options[class]' itemscope itemtype='http://schema.org/BreadcrumbList'>"; foreach ($items as $item) { $class = $item->id == $page->id ? " class='$options[liclass]" . ' ' . "$options[active]'" : " class='$options[liclass]'"; $a_class = $item->id == $page->id ? " class='$options[a_class]" . ' ' . "$options[a_active_class]'" : " class='$options[a_class]'"; $title = $item("bradcrumbs_title|title"); $url = $item->url; $out .= "<li $class itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'><a $a_class href='$url' itemprop='item'><span itemprop='name'>$title</span><meta itemprop='position' content='$index' /></a>"; $out .= "</li>"; $index++; } $out .= "</ul>"; return $out; } Then in template file $breadcrumbs = renderBreadcrumbs(page('parents')->not('template=categories|products')->add(page()));
  4. How to generate breacrumbs? I have this in my template if(page()->parent->id > $home->id) echo ukBreadcrumb(page(), [ 'class' => 'uk-visible@m breadcrumbs']); which is default with the profile. I want to add the current page and it looks like I need to re-build it from scratch to do so. However, the documentation is quite poor regarding breadcrumbs. no clue what is meant by… $processPageList->setupBreadcrumbs(); $processPageEdit->setupBreadcrumbs(); $processPageAdd->setupBreadcrumbs(); … there's no explanation and no examples but it's pretty much all I could find on this topic Thanks for help!
  5. @teppo Dude, this was in my head when it worked. Thank you!!!
  6. Hi @teppo First I have to say: WOW! I took another look at your module because I got again frustrated with my setup and I wanted to build something on my own. Luckily I remembered your module and came back to the docs before developing something on my own 🙂 Thx for the docs, they are great! Some suggestions: It would be great to have < prev | next > links on each page at the bottom. I almost missed all the other great pages when reaching the bottom of https://wireframe-framework.com/docs/ (the menu is not visible in the sidebar on such long pages) It would be great to have a simple hello-world walkthrough for setting up a custom wireframe template (instead of providing a full-blown site profile). It's always easier to understand something if you start from scratch than finding your way around several files not knowing which pieces came before and after another. And then something more advanced and more important: I think it would be great to get a little more (or different) control over where Wireframe does look for files. I read about the config settings, but IMHO they are a little limiting. As far as I understood one can define a path for every type that Wireframe is based on (views, controllers, components, etc). And as far as I understood it is possible for components to define custom view files via Wireframe::component('foo')::setView('bar'); Is that correct? The problem with that approach is that it is not possible to load components from outside of the wireframe folder structure. That's a quite big deal, because if that were possible, we could ship custom components/views/partials (I'm planning on working on styles using RockLESS) directly within our modules and that would just be awesome! Take this example: module RockSearch lives in /site/modules/RockSearch |- Wireframe | |- js | | '- search.js | |- less | | '- searchform.less | '- partials | '- searchform.php '- RockSearch.module.php What if we had a new Wireframe type called "package"? This could be included in any Wireframe layout like this: <?php $css = RockLESS::css([ $packages->RockSearch->less->searchform.less, $packages->MyGreatModule->less->style1.less, ]); ?> <html> <head> <link rel="stylesheet" href="<?= $css ?>"> <?= $packages->RockSEO->partials->meta() ?> </head> <body> <section><?= $partials->header() ?></section> <section><?= $packages->RockSearch->partials->searchform() ?></section> ... </body> </html> Finally we'd only need to tell Wireframe about the packages: $config->wireframe = [ ... 'packages' => [ 'RockSearch' => $config->paths->siteModules."RockSearch", 'RockSEO' => $config->paths->siteModules."RockSEO", ], ]; // or something like this Wireframe::addPackage($config->paths->siteModules."RockSearch"); This would finally bring some standards to the ProcessWire frontend which would make a huge difference regarding reusability! If we found a bug in RockSearch, we could directly fix it in the modules partials which would make it instantly available to all projects using it after a simple modules update! Thx for your great work again! What do you think? PS: Defining different views/partials for RockSearch should also be possible making it easy to support different frameworks or framework versions, eg $packages->RockSearch->partials->uikit3() or ->bootstrap4() etc. PPS: I didn't quite get where the differences between using controllers+views or components+views/partials are?!
  7. I would go this way, without invoking ready.php or other resources: <div class="grid"> <?php foreach($page->grid_ext as $item): ?> <div id="pteg_<?= $item->id ?>"> <?php // specify the template viewfilename like this, if it is a single viewfile: $viewFilename = $wire('config')->paths->templates . 'blocks/myblockviewfile.php'; // or if you have different files get them from template properties: $viewFilename = $item->template->altFilename ? $item->template->altFilename : $item->template->name; $viewFilename = $wire('config')->paths->templates . 'blocks/' . $viewFilename . '.' . $wire('config')->templateExtension; // check if viewfile is available if(!is_readable($viewFilename)) { echo logSectionError('Missing Template-View-File!', '<strong>' . basename($viewFilename) . '</strong>'); continue; } // now pack a bag with all needed variables for the block render template file: $viewBag = []; $viewBag['item'] = $item; $viewBag['page'] = $item; // if you use the $page var in your template file, pass here the current item-page to it ! $viewBag['pages'] = $pages; // optionally if you need other vars, add them here $viewBag['config'] = $config; // " // and render the block echo "\n " . wireRenderFile($viewFilename, $viewBag); ?> </div> <?php endforeach; ?> </div> https://processwire.com/api/ref/functions/wire-render-file/
  8. I'm totally agree with your opinion. Even it's beta.. We could start to implement it, use it, find bugs, help to fix it etc. We could start our projects and show something to our clients, get familiar with the system.
  9. That gives me the expected result (just like the output of a field with the default `datetime` Fieldtype). echo $return->getUnformatted('programm_date_advanced') // e.g. `1562233140`
  10. @kongondo, I am aware that this doesn't help, but I was wondering just how close are we to an announcement? The current COVID situation just brought so many extra ecommerce projects to life, a beta / alpha release could pick up great momentum with the PW community, I'm sure.
  11. I'm not really familiar with this module, but it looks like the formatted output will indeed be a single date. Have you tried $result->getUnformatted('programm_date_advanced') to get the unformatted version?
  12. This old thread should get you started. However, I am not sure how you would be able to get the current value of the start time to compare against.
  13. Check the "Advanced" tab in the Template settings. There you'll find an option to make the createdUser modifiable:
  14. Hi everyone, I'm trying to work on automatically creating a page when a user signs up. Thing is the page created will be automatically assigned to them as the creator. How do I assign it to a different user? Been testing out various codes but it still wont work. Any idea? $memberpage = wire('pages')->add("blank", "/member/", ['title' => $user->name, 'name' => $user->name ]); $memberpage->set("createdUser", wire("users")->get("bobot")); $memberpage->save(); bobot is my user where I would like to set the page creator as. Sorry. Totally new on this. Thank in advance.
  15. Hey @michelangelo! just a quick heads-up: the Modules area of the forum is reserved for third party module support threads, one per module. This topic is about a core feature, so I'm moving it to General Support instead.
  16. Last week
  17. I think that is actually the approach I've used in the past as well!
  18. thanks! I figured out my own approach, works as well… $cols = $page->table->getColumns(); foreach($cols[10]['options'] as $opts => $value) { $out .= '<option value="'.$value.'">'.$value.'</option>'; }
  19. The API for this is kinda ugly but it works. Where "3" is the number (in order) of the subfield / column you are looking for.
  20. You have just said a whole load of things I don't understand since my 20 years that I started developing. This is why I choose ProcessWire, I dont understand it now, I know its more than likely covered in the future.
  21. Inside the ProFields Table I have one column of type "select" for which I entered several options to choose from. How can I return these options? I mean loop through them to build my markup.
  22. Relative to ProcessWire 3.0.161, version 3.0.162 contains 24 commits that continue upgrades/improvements to selector operators, fix various minor issues, add new API convenience methods, improve documentation, optimize and refactor various portions of code and DB queries, and much more. For full details, see the dev branch commit log as well as last week’s post. Next week I hope to finally finish up a new version of ProCache and continue with some additional core to-do items. By early August my hope is that we’ll have the next master branch version ready. Also added this week is a new dedicated documentation page on this site that covers all of ProcessWire’s selector operators, including all the newly added ones here: selector operators. Thanks for reading and have a great weekend!
  23. function customPageSaver(HookEvent $hook) { $page = $hook->arguments(0); if ($page->template->name == 'event_instance' && $page->id !== 0) { $page->setOutputFormatting(false); $page->name = wire()->sanitizer->pageName(wireDate('Y-m-d', $page->date)); if ($page->time_end < $page->time_start) { $hook->message('End AFTER starting.'); $page->time_end = ''; } } } $this->addHookAfter('Pages::saveReady(template=event_instance)', null, 'customPageSaver'); -- site/ready.php Can I set the $page->time_end to its previous value, rather than ''? I think I've done that before but forget how.
  24. I don't understand the question, I am afraid. Please explain.
  25. First, thanks for your effort making this extension! Environment: DatetimeAdvanced v1.0.4, PW 3.0.148, PHP 7.4.6, mysql 5.7., Timezone ist set. While accessing subfields as selectors within a $pages-find() works fine, i am having trouble using subfields within PageArray results. Definitely i miss something here. Maybe i should stop working for today, but meanwhile someone maybe have a hint what i am doing wrong... Thx, Olaf <?php foreach($results as $result) { // Directly access gives me "Notice: Trying to get property 'year' of non-object" echo $result->programm_date_advanced->year; // strftime shorthand gives me "Fatal error: Uncaught Error: Call to a member function strftime() on string" echo $result->programm_date_advanced->strftime('%Y'); // Using strftime plain gives me "Notice: A non well formed numeric value encountered" echo strftime('%Y', $result->programm_date_advanced); // Using strftime unformatted gives me "Warning: strftime() expects parameter 2 to be int, object given" echo strftime('%Y', $result->getUnformatted('programm_date_advanced')); // Plain output is o.k. echo $result->programm_date_advanced; // e.g. 10.07.2020 } ?>
  26. Hello @teppo, when using the module with @ryan's TOTP two-factor authentication, the user is logged as "Successful attempt: NO", and the user id instead of the name. is displayed in the "WHO" column. Probably because the login process has an extra TOTP code screen.
  1. Load more activity
  • Create New...