Prepare the data for the template
340146
public function compile()
	{
		$this->writeToTemplate(array('code' => ($this->htmlspecialchars) ? StringUtil::specialchars($this->data->text) : $this->data->text, 'highlight' => ($this->canChangeHighlight) ? $this->data->highlight : $this->highlight));
	}
702824
protected function prepare() : void
    {
        if ($this->prepared) {
            return;
        }

        if ($this->cacheEnabled && file_exists($this->cacheFile)) {
            $this->loadFromCache();
            $this->prepared = true;
            return;
        }

        $routeCollector = new RouteCollector();
        $routeDefinitionCallback = $this->routeDefinitionCallback;
        $routeDefinitionCallback($routeCollector);

        $data = $routeCollector->generateRoutesData(
            new StdParser(),
            new DataGeneratorGroupCountBased()
        );
        $this->routes = $data['routes'];
        $this->dispatchData = $data['dispatch_data'];

        if ($this->cacheEnabled) {
            $this->saveToCache($data);
        }

        $this->prepared = true;
    }
122617
public function prepareVars()
    {
        $this->vars['placeholder'] = $this->placeholder;
        $this->vars['useKey'] = $this->useKey;
        $this->vars['field'] = $this->formField;
        $this->vars['fieldOptions'] = $this->getFieldOptions();
        $this->vars['selectedValues'] = $this->getLoadValue();
        $this->vars['customSeparators'] = $this->getCustomSeparators();
    }
676180
protected function prepareData($data)
    {
        $data->collector = $data->item['collector'];

        $customData = [];

        foreach ((array) $data->collector['custom.data'] as $key => $item) {
            if (is_array($item)) {
                $item = (string) h('pre', [], print_r($item, 1));
            }

            $customData[$key] = $item;
        }

        $data->collector['custom.data'] = $customData;
    }
386511
protected function prepare(): void
  {
    if (!$this->prepared)
    {
      $this->fieldSets->prepare('');

      $this->prepared = true;
    }
  }
1369700
protected function prepareImportData()
    {
        $this->setActiveField();
        $this->setBrandField();
        $this->setCategoryField();

        $this->initPreviewImage();
        $this->initImageList();
        $this->initAdditionalCategoryField();

        parent::prepareImportData();
    }
1031510
public function prepareVars()
    {
        $this->vars['cssClasses'] = implode(' ', $this->cssClasses);
        $this->vars['columns'] = $this->getVisibleColumns();
        $this->vars['columnTotal'] = $this->getTotalColumns();
        $this->vars['records'] = $this->getRecords();
        $this->vars['noRecordsMessage'] = trans($this->noRecordsMessage);
        $this->vars['showCheckboxes'] = $this->showCheckboxes;
        $this->vars['showSetup'] = $this->showSetup;
        $this->vars['showPagination'] = $this->showPagination;
        $this->vars['showPageNumbers'] = $this->showPageNumbers;
        $this->vars['showSorting'] = $this->showSorting;
        $this->vars['sortColumn'] = $this->getSortColumn();
        $this->vars['sortDirection'] = $this->sortDirection;
        $this->vars['showTree'] = $this->showTree;
        $this->vars['treeLevel'] = 0;

        if ($this->showPagination) {
            $this->vars['pageCurrent'] = $this->records->currentPage();
            // Store the currently visited page number in the session so the same
            // data can be displayed when the user returns to this list.
            $this->putSession('lastVisitedPage', $this->vars['pageCurrent']);
            if ($this->showPageNumbers) {
                $this->vars['recordTotal'] = $this->records->total();
                $this->vars['pageLast'] = $this->records->lastPage();
                $this->vars['pageFrom'] = $this->records->firstItem();
                $this->vars['pageTo'] = $this->records->lastItem();
            }
            else {
                $this->vars['hasMorePages'] = $this->records->hasMorePages();
            }
        }
        else {
            $this->vars['recordTotal'] = $this->records->count();
            $this->vars['pageCurrent'] = 1;
        }
    }
50318
def template(name, datas)
      file = template_path(name)
      content = File.read(file)

      datas.each do |k, v|
        k = "<%= #{k} %>"
        content = content.gsub(k, v)
      end
      return content
    end
