Questions tagged [mustache.php]

A Mustache (logic-less templating system for HTML) implementation in PHP.

mustache.php is an implementation of in PHP. It requires at least PHP 5.2.x.

You can find more information about Mustache on the official website.

Installation

It can be easily installed using :

{
    "require": {
        "mustache/mustache": "2.0.*"
    }
}

An example

<?php
$m = new Mustache_Engine;
echo $m->render('Hello {{planet}}', array('planet' => 'World!'));
// will print: "Hello World!"

Links

94 questions
0
votes
1 answer

PHP Mustache combine alias loader with regular partials

I'm using the Mustache alias loader from this post to dynamically load partials (based on URL variables) into my default template. This works like a charm, however, in some cases I would also like to load "regular" partials. Is there a way to…
jnaklaas
  • 1,619
  • 13
  • 16
0
votes
1 answer

How to Iterate an array of objects in Mustache

I've got an array of objects being set to the Mustache render function: require 'vendor/Mustache/Autoloader.php'; Mustache_Autoloader::register(); $m = new Mustache_Engine(); echo $m->render($template, $data); $data contains an array of…
Ray Lawlor
  • 368
  • 1
  • 4
  • 13
0
votes
1 answer

PHP Mustache - Run data through function while templating

I'm a beginner in Mustache and I am trying to implement it in my project. It worked without Mustache. I have no idea how to do the following (perhaps because I don't know what keywords to Google for?). I'm sorry if the question title is unclear. I…
Daniel Cheung
  • 4,779
  • 1
  • 30
  • 63
0
votes
0 answers

Render handlebars.php duplicate some content

I have a question for you and please help me. I use this library in my project : https://github.com/XaminProject/handlebars.php. Now from my route I make the render of template. In template I have
Harea Costicla
  • 797
  • 3
  • 9
  • 20
0
votes
1 answer

A Template engine written in PHP that use JSON format as data?

I need a Template engine written in PHP that use JSON file as it's data. The popular engine that I love it's template format was Mustache.php but what I understood from it's documentation, data for this engine is PHP classes that is not very pretty…
Pooria Han
  • 597
  • 1
  • 4
  • 19
0
votes
1 answer

Error Unexpected closing tag: /content Mustache on zend 2

I am using widmogrod/zf2-mustache-module "dev-master" with Zend framework 2 skeleton application In layout I have this code: {{$content}}{{/content}} which should be replaced by actual content provided by each controller action I receive this…
0
votes
1 answer

Trying to call partials in mustache.php

Trying to call a mustache partial using mustache.php. I'm certain I'm messing something up, because the documentation seems to express that you can do what I'm trying to do. $m = new Mustache_Engine(array( 'loader' => new…
Ashleigh
  • 35
  • 7
0
votes
1 answer

Mustache : how to keep And condition in mustache

Below is how i am using with Mustache.If source is there i am showing {{#flag_sour}} data, if destination is there i am showing {{#flag_dest}} data. {{#onwardfl}} {{#flag_sour}}
siva
  • 7
  • 1
  • 8
0
votes
1 answer

Mustache.js in PHP keep tags that could not be rendered?

I got the following: {{#lang}}Dear{{/lang}} {{customer.ship_firstname}},
{{#lang}}Thank you for ordering from{{/lang}} {{shop.name}}. Now i run render this with these settings: $m = new Mustache_Engine( …
Karem
  • 17,615
  • 72
  • 178
  • 278
0
votes
0 answers

php mustache conditional value like handlebars block helpers

In Handlebars, you can make conditionals, like: {{#if isActive}} Active {{/if}} http://handlebarsjs.com/block_helpers.html I've been trying for a while to do something like this in the PHP Mustache. But nowhere i can…
Laurens Kling
  • 2,221
  • 1
  • 21
  • 31
0
votes
0 answers

How to hide response in firebug console on ajax using mustache socket.io

I tried several way to hide response on firebug console. i found woorank using mustache js, socket.io. there just "null" response. they using mustache template. I'm trying to understand how all this work together , even not showing data in the…
Surjit Sidhu
  • 377
  • 4
  • 14
0
votes
1 answer

Call php function in view from mustache and pass a mustache array value into the function call

I would like to pass an array value to a view function so that it can send back some HTML based on that value sent. I want my system to either send back textarea, textbox or radio button. On my mustache I have…
Churchill
  • 1,587
  • 5
  • 27
  • 39
0
votes
1 answer

Is there a way to included a mysql query in mustache template?

I'm trying to set values from a mysql query to a template in Mustache. I'm using mustache.php Is it possible to do this? I can't find any documentation on templating queries. Does anyone have a better solution?
user2003341
  • 73
  • 1
  • 9
0
votes
1 answer

if/else Mustache.php and Handlebars 2.0.0 compatibility

My if else statements using the "^" for "false" or "not" used to work in both Handlebars 1.3.0 and Mustache.php. When I try the ^ for "if not" in Handlebars 2.0.0 it always disregards that block, no matter if true or false? {{#repo}} …
MrRay
  • 1
0
votes
1 answer

Mustache PHP Put a template in a template

I'm trying to use the PHP implementation of Mustache to embed some html content in a template like this : [mytemplate begin] [html content] [mytemplate end] My html content is in a html file and when I try rendering it I have an error: echo…
Carvallegro
  • 1,241
  • 4
  • 16
  • 24