Jump to content

nexflo

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by nexflo

  1. Right now just want to setup a very simple logger, which tells me the time taken for the page to render and how much memory was used. I setup a super ultra light module as follows: public function init() { $this->addHookBefore('Page::render', $this, 'timeStart'); $this->addHookAfter('Page::render', $this, 'getStat'); } public function timeStart(){ $this->$timestart = microtime(true); } public function timeNow(){ return microtime(true)-$this->$timestart; } public function convert($size) { $unit=array('b','kb','mb','gb','tb','pb'); return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; } public function getMemory(){ return $this->convert(memory_get_peak_usage(true)); } public function getStat(){ echo '<!-- Page generated in '.$this->timeNow().' secs, Memory Usage: '.$this->getMemory().' -->'; } issue is: i want to hook into the very first and very last instance of processwire..i cant really seem to find the right hooks, or a documentation about it? cheers
  2. thanks a bunch joss for your fast and detailed answer. is it also possible to include "template" parts..instead of prefilled pages? prefilled pages dont show the enduser what exactly it is he's actually including.
  3. One thing i cant seem to find is how to add custom blocks to pages. I.e. I've got a template which includes several content fields - headline, content1, content2 but i also want to add another teaser... it would be great adding "new field" -> teaser into pages where i want to add them to. is something like this possible,without creating a new template for everypage? The ACF plugin for wordpress includes options like this and its very convenient. http://www.advancedcustomfields.com/add-ons/flexible-content-field/
×
×
  • Create New...