Menu icon Foundation
Single or double quotes in panini front matter

I am using the Zurb template with panini and I love it. I have  some php that validates entries in a form. I need to pass it two string arrays. One is called expected and the other is called required. These arrays contain entries such as 'name', 'email', etc. I would like to specify these arrays in the front matter of the page containing the form. I have not been able to get it to pass single or double quotes surrounding the array entries. I have tried escaping the quotes by doubling them, but that doesn't work. Any suggestions.

 

 

Panini problem

I am using the Zurb template with panini and I love it. I have  some php that validates entries in a form. I need to pass it two string arrays. One is called expected and the other is called required. These arrays contain entries such as 'name', 'email', etc. I would like to specify these arrays in the front matter of the page containing the form. I have not been able to get it to pass single or double quotes surrounding the array entries. I have tried escaping the quotes by doubling them, but that doesn't work. Any suggestions.

 

 

This post has been closed. No new replies can be added.

Rafi Benkual about 1 year ago

In the front matter you should be able to wrap the string in "" like

text: "Buy me<br> a beer"

George Benthien about 1 year ago

My php code wants an array such as $required=['name', 'email']. If I rewrite the php code as $required={{required}} and put required: ['namel', 'email'] in the front matter of my form, I get $required=name,email with no brackets or quotes. If I enclose everything in double quotes such as required: "['name', 'email']", I get [&#x27;name&#x27;, &#x27;email&#x27;] with html entities instead of single quotes. Any ideas on how I can specify a php array like ['name', 'email'] in the front matter? Thanks.

George Benthien about 1 year ago

I found a way that seems to work. In the front matter I put

required: "name email"

In the php code I put

$required=explode(" ", '{{required}}');

By the way, the recent videos by Rafi on Panini are very helpful.