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 (Moderator: Dave Greenberg) »
  • Themekey for specific contribution pages
Pages: [1]

Author Topic: Themekey for specific contribution pages  (Read 1505 times)

admsh

  • I’m new here
  • *
  • Posts: 13
  • Karma: 1
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.1.53
  • PHP version: 5.3.2
Themekey for specific contribution pages
September 19, 2011, 07:02:23 pm
I'm using themekey to change the theme for each of my three donation pages (our organisation has two sub-organisations that need to accept donations, and need their own theme).

Everything works fine on the main donation page, but since themekey works by URL, when one hits submit, whether there's an error or one moves to the confirmation page, the theme reverts back to the default theme.

At the moment my rules are set to work by ID (so if the contribution page's ID is 2, one theme is on, and if it's 3, a different one is used). Does anyone know of a different way to set this up, so that the theme will hold for the whole donation process (donation page, confirmation page, and thank you page)?

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Themekey for specific contribution pages
September 19, 2011, 07:41:06 pm
I had trouble getting themekey to work on specific parts of civicrm because of the ? in the paths. But it does seem look a useful solution for such cases if you can figure your way through the options that themekey can be made to think about in terms of parts of the path
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

admsh

  • I’m new here
  • *
  • Posts: 13
  • Karma: 1
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.1.53
  • PHP version: 5.3.2
Re: Themekey for specific contribution pages
September 20, 2011, 04:11:19 am
Right - had no problem with the ?, you can create rules in themekey for what comes before and after it, but when you move on from the first screen of the donation page, the path becomes totally generic (civicrm/contribute/transact), so themekey has no idea you are on a page that should be treated like the contribution page with ID 3.

I'm wondering if anyone knows of a solution to this.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Themekey for specific contribution pages
September 20, 2011, 04:22:23 am
I do not think this can be done with themekey. You would have to either use a CiviCRM hook or potentially set a session variable to manage this, and then set the theme manually.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

admsh

  • I’m new here
  • *
  • Posts: 13
  • Karma: 1
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.1.53
  • PHP version: 5.3.2
Re: Themekey for specific contribution pages
October 01, 2011, 04:54:54 am
I've solved the problem using jquery. By adding an ID to the form's "action" attribute's destination, the theme sticks.

I've added this jquery code to a custom "main.tpl" custom file:
Code: [Select]
<script type="text/javascript">
cj("form#Main").attr('action', '/civicrm/contribute/transact?&id=3');
</script>
The original action attribute didn't have an ID attached to it (/civicrm/contribute/transact). Since themekey works using the ID in the URL, simply adding it to the action attribute solves the issue completely.

I really do think this should be something addressed by the civiCRM devs - by somehow making sure the ID stays, so much can be done using themekey... This solution works, but it's not the prettiest, and there are probably situations in which it won't work quite as well as it did for me.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Themekey for specific contribution pages

This forum was archived on 2017-11-26.