Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

2 Neutral

About mav_medved

  • Rank
  1. Hi everyone! Function wire() doesn't work in PW3 api after including pw's index.php Trying to use it exactly the same I use it in pw2 api. <?php require_once('/path/to/pw/index.php'); $test = wire('pages')->find('parent_id=1019'); I'm getting an error: PHP Fatal error: Call to undefined function wire() Though https://processwire.com/api/include/ says I can use wire() function as before. Btw, this one works: $wire->pages->find('parent_id=1019'); But I want my old scripts work with wire() function in pw3. Any ideas what could be wrong?
  2. BernhardB, thanks for response! A very nice module, I've found it very useful! Thanks for advice! But I needed to make cache not for a part of the template, but whole template. (have some specific ) So I came up with the solution, using this module: (maybe someone will find it useful too) <? $cache = $modules->get("MarkupCache"); $cache_key = 'page_'.$page->id.'_myvar_'.$my_session_var; if (!isset($options['render_for_cache'])){ $page->template->prependFile = ''; if (!$output = $cache->get($cache_key)){ $output = $page->render(array('render_for_cache' => 1, 'prependFile' => '', 'appendFile' => '')); $cache->save($output); } echo $output; } else{ ?> <!-- here is my plain html/php markup --> <? } ?> So now I can make a cache for any template with any cache_key. I'm sure it's possible to make a Hook using "before render" for certain templates, so that can make cache and keep the template file clean. (or maybe not ) Anyway don't want to do it, ask me if someone need it
  3. Hi all, Keen on processwire. Thanks a lot for this thing! But here is my issue: I have a lot of pages that need to be cached. But the content on this pages depends on what user has in his session's variable (not a logged-in user, just a guest but with a different session's variable value). So I need to add this session variable as a cache key before page will have been rendered and created the cache file. How to do so? I tried to find the solution, but there is no Hooks in wire/core/CacheFile.php So, my thoughts: 1. add the Hook for method "buildFilename" in wire/core/CacheFile.php to have the possibility to change filename for cache file (or at least to add custom cache key for filename) or 2. somehow do it using addHookBefore('Page::render' For example: let's assume we have a special param like $options['custom_cache_key'] and we can change it inside Hook method (by the way how to do that?)
  • Create New...