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) »
  • Extra HTML appears in title
Pages: [1]

Author Topic: Extra HTML appears in title  (Read 1170 times)

kenahoo

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 1
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7.15
  • MySQL version: 5.1.63
  • PHP version: 5.3.16
Extra HTML appears in title
September 19, 2011, 06:37:31 pm
When viewing a contact in CiviCRM (e.g. at a URL like "/civicrm/contact/view?reset=1&cid=3707&context=search"), I see a bunch of extra HTML junk in the browser window's title bar.  In the page source, I see this:

<title><a href="/civicrm/profile/view?reset=1&amp;gid=10&amp;id=3707&amp;snippet=4" class="crm-summary-link"><div class="icon crm-icon Individual-icon" title="Individual"></div></a> George Jetson | </title>

As far as I know, browsers don't allow links like that in the title bar.  The end result is that the window's title bar shows all that raw HTML, which looks pretty yucky.

I'm using CiviCRM 3.4.5 on Drupal 6.  Locally I'm on Safari 5.1 on OS X.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Extra HTML appears in title
September 20, 2011, 04:23:18 am
Seems this is an issue within your theme. What theme is it?
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.

arosboro

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.9
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Extra HTML appears in title
November 30, 2011, 12:06:52 pm
I also see html in the title.  I'm using civicrm 4. and drupal 7.  My theme is Libra 7.x-1.0 which is an omega subtheme.  What file would I edit to change this in the theme?

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Extra HTML appears in title
November 30, 2011, 12:18:02 pm
Should be a file html.tpl.php in the Theme directory for that theme. You could add strip_tags there, or in template.php if you can find the correct place, such as in the process_page function.
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.

arosboro

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.9
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Extra HTML appears in title
November 30, 2011, 02:21:23 pm
I modified html.tpl.php to print the title like this:

Code: [Select]
<title><?php print strip_tags($head_title); ?></title>

and I'm still seeing the html tags.  Is there anything else I should try?

Thank you for your quick response.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Extra HTML appears in title
November 30, 2011, 08:30:12 pm
Sounds odd. I would try

Code: [Select]
<title><?php print strip_tags($head_title); ?>:Test</title>
just to make sure you edited the correct code. IE look for :Test in the title.
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.

arosboro

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.9
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Extra HTML appears in title
November 30, 2011, 09:08:16 pm
The actual source shows:

Code: [Select]
<title>&lt;a href=&quot;/civicrm/profile/view?reset=1&amp;amp;gid=7&amp;amp;id=107&amp;amp;snippet=4&quot; class=&quot;crm-summary-link&quot;&gt;&lt;div class=&quot;icon crm-icon Individual-icon&quot; title=&quot;Individual&quot;&gt;&lt;/div&gt;&lt;/a&gt; Carl Berlin | CiviCRM Demo:Test</title>
So I used the html_entity_decode function to encode the entities and then strip tags to remove the markup.  I modified the header title template.php's template_preprocess_html.

here is the code:

Code: [Select]
function libra_preprocess_html(&$vars, $hook) {
  $vars['head_title'] = strip_tags(html_entity_decode($vars['head_title']));
}

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Extra HTML appears in title

This forum was archived on 2017-11-26.