Textpattern | PHP Cross Reference | Content Management Systems |
Description: Template partials tags.
1 <?php 2 3 /* 4 * Textpattern Content Management System 5 * http://textpattern.com 6 * 7 * Copyright (C) 2016 The Textpattern Development Team 8 * 9 * This file is part of Textpattern. 10 * 11 * Textpattern is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation, version 2. 14 * 15 * Textpattern is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with Textpattern. If not, see <http://www.gnu.org/licenses/>. 22 */ 23 24 /** 25 * Template partials tags. 26 * 27 * @since 4.6.0 28 */ 29 30 namespace Textpattern\Tag\Syntax; 31 32 class Partial 33 { 34 /** 35 * Returns the inner content of the enclosing <txp:output_form /> tag. 36 * 37 * @return string 38 */ 39 40 public static function renderYield() 41 { 42 global $yield; 43 44 $inner = end($yield); 45 46 return isset($inner) ? $inner : ''; 47 } 48 49 /** 50 * Conditional for yield. 51 * 52 * @param array $atts 53 * @param string $thing 54 * @return string 55 */ 56 57 public static function renderIfYield($atts, $thing) 58 { 59 global $yield; 60 61 extract(lAtts(array( 62 'value' => null, 63 ), $atts)); 64 65 $inner = end($yield); 66 67 return parse(EvalElse($thing, $inner !== null && ($value === null || (string)$inner === (string)$value))); 68 } 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
title