Author Topic: Is ?snippet=1 safe to use on every page ?  (Read 1090 times)

Offline xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 3732
  • Karma: 134
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Is ?snippet=1 safe to use on every page ?
« on: July 09, 2009, 05:19:44 am »
Hi,

I'm trying a customisable quick add form by "ajaxifying" a profile.

http://example.org/civicrm/profile/create?gid=1&reset=1&snippet=1

Seems to work ok, but is it "safe" and futureproof ?

Also, what about having an extra param to return a json of all the variables that would be assigned to the result template instead of the html of the template ?

X+

Online Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14731
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Is ?snippet=1 safe to use on every page ?
« Reply #1 on: July 09, 2009, 07:33:05 am »

yes, snippet=1 is here for some time :) (or at least until the new architecture :P)

adding an extra param to output all variables as json is probably doable in the template itself. You just need to dump the contents of the array

$smarty->_tpl_vars as a json element (i.e. json_encode?). Only hassle is in some pages we also send in some objects, which u'll need to skip. We also send in the config and session object which you should definitely not send out

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.