1202206
protected function loadTemplates()
    {
        $templates = $this->templatesObjectBackend->loadObject();
        if (!is_array($templates)) {
            $templates = array();
        }
        
        $this->templates = $templates;
    }
670682
def prepare(self, data):
        
        result = []

        for item in self.get_inner_data(data):
            result.append(self.preparer.prepare(item))

        return result
770274
def get_template_data(self, request, *args, **kwargs):
        ''''''

        # little tricky with vertical centering
        dimension = int(self.get_size().split('x')[0])

        data = {}

        if dimension <= 356:
            data['image_dimension'] = "row-md-13"

        if self.get_template_name().name.split("/")[-1] == "directories.html":
            data['directories'] = self.get_directories(request)

        return data
342588
public function render()
    {
        // Prepare details
        $path       = $this->config['settings']['path'];
        $name       = $this->config['settings']['name'] . '/';
        $template   = 'index.tpl.php';
        $functions  = 'functions.php';

        // Include theme specific functions file
        $file = $path . $name . $functions;
        if (is_readable($file)) {
            include $file;
        }

        // Create views for regions, from config-file
        if (isset($this->config['views'])) {
            foreach ($this->config['views'] as $view) {
                $this->di->views->add($view['template'], $view['data'], $view['region'], $view['sort']);
            }
        }

        // Sen response headers, if any.
        $this->di->response->sendHeaders();

        // Create a view to execute the default template file
        $tpl  = $path . $name . $template;
        $data = array_merge($this->config['data'], $this->data);
        $view = $this->di->get('view');
        $view->set($tpl, $data);
        $view->setDI($this->di);
        $view->render();
    }
937884
def _put_template(params):
    
    f = open(_render(params['template']), 'r')
    template = f.read()

    run(_write_to(_render(template), _render(params['destination'])))
543639
def render(self):
        '''
        
        '''
        data = self.prepare_data()
        if self.field.readable:
            return self.env.template.render(self.template, **data)
        return ''
1178530
public function prepareVars()
    {
        $this->vars['name'] = $this->formField->getName();
        $this->vars['value'] = $this->getLoadValue();
        $this->vars['field'] = $this->formField;
    }
