Jump to content

Zeka

Members
  • Posts

    1,065
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Zeka

  1. 4 minutes ago, cb2004 said:

    If you switch advanced mode back on in config, go to the template Advanced tab and uncheck this right at the bottom you should be golden.

    Thanks, I know it. The issue is that somehow it worked before update with this option checked. 

  2. @adrian Hi. 

    I'm facing a small issue and I'm not sure that this one is relative to Tracy, but I feel that it's better to ask anyway.
    I have quite a simple template that outputs page views based on the GET parameters.

    Spoiler
    
    <?php namespace ProcessWire;
    
    	bp('template before');
    	if (!config('ajax') || !input()->get('post_ids')) {
    		wire404();
    	}
    
    	$layout->preventOutput(true);
    	$dirty_post_ids = input()->get('post_ids');
    	$post_ids = implode('|', sanitizer('intArray', $dirty_post_ids));
    
    
    
    	header('Content-Type: application/json; charset=utf-8;');
    	$data = cache()->getFor('PostViews', $post_ids, 300, function () use ($post_ids) {
    		return pages()->getById($post_ids, [
    			'getNumChildren' => false,
    			'joinFields'     => [
    				'phits'
    			]
    		])->explode(function ($p) {
    			return [
    				'id'    => $p->id,
    				'views' => (int) $p->getViewsCount(3.3)
    			];
    		});
    	});
    
    	echo wireEncodeJSON($data, 0);
    	bp('template after');
    	$this->halt();

    URL of this page is /ua/views/.

    The issue is that I have significant and unreasonable leap in memory usage

    image.png.b53bb594a76de53db13001323e8dc983.png

    The strange thing is that if I change URL ( page name) to something else like v or view I get (if not contains 'views')

    image.png.9bb5fdd73198780eb605dd1e6438b52e.png

    I have reviewed all the code and did not find anything where occurs 'views'.

    I don’t have any idea what can cause it, it's just some kind of mysticism, so I thought maybe it could be an issue with Tracy or Performance Panel. 

    Thanks. 

  3. @ryan There is one more issue that I faced after the update. 

    I'm using "Multiple templates or parents for users" and after update when I try to add new user with my custom template I get

    Can’t save page 0: /ua/authors/test/: Page using template “author” is not moveable. (Template::noMove) [/admin/access/users/ => /ua/authors/]

     

  4. Hi.

    I'm using Matrix field as a content builder. One of its type is "Embed code" that contain Textarea field where editors can insert embed code.

    I know that such an approach opens possibilities for vulnerabilities for and it's better to stick to Textformatter approach but for now editors don't want to change it.

    Sometime editors inset code like

    <Iframe src = "https://www.facebook.com/plugins/post.php?href ......" width = "500" height = "441"
            style = "border: none; overflow: hidden" scrolling = "no" frameborder = "0" 
            allowTransparency = "true" allow = "encrypted-media"> </ iframe>

    As you can see there are some errors in it that cause that only part of the page is rendered because of HTML parsing errors.

    So my question is how would you handle such an approach? 

    I was thinking to try to use purifier, but there will be a lot of work to configure it rightly, maybe there is an easier way that I don't think about how to validate HTML?

  5. @ryan It looks like there are some issues with InputfieldDatetime. I have to fields 'publish_from' and 'publish_until'. None of them are configurated to prefill today's date if empty, but after the update, if one of the fields has value second one is prefilled with its value. The second issue is that after page save I cannot change the selected value, it shows that the date is changed but after page save it still show the previous date. The third issue is that Date Picker options are not applied to the field. For example if I set Date Picker option to "No date/time picker" on the first field second one will also have no date/time picker. 
    Looks like there is something wrong with js initialization and first field configuration is applied to all other date fields on the page edit screen. Tested on two different sites. 

    • Like 3
  6. I'm still mostly on Foundation, but use it more like Sass mixins library with custom classes based on BEM naming methodology and js plugins. There are several 'Cons'  - jQuery dependency and uncertainty in further development as the project is maintained and developed by volunteers, there are not so many people from ZURB involved anymore, though there was first community-based release in December.

    • Like 1
  7. @BitPoet Thanks for the info. I'm already on InnoDB.

    I have Redis and Memcached on the server, but to be honest I have never used them as it's my first project where I hit some limits where probably it is a good thing to think about it. Could you recommend some reading about it or show some simple example of usage?

     

  8. @wesp You have to turn on URL segments on home page template and in your template file 

    if (input()->urlSegment(1)) {
    	$pagename = input()->urlSegment(1);
    	$match = pages()->findOne("template=article-page, name={$pagename}");
    	if (!$match->id) throw new Wire404Exception();
    	echo $match->render();
    	return $this->halt();
    }

     

  9. Hi.

    I'm looking for the right way to regenerate page cache when a page is saved or published so it has cached version when a user hit on the frontend. All that I can think about is to send get a request like:

    $this->wire->addHookAfter('Pages::saved(template=post), Pages::published(template=post)', $this, 'clearCacheFile');
    
    
    public function clearCacheFile($event) {
    		$page = $event->arguments[0];
    		$pages = $event->wire('pages');
    
    		....
    
    		if(count($clearPages)) {
    			$this->wire('modules')->get('PageRender')->clearCacheFilePages($clearPages, $page);
    			$this->message(sprintf($this->_('Cleared cache file for %d page(s)'), count($clearPages)), Notice::debug);
    		}
    
    		$http = new WireHttp();
    		$http->get($page->httpUrl);
    
    	}

    But I'm not sure is that good way and what pitfalls it would have? 

×
×
  • Create New...