function executeRequest() { $my_path = Request::getRequestPath(); $my_name = Request::getRequestName(); $peer = new PaginePeer(); $peer->path__EQUAL($my_path); $peer->nome__EQUAL($my_name); $all_pages = $peer->find(); $my_page = $all_pages[0]; $peer_ep = new ElementiPaginaPeer(); $peer_ep->id_pagina__EQUAL($my_page->id); $all_elementi_pagina = $peer_ep->find(); /* * Carico tutti gli elementi pagina * Nel nome di un settore eventualmente ci posso mettere una descrizione * */ foreach ($all_elementi_pagina as $elem) { $categoria = $elem->categoria; $sotto_categoria = $elem->sotto_categoria; $specifica = $elem->specifica; $categoria_instance = __create_instance(StringUtils::underscored_to_camel_case($categoria) . "SectorRenderer"); $result = $categoria_instance->{$sotto_categoria}($specifica); set_sector($elem->path_settore, $result); } /* * Questi rendering popolano i vari settori a modo loro * */ //render pagina render(PageData::instance()->get("/")); //trova il layout e renderizza il tutto. }
public static function require_css($css_path, $media = CSS::MEDIA_ALL) { self::init_css(); if (!ArrayUtils::has_value(self::$css_elements, $css_path)) { self::$css_elements[] = $css_path; PageData::instance()->add("/page/headers/required_css_files/css_file_list", array("path" => $css_path, "media" => $media)); } }
function testCssAddIntoResult() { CSS::clean(); CSS::require_css_file("/" . FRAMEWORK_CORE_PATH . "tests/html/example_css/my_css_file.css"); $this->assertEqual(1, CSS::get_loaded_css(), "Il numero di css caricati non corrisponde!!"); $this->assertTrue(PageData::instance()->is_set("/page/headers/required_css_files")); $this->assertEqual(1, count(PageData::instance()->get("/page/headers/required_css_files/css_file_list")), "Il numero di css caricati non corrisponde!!"); }
public static function raw($key, $script) { self::init_javascript(); if (!ArrayUtils::has_value(self::$scripts, $key)) { self::$scripts[$key] = $script; $p = array(Block::MARKER_KEY => "head/raw_javascript", "raw_script" => $script); PageData::instance()->add("/page/headers/required_javascripts/list", $p); } }
function __construct($url, $content = false) { # store url and converted file path $this->file_path = Helpers::url_to_file_path($url); $this->url_path = $url; $this->template_name = self::template_name($this->file_path); $this->template_file = self::template_file($this->template_name); $this->template_type = self::template_type($this->template_file); # create/set all content variables PageData::create($this, $content); }
function testJsOrder() { JS::clean(); JS::require_jquery(); JS::require_script("/js/jquery/pippo.js"); JS::require_script("/js/jquery/another_js.js"); $required_javascripts = PageData::instance()->get("/page/headers/required_javascripts/list"); $this->assertTrue(strstr("/framework/core/js/jquery/jquery.min.js", $required_javascripts[0]["script_path"]) == 0, "Il primo file non corrisponde!!"); $this->assertTrue(strstr("/js/jquery/pippo.js", $required_javascripts[1]["script_path"]) == 0, "Il secondo file non corrisponde!!"); $this->assertTrue(strstr("/js/jquery/another_js.js", $required_javascripts[2]["script_path"]) == 0, "Il terzo file non corrisponde!!"); }
function __construct($url) { # store url and converted file path $this->url_path = $url; $this->file_path = Helpers::url_to_file_path($this->url_path); $this->template_name = $this->template_name(); $this->template_file = $this->template_file(); # create/set all content variables PageData::create($this); # sort data array by key length # # this ensures that something like '@title' doesn't turn '@page_title' # into '@page_Contents of @title variable' in the final rendered template # uksort($this->data, array('Helpers', 'sort_by_length')); }
public function renderResult() { $request_part = Request::getRequestPart(); $dot_pos = strpos($request_part, "."); $page_name = substr($request_part, 1, $dot_pos - 1); $page = PageFactory::create($page_name, new DataHolder()); Params::push(); Params::importFromPost(false); Params::importFromGet(true); ob_start(); $page->render(); $page_result = ob_get_contents(); ob_end_clean(); Params::pop(); PageData::instance()->set(Html::get_default_content_save_path(), $page_result); render(PageData::instance()->get("/")); //trova il layout e renderizza il tutto. }
static function &create($file_path) { # # a little bit of magic here to find any classes which extend 'Asset' # self::get_asset_subclasses(); # if the file path isn't passed through as a string, return an empty data array $data = array(); if (!is_string($file_path)) { return $data; } # split by file extension preg_match('/\\.([\\w\\d]+?)$/', $file_path, $split_path); if (isset($split_path[1]) && !is_dir($file_path)) { # set the default asset type $asset = 'Asset'; # loop through our asset_subclasses to see if this filetype should be handled in a special way foreach (self::$asset_subclasses as $asset_type => $identifiers) { # if a match is found, set $asset to be the name of the matching class if (in_array(strtolower($split_path[1]), $identifiers)) { $asset = $asset_type; } } # extract any page data scoped against the asset filename $page_data = self::extract_page_data($file_path); # create a new asset and return its data $asset = new $asset($file_path); # Parse the page data $page_data = PageData::parse_vars($page_data, true, ""); # Merge original data with associated page data $merged_data = array_merge($asset->data, $page_data); return $merged_data; } else { # new page $page = new Page(Helpers::file_path_to_url($file_path)); return $page->data; } }
<?php require $_SERVER['DOCUMENT_ROOT'] . '/breakout/models/PageData.class.php'; $pageData = new PageData(); $pageData->title = "Breakout"; $pageData->addCSS('dashboard.css'); $viewString = 'dashboard.php'; $pageData->content = "<div class='pageContent'>" . $pageData->getContents($viewString) . "</div>"; /* |------------------------------- | Put page together and echo |------------------------------- */ $page = (include $pageData->root . "/breakout/views/templates/master.php"); echo $page;
<?php include_once "models/PageData.php"; $pageData = new PageData(); $pageData->title = "Sunny Pet Store"; $pageData->addCSS('css/layout.css'); $pageData->addCSS('css/navigation.css'); //connect to database include_once "db/db_connect.php"; $pageData->content .= (include_once "views/navigation.php"); $navigationIsClicked = isset($_GET["action"]); if ($navigationIsClicked) { $controller = $_GET["action"]; } else { $controller = "guest/gallery"; } $pageData->content .= (include_once "controllers/{$controller}.php"); $page = (include_once "views/page.php"); echo $page;
/** * 构造分页参数 * @param int $pagesize * @return $this */ public function limit($pagesize = 10) { //查询条件 $getTotal = $this->getTotal(); $page = new PageData($getTotal, $pagesize); $pageArr = $page->show(); if (isset($pageArr['limit'])) { $this->_sql['limit'] = $pageArr['limit']; unset($pageArr['limit']); $this->_pageData = $pageArr; } return $this; }
<?php require $_SERVER['DOCUMENT_ROOT'] . '/breakout/models/PageData.class.php'; $pageData = new PageData(); $pageData->title = "Breakout"; $pageData->addCSS('ss.css'); $pageData->content = "<div class='pageContent'>" . $pageData->getContents('ss.php') . "</div>"; /* |---------------------- | Select Difficulty js |---------------------- */ $pageData->addJS('game4.js'); /* |------------------------------- | Put page together and echo |------------------------------- */ $page = (include $pageData->root . "/breakout/views/templates/master.php"); echo $page;
private static function init() { if (empty(self::$stack)) { array_push(self::$stack, PageData::instance()->view("/")); } }
static function get_layout() { return PageData::instance()->get(Layout::MARKER_KEY); }
public function render() { RenderingStack::push(PageData::instance()); include $this->__page_path; RenderingStack::pop(); }
static function get_shared_data() { if (self::$shared) { return self::$shared; } $shared_file_path = file_exists(Config::$content_folder . '/_shared.yml') ? Config::$content_folder . '/_shared.yml' : Config::$content_folder . '/_shared.txt'; if (file_exists($shared_file_path)) { # Correct formatting of fenced content $content = file_get_contents($shared_file_path); $content = self::preparse_text($content); return self::$shared = sfYaml::load($shared_file_path); } else { return array(); } }
static function get_shared_data() { if (self::$shared) { return self::$shared; } $shared_file_path = file_exists(Config::$content_folder . '/_shared.yml') ? Config::$content_folder . '/_shared.yml' : Config::$content_folder . '/_shared.txt'; if (file_exists($shared_file_path)) { return self::$shared = sfYaml::load($shared_file_path); } else { return array(); } }
/** * Implements \JsonSerializable interface * * @return array|mixed */ public function jsonSerialize() { return ['series' => $this->series->export(), 'release' => $this->release->export(), 'page' => $this->page->export()]; }
private static function init() { if (self::$my_tree === null) { self::$my_tree = new Tree(); } }
function tearDown() { PageData::instance()->clear(); }
<?php require $_SERVER['DOCUMENT_ROOT'] . '/breakout/models/PageData.class.php'; $pageData = new PageData(); $pageData->title = "Breakout"; $pageData->addCSS('game.css'); /* |---------------------------- | Select Level/Difficulty/js |---------------------------- */ $level = $_POST['next-level']; $difficulty = $_POST['difficulty']; $pageData->addJS('game-engine5.js'); $pageData->addJS('level-constructor.js'); $pageData->addJS("{$difficulty}.js"); $pageData->addJS("level{$level}.js"); ///////////////////////////////////// $pageData->content = "<div class='pageContent'>" . $pageData->getContents('game.php') . "</div>"; /* |------------------------------- | Put page together and echo |------------------------------- */ $page = (include $pageData->root . "/breakout/views/templates/master.php"); echo $page;