Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. New update to v0.0.5. Lowered minimum required PW version. I just tested it on a install with PW 2.6.10 and fixed some small issues. Added support for WireCache entries using a selector as expires instead of a date.
  2. Yeah https://github.com/somatonic/ClearCacheAdmin/commit/88da90563991b7e156d0738143be7b17dc43249b I'm running php 5.3 and it works.
  3. Thanks for the report. I commited an update that fixes this. I hadn't thought about it and was runnning php 7
  4. Not at all. Yeah why not. But I originally just wanted to be able to trigger the various caches by simply using their own API. I wasn't doing any real operations or deletions just delegation. I now added support for "Other files and directories in the site/assets/cache/ dir". For now they will now show up in menu and on admin page and you can delete them recursively. Version 0.0.2 is commited.
  5. RT @processwire: New post: ProcessWire 3.0.15 adds new quick-tree panel, debug panel, new view options, utf8mb4 support & more– https://t.c…

  6. This might come in handy, it's still hot: https://processwire.com/talk/topic/13042-clearcacheadmin/
  7. ClearCacheAdmin Module Since there's so many asking how to clear cache. Here comes a helper module that let's you clear caches directly from the admin menu. Additionally it has its own admin page that's a collection of the various caches available in ProcessWire in one place. See some infos and clear them. WireCache (using $cache) caches in the DB and there no way to clear it from the admin. Now you can delete the entries individually or all in one go. Supports following cache types: - Template "Page" Cache (disk file cache) - MarkupCache module (file cache) - WireCache (DB) - Other files and directories found in assets/cache/ path Wanted to do this for a long time. It was also great fun to do it and give something to the community to also learn something. For now it's on github only. Requires ProcessWire 2.6+. https://github.com/somatonic/ClearCacheAdmin
  8. Well this message, behaviour and error only shows if your domain isn't in the hosts config.
  9. The module core -> PageRender does have a button.
  10. Have you entered your host in the config?
  11. Ah yes right, negative evals to true. So then correcting mine: if($id > 0){...} But don't see why that would be an issue to have a negative page id it won't find it anyway.
  12. If negative is a issue at all then if($id){ ... }
  13. Usually like this. $id = (int) $input->post->id; $p = $pages->get("id=$id, template=dings"); if($p->id){ // valid } else { // not valid }
  14. So this is sufficient, as in most cases in PW like fields. No isset() or empty() etc. if($session->cart_item){ .... exists or is populated } else { .... doesn't exists or is empty } You can also write, as always in PW $session->get("cart_item"); You can also use namespaced session $session->seFor("myshop", "cart_item", $cart_item); and get it with $cart_item = $session->getFor("myshop", "cart_item"); BTW what happens if hack your code and enter a "template=user, id=40, check_access=0" into your "product_id" POST?
  15. Those tools don't support multi language.
  16. https://processwire.com/talk/topic/1036-markupsimplenavigation/?p=8998 First post of this thread there's a link to an gist with an example to output bootstrap like html. But it's just an old example I worked out back then. I never used bootstrap so can't tell if it's still working with newer versions? (one of the reason I avoid frameworks )
  17. @surffun it's kinda hard to tell in general and it's so obvious that we may fail to see where you're struggling. There's tons of options in MSN to modify the output and examples are everywhere. Still don't know what the problem is you have.
  18. Any chance to update this module for 2.5+? Aka making the dev to the new master?
  19. Nothing is impossible. This is quite easy with MarkupSimpleNavigation: $tree = $modules->MarkupSimpleNavigation; $treeOptions = array( "show_root" => true, "outer_tpl" => "<ul class='main-menu cf'>||</ul>", "inner_tpl" => "<ul class='sub-menu'>||</ul>", ); $tree->addHookAfter("getItemString", null, function ($event){ $child = $event->arguments("page"); if($child->id != 1 && $child->numChildren(true)){ $itemStr = "<a href='{$child->url}'>{$child->title} <span class='drop-icon'>▼</span> <label title='Toggle Drop-down' class='drop-icon' for='tab_{$child->name}' onclick>▼</label> </a><input type='checkbox' id='tab_{$child->name}'>"; $event->return = $itemStr; } }); $menuStr = $tree->render($treeOptions); <nav id="mainMenu"> <label for='tm' id='toggle-menu' onclick>Navigation <span class='drop-icon'>▼</span></label> <input id='tm' type='checkbox'> <?php echo $menuStr;?> </nav>
  20. Which cache? Template cache you would go to the PageRender module settings and delete cache.
  21. Something using WireArray and WireData. You could use it like this, and all WireArray method would be usable like find(selector) , filter(), remove(), sort() etc. Somewhere in an autoload module or in /site/init.php <?php class MySiteConfig extends WireArray{ public function addItem($key, $value){ $item = new WireData(); $item->name = $key; $item->value = $value; $this->add($item); return $this; } public function render($key){ $str = ""; foreach($this->find("name=$key") as $d) $str .= " " . $d->value; $str = trim($str); return $str; } } // create a new "global" $siteConfig template variable $myConfig = new MySiteConfig(); $this->wire("siteConfig", $myConfig); $siteConfig would then be available everywhere. The addItem() would allow to add items to the WireArray with name -> value. In basic-page.php Template file: $siteConfig->addItem("classes", "main")->addItem("classes", "myClassX"); $siteConfig->addItem("classes", "myClassY"); $content .= wireRenderFile("blog"); then in the blog.php partial $siteConfig->addItem("classes", "blog"); ?><div class='blog <?php echo $siteConfig->render("classes"); ?>'> <h1>Blog Test</h1> <?php // example of using WireArray's implode() echo $siteConfig->implode(" ", "value"); // example of filtering items $vars = $siteConfig->find("name=classes, value^=my"); if($vars->count) { foreach($vars as $v) echo " $v->value"; } ?> </div> This would be easy to extend with further helper methods etc. Also in your template site/init.php or templates/_init.php you could create various template variables That is just a fictive example, not sure how practical this is for handling a use case mentioned in this thread.
  22. Maybe of use for someone. I somewhere use a in a Helper module's init(); // site specific configs $this->wire("config")->site = new StdClass(); // so now you can do $this->wire("config")->site->someKey = "somevalue"; and use this $config->site->someKey everywhere.
  23. CSRF doesn't work with a cached form. The PRG post rdirect get is the best design pattern to prevent double submission in case of a refresh or going back in browser.
  24. I'm not sure what you mean by "go through all pages". PW uses SQL "status &1" and it's 1 DB query and works fine. By default PW find() returns only published pages.
  25. Pocketgrid is neither a framework nor a library, it's an approach.
×
×
  • Create New...