CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Native Smarty API
Pages: [1]

Author Topic: Native Smarty API  (Read 1135 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Native Smarty API
July 19, 2011, 08:29:48 pm
So, Of all the features I had on my wishlist for the API this is the last one.... (unfortunately X has added Jgrid onto the list now...)

/*
 demonstrates use of smarty as output
 */
function contact_get_example(){
$params = array(
  'id' => 1,
  'version' => 3,
  'api_Contribution_get' => array(),
  'format.smarty' => 'api/v3/exampleLetter.tpl',
);

  require_once 'api/api.php';
  $result = civicrm_api( 'contact','get',$params );

  return $result;
}

/*
 * Function returns array of result expected from previous function
 */
function contact_get_expectedresult(){

  $expectedResult = '


Dear abc3 xyz3

You have made 2 payments to us so far. You are well on your way
to a complementary free beer.


    USD  100.00  Friday, January  1, 2010
    USD  120.00  Saturday, January  1, 2011
';

  return $expectedResult  ;
}


Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Native Smarty API
July 19, 2011, 09:22:17 pm
I've disabled this again as I realise that script can be run in smarty & it needs more thought.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Native Smarty API
July 19, 2011, 11:55:03 pm
What's the benefit over {crmAPI}? formatting server side an ajax request?

IMO, choosing a jQuery template engine would be better: you fetch in json, and do the layout on the client side, but I might be missing something

X+

Quote from: Eileen on July 19, 2011, 09:22:17 pm
I've disabled this again as I realise that script can be run in smarty & it needs more thought.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Native Smarty API
July 20, 2011, 12:04:17 am
I have not played with jQuery yet, but it is on my wishlist. Is there any documentation / tutorial yet on jQuery in CiviCRM?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Native Smarty API
July 20, 2011, 12:05:59 am
Really my original idea was to able to click a URL & download an iif formatted file (for importing to QB) at some point - although at the moment I'm really just playing.

I'm with Erik on not being familiar with your method
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Native Smarty API
July 21, 2011, 12:55:59 am
Might be worthwhile having a session about jquery magic (basically, re-using what was done with civimobile with kyle).

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Native Smarty API
July 21, 2011, 01:08:51 am
Sounds like a plan....
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Native Smarty API

This forum was archived on 2017-11-26.