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) »
  • How to make Snippet=0 for frontend URLs - Joomla
Pages: [1]

Author Topic: How to make Snippet=0 for frontend URLs - Joomla  (Read 743 times)

chaseweb

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.65-cll
  • PHP version: 5.3.17
How to make Snippet=0 for frontend URLs - Joomla
October 27, 2012, 02:53:43 pm
Hi,

I am using Joomla 2.5/CiviCRM 4.2.4 (latest) - And this is my first run at CiviCRM for a non-profit.
Ok...

I have enabled the Search Results to be allowed to show in the frontend with external URL
/index.php?option=com_civicrm&task=civicrm/contact/search&Itemid=211&force=1

Now when the list comes back and I select a contact - the URL looks like this (still good)
/index.php?option=com_civicrm&task=civicrm/contact/view&Itemid=211&reset=1&cid=272&key=a2964513dd29bd62484ca18bd8e681bb_6147&context=search

But when I select any tab in the Contact Summary (i..e Contributions, Activities, etc.) - I loose all formatting.
Now I figured out that it's due to the snippet=1 (if I remove this or set it to snippet=0) - the data displays nicely in the content area.

So my question is how do I disable (or set) the snippet for these tabs? 

Thanks
Corey

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: How to make Snippet=0 for frontend URLs - Joomla
October 27, 2012, 03:39:25 pm

The underlying issue is similar to this one:

http://forum.civicrm.org/index.php/topic,26574.msg112746.html#msg112746

This has come up a few times in the past. Seems like we might want to change the url generation strategy to retain the same url format as the top level url (i.e. if frontend url, all urls generated are frontend only etc)

Seems like this will need to be a change in the core. Might want to get into irc and discuss this with brian

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

chaseweb

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.65-cll
  • PHP version: 5.3.17
Re: How to make Snippet=0 for frontend URLs - Joomla
October 28, 2012, 11:12:25 am
Hi Lobo,

I will reach out to Brian, but now since it seems like some work will need to be done to get this resolved.  I was wondering do you think I can use mod_rewrite or something?

Corey

chaseweb

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.65-cll
  • PHP version: 5.3.17
Re: How to make Snippet=0 for frontend URLs - Joomla
October 28, 2012, 01:34:53 pm
Still not perfect..

But I added this to my .htaccess and it solved the snippet issue

RewriteCond %{QUERY_STRING} ^(.*&|)snippet=1(&.*|)$
RewriteRule ^(.*)$ $1?%1snippet=0%2 [L,R=301]

But there are links within the form that have links back to the administrator/...  type URLs - If I could find a way to switch this to index.php (when I know I am on the frontend).

Just trying to think outside the box - and then work with Brian to see what can be done in the core for a more long term solution.

Any ideas?

Corey

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: How to make Snippet=0 for frontend URLs - Joomla
October 28, 2012, 03:28:32 pm
I think switching to just respecting the base url, whether it is from front end and/or backend might be quite easy.

Check the code here:

CRM/Utils/System/Joomla.php

and search for administrator. Seems like if we fix the url function we should be fine and deal with either frontend or backend assuming the right permissions are in place.

However i'm not sure if we are smart enough in the config object to differentiate between the two cases

lobo
« Last Edit: October 28, 2012, 03:50:22 pm by Donald 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

chaseweb

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.65-cll
  • PHP version: 5.3.17
Re: How to make Snippet=0 for frontend URLs - Joomla
October 28, 2012, 03:41:24 pm
Thanks Lobo...

I will take a look.  After some more testing - I would also like to resolve this issue as well.

The links - "Advanced Search, and Search Builder" in the page that is rendered back, as the URL like this

http://wcr.chasewebsolutions.org/%20%20%20%20%20/index.php?option=com_civicrm&task=civicrm/group/search/advanced&gid=5&reset=1&force=1

As you can see it has spaces in it.  Which is causing the search page to be rendered at the bottom of the homepage.  When I remove these spaces it renders on it's own page.

I searched in the source (read this somewhere) and found the TPL
 <!-- .tpl file invoked: CRM/Contact/Form/Search/Basic.tpl. Call via form.tpl if we have a form in the page. -->

But when I looked in the TPL file (I see where it is, but looks like it's pulling another file in, and I am getting lost)

What I see in the page source
<div class="crm-results-block">
                  <div class="crm-search-tasks">
 <div id="search-status">
 <div class="float-right right">
            <a href="/    /index.php?option=com_civicrm&amp;task=civicrm/contact/search/advanced&amp;Itemid=101&amp;reset=1
">&raquo; Advanced Search</a><br />
                     <a href="/    /index.php?option=com_civicrm&amp;task=civicrm/contact/search/builder&amp;Itemid=101&amp;reset=1
">&raquo; Search Builder</a><br />

What I see in the Basic.TPL file
<div class="crm-results-block">
    {* Search request has returned 1 or more matching rows. *}
       {* This section handles form elements for action task select and submit *}
       <div class="crm-search-tasks">
       {if $taskFile}
          {if $taskContext}
            {include file=$taskFile context=$taskContext}
          {else}
            {include file=$taskFile}
          {/if}
       {else}
         {include file="CRM/Contact/Form/Search/ResultTasks.tpl"}
       {/if}
       </div>

So I can match the div tag - "crm-search-tasks" but then it goes into Smarty code, and I can't determine what file is pulled in.

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: How to make Snippet=0 for frontend URLs - Joomla
October 28, 2012, 04:55:00 pm

seems like this is related to the URL generation aspects with regard to front/back end of joomla. Pretty sure this is not connected to any of the tpl structure

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

chaseweb

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.65-cll
  • PHP version: 5.3.17
Re: How to make Snippet=0 for frontend URLs - Joomla
November 02, 2012, 02:13:40 pm
Hi would like to update the forum

First Thanks to Brian and Lobo...

SOLVED: First Issue with the Snippet=0 vs. 1 was determined to be a javascript conflict issue.  Once we resolved the javascript conflict then the screen was rendered properly and all the javascript functions worked properly.

SOLVED: Second issue found - with spaces in the URL.  A patch was provided by Brian (see attached) for the ResultsTask.tpl file (PLEASE RENAME back to TPL extension).  Once I added this to my override folder, the spaces in the URL went away. 

Location for this file/patch  (or you can place in your override folder)
administrator/components/com_civicrm/civicrm/templates/CRM/Contact/Form/Search/ResultTask.tpl

Lobo should I open a JIRA ticket for this, or will this patch get put in - please let me know.


STILL OPEN: Third issue - The search button is not showing up on the screen (see attached). 

Corey

chaseweb

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 0
  • CiviCRM version: 4.3.1
  • CMS version: Joomla 2.5.11
  • MySQL version: 5.1.65-cll
  • PHP version: 5.3.17
SOLVED Re: How to make Snippet=0 for frontend URLs - Joomla
November 03, 2012, 05:10:28 am
The last issue concerning suppression of the Search button turned out to be a CSS issue.

I just want to say many thanks to Brian on this one - he really went out of his way to assist on this one. 


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • How to make Snippet=0 for frontend URLs - Joomla

This forum was archived on 2017-11-26.