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) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Smarty conflicting with CiviCRM API?
Pages: [1]

Author Topic: Smarty conflicting with CiviCRM API?  (Read 434 times)

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
Smarty conflicting with CiviCRM API?
October 30, 2013, 06:04:59 am
I have a stand-alone PHP-project that uses Smarty.
Everything is fine until I started calling the CiviCRM API which is on the same server.

Pseudo_code:
  Instantiate Smarty object
  Call Smarty methods (works fine)

  require '/sites/all/modules/civicrm/api/class.api.php' ;
  $civiapi = new civicrm_api3(...);
  Do some calls to civiapi (works fine)

  Instantiate another Smarty object
  Call Smarty methods (this fails with "Call to undefined function..")

I presume that Civi-API instantiates its own Smarty in some way that conflicts with my separate use of Smarty.

Is there a way to "destruct" the Civi-API object or are there something else that I have missed...?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Smarty conflicting with CiviCRM API?
October 30, 2013, 06:18:27 am
Hi,

You'll need to investigate, might as well be that some session/global variables are in conflict. The crm api doesn't use smarty directly, but quite a few api stuff needs an initialised civi that might conflict

Depending on how perf is important on your specific app, might be better to use the rest api to keep civi completely separate. check out civicrm_api source code, you simply have to initialise differently and should work

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Smarty conflicting with CiviCRM API?

This forum was archived on 2017-11-26.