Created
February 20, 2014 15:38
-
-
Save aquelito/00b3f0b7045652313368 to your computer and use it in GitHub Desktop.
Encodage du tableau JSON passer via data attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// UPDATE::AxelRoche | |
$var_modal = array( | |
'id' => $_product->getId(), | |
'title' => $_product->getName(), | |
'price' => $_product->getPrice(), | |
'image' => $_product->getImageUrl(), | |
'qty' => 1, | |
); | |
$jsonModalProduct = htmlspecialchars(json_encode($var_modal), ENT_QUOTES, 'UTF-8'); | |
?> | |
<button data-modal-product="<?php echo $jsonModalProduct; ?>">My button</button> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment