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 CiviContribute (Moderator: Donald Lobo) »
  • Donation Widget doesnt have absolute urls.
Pages: [1]

Author Topic: Donation Widget doesnt have absolute urls.  (Read 1130 times)

hcamelion

  • Guest
Donation Widget doesnt have absolute urls.
June 28, 2009, 08:23:38 pm
Can anyone tell me why my donation widget code shown when editing the contribution page has relative urls.  I changed them to absolute urls and it is showing correctly but the button is not linking to the website and goes to the it has been placed on instead.  Did I miss a setting somewhere?

hcamelion

  • Guest
Re: Donation Widget doesnt have absolute urls.
June 29, 2009, 10:34:15 pm
Any ideas...I looked into the code and it seems that this variable:

Code: [Select]
$config->resourceBase
Is returning the base url without the domain name.  And that is being used to display the widgets code as well as being used for the widgets button in widget.php

I believe the config variable is being set at line 390 in administrator/components/com_civicrm/civicrm/CRM/Core/Config.php
(im using joomla)
Code: [Select]
if ( $this->userFrameworkResourceURL ) {
            // we need to do this here so all blocks also load from an ssl server
            if ( isset( $_SERVER['HTTPS'] ) &&
                 strtolower( $_SERVER['HTTPS'] ) != 'off' ) {
                CRM_Utils_System::mapConfigToSSL( );
            }
            $rrb = parse_url( $this->userFrameworkResourceURL );
            $this->resourceBase = $rrb['path'];
        }

According to that it is intentional set to the path and not an absolute url.  The widgets entire purpose is to use on other websites in a viral way, isnt that correct?  Then why wouldn't the copy and paste-able code, when editing a contribution page, have absolute urls?  Is there something wrong with my setup?

-Henry

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Donation Widget doesnt have absolute urls.
June 30, 2009, 03:39:24 am

can u apply the following patch and see if it works (i think it will). if so, please file an issue and i'll include the patch in 2.2.7

Code: [Select]
Index: templates/CRM/Contribute/Form/ContributionPage/Widget.tpl
===================================================================
--- templates/CRM/Contribute/Form/ContributionPage/Widget.tpl (revision 22167)
+++ templates/CRM/Contribute/Form/ContributionPage/Widget.tpl (working copy)
@@ -1,13 +1,13 @@
 {include file="CRM/common/WizardHeader.tpl"}
 {if $widget_id} {* If we have a widget for this page, construct the embed code.*}
-    {capture assign=widgetVars}serviceUrl={$config->resourceBase}packages/amfphp/gateway.php&contributionPageID={$id}&widgetID=1{/capture}
+    {capture assign=widgetVars}serviceUrl={$config->userFrameworkResourceURL}packages/amfphp/gateway.php&contributionPageID={$id}&widgetID=1{/capture}
     {capture assign=widget_code}
 <div style="text-align: center; width:260px">
- <object type="application/x-shockwave-flash" data="{$config->resourceBase}extern/Widget/widget.swf" width="220" height="220" id="civicontribute-widget" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer">
+ <object type="application/x-shockwave-flash" data="{$config->userFrameworkResourceURL}extern/Widget/widget.swf" width="220" height="220" id="civicontribute-widget" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer">
     <param name="flashvars" value="{$widgetVars}">
  <param name="allowScriptAccess" value="sameDomain" />
  <param name="allowFullScreen" value="false" />
- <param name="movie" value="{$config->resourceBase}extern/Widget/widget.swf" />
+ <param name="movie" value="{$config->userFrameworkResourceURL}extern/Widget/widget.swf" />
  <param name="quality" value="high" />
  <param name="bgcolor" value="#ffffff" />
  </object>
@@ -71,11 +71,11 @@
 
         
         <div id="id-colors-show" class="section-hidden section-hidden-border" style="clear: both;">
-            <a href="#" onclick="hide('id-colors-show'); show('id-colors'); return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a><label>{ts}Edit Widget Colors{/ts}</label><br />
+            <a href="#" onclick="hide('id-colors-show'); show('id-colors'); return false;"><img src="{$config->userFrameworkResourceURL}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a><label>{ts}Edit Widget Colors{/ts}</label><br />
         </div>
         <div id="id-colors" class="section-shown">
         <fieldset>
-        <legend><a href="#" onclick="hide('id-colors'); show('id-colors-show'); return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}close section{/ts}"/></a>{ts}Widget Colors{/ts}</legend>
+        <legend><a href="#" onclick="hide('id-colors'); show('id-colors-show'); return false;"><img src="{$config->userFrameworkResourceURL}i/TreeMinus.gif" class="action-icon" alt="{ts}close section{/ts}"/></a>{ts}Widget Colors{/ts}</legend>
         <div class="description">
             {ts}Enter colors in hexadecimal format prefixed with <em>0x</em>. EXAMPLE: <em>0xFF0000</em> = Red. You can do a web search on 'hexadecimal colors' to find a chart of color codes.{/ts}
         </div>

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

helenbn

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 2
    • Pretty Good Designs
  • CiviCRM version: 4.5.x
  • CMS version: Joomla 2.5.x, 3.x
  • MySQL version: 5.x.x
  • PHP version: 5.x.x
Re: Donation Widget doesnt have absolute urls.
July 06, 2009, 02:39:41 pm
I applied this to \administrator\components\com_civicrm\civicrm\templates\CRM\Contribute\Form\ContributionPage\Widget.tpl and it produced absolute urls for me.
« Last Edit: July 06, 2009, 03:04:53 pm by helenbn »
Pretty Good Designs | http://prettygooddesigns.com | Hey, that's pretty good!

nextwave

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 0
Re: Donation Widget doesnt have absolute urls.
August 26, 2009, 06:57:14 am
Hello, i also got the absolute urls working.
When I put the widget into another website, I still need it to link back to the original website the code was copied from. But this is not happening. any ideas?
I copied the code from electesrati.com and put it on esrati.com.
When I click the "Contribute" link on esrati.com, I need it to go back to the configured page on electesrati.com. How can I do this?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Donation Widget doesnt have absolute urls.

This forum was archived on 2017-11-26.