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 CiviMail (Moderator: Piotr Szotkowski) »
  • Has anyone created a token / used another approach to draw in drupal content
Pages: [1]

Author Topic: Has anyone created a token / used another approach to draw in drupal content  (Read 6321 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Has anyone created a token / used another approach to draw in drupal content
August 14, 2013, 04:35:04 pm
I have a requirement to pull drupal content into CiviCRM - I'm thinking that the approach is to enable tokens in CiviMail & build a token to do it (using a static var so that the hook only talks to the DB once per mailing).

Has anyone been down this track?
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: Has anyone created a token / used another approach to draw in drupal content
August 14, 2013, 10:38:43 pm
It might be needed to extend the token syntax to have variables (eg the node or taxonomy id you want to fetch).

Code: [Select]
<h2>{$node.42.title}</h2>
<div>$node.42.teaser}</div>

What I often do is generate the content in the CMS side, put it in a textarea and the users do a copy/paste between that and civimail. Might be easier to automate further and add a one click button that would (ajax) create the mailing and set its content. The api for civimail has become good enough to be used like that I think

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

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Has anyone created a token / used another approach to draw in drupal content
August 14, 2013, 10:56:11 pm
Yeah Lobo & I have discussed extending the token syntax e.g {node.teaser id=30} - probably with multiple params.

In this case I probably don't need that as they are using a drupal module to set a bunch of items to be in the latest list & I can pull from one location.

They seem to prefer to faff around in drupal & have it in the header in civi enough to justify a token
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: Has anyone created a token / used another approach to draw in drupal content
August 15, 2013, 12:20:57 am
Quote from: Eileen on August 14, 2013, 10:56:11 pm
Yeah Lobo & I have discussed extending the token syntax e.g {node.teaser id=30} - probably with multiple params.

Something that could be super handy is to be able to assign the id once only and re-use it in several places
{assign node_id=42}

{node.teaser} //implicitly id=32
{node.title}

That's a common issue users have: how to send a nicely formatted invitation for an event, without having to copy paste the date/title/link/... with this syntax would be easy(ier)

Quote from: Eileen on August 14, 2013, 10:56:11 pm

In this case I probably don't need that as they are using a drupal module to set a bunch of items to be in the latest list & I can pull from one location.

They seem to prefer to faff around in drupal & have it in the header in civi enough to justify a token

Good point
-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 CiviMail (Moderator: Piotr Szotkowski) »
  • Has anyone created a token / used another approach to draw in drupal content

This forum was archived on 2017-11-26.