From ad76dca45ccdd9d82367bcc59c98bb456edff329 Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Tue, 14 Oct 2014 17:30:31 +0530 Subject: [PATCH] #29763 smarty and tpl part --- extern/wciwidget.php | 79 +++++++++++++++++++++++++++++++ templates/CRM/Wci/Page/Widget.tpl | 8 ++-- 2 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 extern/wciwidget.php diff --git a/extern/wciwidget.php b/extern/wciwidget.php new file mode 100644 index 0000000..61efe54 --- /dev/null +++ b/extern/wciwidget.php @@ -0,0 +1,79 @@ + +*/ + +require_once '../../../civicrm.config.php'; +require_once 'CRM/Core/Config.php'; +require_once 'CRM/Contribute/BAO/Widget.php'; +require_once 'CRM/Utils/Request.php'; + +$config = CRM_Core_Config::singleton(); +$template = CRM_Core_Smarty::singleton(); + +$widgetId = CRM_Utils_Request::retrieve('widgetId', 'Positive', CRM_Core_DAO::$_nullObject); +$embed = CRM_Utils_Request::retrieve('embed', 'Positive', CRM_Core_DAO::$_nullObject); +$jsonvar = 'jsondata'; +if (isset($format)) { + $jsonvar .= $cpageId; +} + +$data = ""; +if (isset($embed) && (true == $embed)) { + +} else { + $data = CRM_Wci_BAO_Widget::getWidgetData($widgetId); + $template->assign('form', $data); + +// $template->template_dir[] = "sites/all/modules/civicrm/extensions/civicrm-wci/templates/CRM/Wci/Page"; + $template->template_dir[] = "/var/www/F3/sites/all/modules/civicrm/extensions/civicrm-wci/templates/CRM/Wci/Page"; +// print_r($template->template_dir); +// $jsondata = $template->fetch('sites/all/modules/civicrm/extensions/civicrm-wci/templates/CRM/Wci/Page/Widget.tpl'); +// $jsondata = $template->fetch('wciwidget.tpl'); +// $output = 'var ' . $jsonvar . ' = ' . json_encode($jsondata) . ';'; +// echo json_encode($jsondata); +//echo $jsondata; +//echo $template->getTemplateVars('title'); +$template->display('wciwidget.tpl'); +} +/* +$output = ' + var ' . $jsonvar . ' = ' . json_encode($data) . '; +'; + +echo $output;*/ +CRM_Utils_System::civiExit(); diff --git a/templates/CRM/Wci/Page/Widget.tpl b/templates/CRM/Wci/Page/Widget.tpl index b5b5d9c..a5ba67a 100644 --- a/templates/CRM/Wci/Page/Widget.tpl +++ b/templates/CRM/Wci/Page/Widget.tpl @@ -156,7 +156,7 @@ {$form.style_rules.value} {literal} - +{/literal}
@@ -165,7 +165,7 @@ {ts}Logo{/ts} {/if} - {$form.title.value} + {$form.title}
\ No newline at end of file +
-- 2.25.1