<?php
// json is here a field, but can be your input too. This is for educational purposes
// this sample is the output from an Extjs Ajax call, submitting a complete grid back
// to the server
$json = '{
"success" : "true",
"message" : "OK",
"total" : "3",
"records" : [
{
"se_pkey": "DE",
"se_langvalue": "Deutsch",
"se_picon": "de",
"se_pvalue": "Lehrinstitut",
"se_pshow": "1",
"se_id": "216"
},
{
"se_pkey": "EN",
"se_langvalue": "Englisch",
"se_picon": "en",
"se_pvalue": "Institute",
"se_pshow": "1",
"se_id": "227"
},
{
"se_pkey": "NL",
"se_langvalue": "Niederl\u00e4ndisch",
"se_picon": "nl",
"se_pvalue": null,
"se_pshow": null,
"se_id": null
}
]
}';
$exjson = json_decode($json, true); // decode the json string to an array
foreach ( $exjson['records'] as $row ) { // loop the records
echo 'To access fields, this works too:&nbsp;'. $row['se_id']. '<br/>';
foreach ( $row as $field => $value ) { // loop the fields
// $field = field name
// $row = record
// $value = field value
echo $field . ': '. $value . '<br>';
}
echo '<br/>';
}
?>
function getPageByName($page_name) {
global $wpdb;
$page_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."'");
return $page_name_id;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
JavaScript JavaScript Set Cookie Midnight Expiration
function createCookie(name,value,path) {
var expires = "";
var date = new Date();
var midnight = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
expires = "; expires=" + midnight.toGMTString();
if (!path) {
path = "/";
}
document.cookie = name + "=" + value + expires + "; path=" + path;
}
<!-- Grab Google CDN's jQuery. fall back to local if necessary -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>!window.jQuery && document.write('<script src="js/jquery-1.4.2.min.js"></script>')</script>
[Embed(source='C:/WINDOWS/Fonts/verdana.ttf', fontFamily="Verdana", fontWeight="regular", embedAsCFF="false")]
public var Verdana:Class;
private var mytextfield:TextField = new TextField();
private var mytextformat:TextFormat = new TextFormat();
/*
... class declaration ...
*/
mytextformat.font = "Verdana";
mytextfield.embedFonts = true;
mytextfield.defaultTextFormat = mytextformat;