mirror of
				https://github.com/Mibew/handlebars.php.git
				synced 2025-11-04 04:05:07 +03:00 
			
		
		
		
	Changed the internal 'if' helper such that it can test not only paths/variable names, but also numeric constants.
This will be helpful for subexpressions later, when testing numeric subexpressions return values,
eg: {{#if (eq 0 (mod @index 3))}}
Also added a test for this.
			
			
This commit is contained in:
		
							parent
							
								
									d7a9844e93
								
							
						
					
					
						commit
						5c3ea257b7
					
				@ -88,7 +88,11 @@ class Helpers
 | 
				
			|||||||
                 * @var $args array
 | 
					                 * @var $args array
 | 
				
			||||||
                 * @var $source string
 | 
					                 * @var $source string
 | 
				
			||||||
                 */
 | 
					                 */
 | 
				
			||||||
                $tmp = $context->get($args);
 | 
					                if( is_numeric($args) ) {
 | 
				
			||||||
 | 
					                    $tmp = $args;
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    $tmp = $context->get($args);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if ($tmp) {
 | 
					                if ($tmp) {
 | 
				
			||||||
                    $template->setStopToken('else');
 | 
					                    $template->setStopToken('else');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user