289443
public function prepare()
    {
        if (!empty($this->legend)) {
            $this->addChild(new Child('legend', $this->legend));
        }
        switch ($this->container) {
            case 'table':
                foreach ($this->fields as $fields) {
                    $table = new Child('table');
                    foreach ($fields as $field) {
                        $errors = [];
                        if ($field->hasErrors()) {
                            foreach ($field->getErrors() as $error) {
                                $errors[] = (new Child('div', $error))->setAttribute('class', 'error');
                            }
                        }
                        $tr = new Child('tr');
                        if (null !== $field->getLabel()) {
                            $td = new Child('td');
                            $labelFor = $field->getName() . (($field->getNodeName() == 'fieldset') ? '1' : '');
                            $label = new Child('label', $field->getLabel());
                            $label->setAttribute('for', $labelFor);
                            if (null !== $field->getLabelAttributes()) {
                                $label->setAttributes($field->getLabelAttributes());
                            }
                            if ($field->isRequired()) {
                                if ($label->hasAttribute('class')) {
                                    $label->setAttribute('class', $label->getAttribute('class') . ' required');
                                } else {
                                    $label->setAttribute('class', 'required');
                                }
                            }
                            $td->addChild($label);
                            $tr->addChild($td);
                        }
                        $td = new Child('td');
                        if ($field->isErrorPre()) {
                            $td->addChildren($errors);
                        }
                        $td->addChild($field);
                        if (null !== $field->getHint()) {
                            $hint = new Child('span', $field->getHint());
                            if (null !== $field->getHintAttributes()) {
                                $hint->setAttributes($field->getHintAttributes());
                            }
                            $td->addChild($hint);
                        }
                        if (null === $field->getLabel()) {
                            $td->setAttribute('colspan', 2);
                        }
                        if (!$field->isErrorPre()) {
                            $td->addChildren($errors);
                        }
                        $tr->addChild($td);
                        $table->addChild($tr);
                    }
                    $this->addChild($table);
                }
                break;
            case 'div':
            case 'p':
                foreach ($this->fields as $fields) {
                    foreach ($fields as $field) {
                        $errors = [];
                        if ($field->hasErrors()) {
                            foreach ($field->getErrors() as $error) {
                                $errors[] = (new Child('div', $error))->setAttribute('class', 'error');
                            }
                        }
                        $container = new Child($this->container);
                        if (null !== $field->getLabel()) {
                            $labelFor = $field->getName() . (($field->getNodeName() == 'fieldset') ? '1' : '');
                            $label    = new Child('label', $field->getLabel());
                            $label->setAttribute('for', $labelFor);
                            if (null !== $field->getLabelAttributes()) {
                                $label->setAttributes($field->getLabelAttributes());
                            }
                            if ($field->isRequired()) {
                                if ($label->hasAttribute('class')) {
                                    $label->setAttribute('class', $label->getAttribute('class') . ' required');
                                } else {
                                    $label->setAttribute('class', 'required');
                                }
                            }
                            $container->addChild($label);
                        }
                        if ($field->isErrorPre()) {
                            $container->addChildren($errors);
                        }
                        $container->addChild($field);
                        if (null !== $field->getHint()) {
                            $hint = new Child('span', $field->getHint());
                            if (null !== $field->getHintAttributes()) {
                                $hint->setAttributes($field->getHintAttributes());
                            }
                            $container->addChild($hint);
                        }
                        if (!$field->isErrorPre()) {
                            $container->addChildren($errors);
                        }
                        $this->addChild($container);
                    }
                }
                break;
            default:
                foreach ($this->fields as $fields) {
                    $dl = new Child('dl');
                    foreach ($fields as $field) {
                        $errors = [];
                        if ($field->hasErrors()) {
                            foreach ($field->getErrors() as $error) {
                                $errors[] = (new Child('div', $error))->setAttribute('class', 'error');
                            }
                        }
                        if (null !== $field->getLabel()) {
                            $dt = new Child('dt');
                            $labelFor = $field->getName() . (($field->getNodeName() == 'fieldset') ? '1' : '');
                            $label = new Child('label', $field->getLabel());
                            $label->setAttribute('for', $labelFor);
                            if (null !== $field->getLabelAttributes()) {
                                $label->setAttributes($field->getLabelAttributes());
                            }
                            if ($field->isRequired()) {
                                if ($label->hasAttribute('class')) {
                                    $label->setAttribute('class', $label->getAttribute('class') . ' required');
                                } else {
                                    $label->setAttribute('class', 'required');
                                }
                            }
                            $dt->addChild($label);
                            $dl->addChild($dt);
                        }
                        $dd = new Child('dd');
                        if ($field->isErrorPre()) {
                            $dd->addChildren($errors);
                        }
                        $dd->addChild($field);
                        if (null !== $field->getHint()) {
                            $hint = new Child('span', $field->getHint());
                            if (null !== $field->getHintAttributes()) {
                                $hint->setAttributes($field->getHintAttributes());
                            }
                            $dd->addChild($hint);
                        }
                        if (!$field->isErrorPre()) {
                            $dd->addChildren($errors);
                        }
                        $dl->addChild($dd);
                    }
                    $this->addChild($dl);
                }
        }
        return $this;
    }
856322
function prepareFormData() {

            var data = {},
                matches,
                index;

            for (var i in formData) {
                if (!formData.hasOwnProperty(i)) continue;

                index = 0;
                matches = i.split(/\[(.+?)]/g);

                var tmpObject = {},
                    tmpArray = [];

                for (var k = matches.length - 1; k >= 0; k--) {
                    if (matches[k] === "") {
                        matches.splice(k, 1);
                        continue;
                    }

                    if (tmpArray.length < 1) {
                        tmpObject[matches[k]] = Number(formData[i]) || formData[i];
                    } else {
                        tmpObject = {};
                        tmpObject[matches[k]] = tmpArray[tmpArray.length - 1];
                    }
                    tmpArray.push(tmpObject)

                }

                data = $.extend(true, data, tmpObject);

            }

            formData = data;

        }