Drupal shortcode

Pozdrav naime radim jedan plugin za HNB tečajnu listu u drupalu ako bi mi neko mogao pojasnit shortcode !

<?php echo do_shortcode('tecajna-lista'); ?>

.js i .css su na git hub

Blockquote<?php
/*
Plugin Name: HNB Tecajna lista
Description: Plugin for displaying currency exchange list based on HNB Exchange Rate Lookup by hnbex.eu
Version: 1.0

*/

function hnb_scripts() {
//Add Actions
drupal_add_acctions(’[hnb_scripts’);
//Add shortcode
drupal_add_shortcode(’[tecajna-lista]’, ‘hnbshortcode]’);
drupal_add_filter(’[do_shortcode]’);
echo do_shortcode(’[tecajna-lista"]’);
//Add Actions
add_acctions(’[mxhnb_scripts]’);
}

function hnbshortcode($atts) {
$options = shortcode_atts(array(
‘date’ => null,
‘currencies’ => null,
‘buying’ => null,
‘median’ => null,
‘selling’ => null
), $atts);

$js_options = new stdClass();
if ($options['date']) {
    $js_options->date = $options['date'];
}
if ($options['currencies']) {
    $js_options->currencyList = explode(',',$options['currencies']);
}
if ($options['buying']) {
    $js_options->hideBuying = $options['buying'];
}
if ($options['median']) {
    $js_options->hideMedian = $options['median'];
}
if ($options['selling']) {
    $js_options->hideSelling = $options['selling'];
}

$js_options = json_encode((array) $js_options);

return '<div id="hnb"></div>'
.'<script type="text/javascript">'
.'jQuery(document).ready(function() { jQuery.fn.getCurrencyExchangeRates(' . $js_options . '); });'
.'</script>';

}

?>

Hrvatska Narodna Banka

VALUTA KUPOVNI SREDNJI PRODAJNI
CHF      
GBP      
USD      
EUR      

Drupal ili Wordpress?

p.s. vidim da ti date nije definiran u JS fileu, stavi u consolu ono sto dobijes kao odgovor na ajax upit.


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Profit Monkey