Home arrow Forum Double conversion of HTML entities for <title> and <meta> tags
  Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 04:01:15 AM
Home New Posts Search Calendar


Login with username, password and session length
+  Joomla Forum
|-+  Joomla Hacks
| |-+  Joomla-SMF Forum Support
| | |-+  Joomla-SMF 1.0.x (Moderators: -Wolverine, kai920)
| | | |-+  Double conversion of HTML entities for <title> and <meta> tags
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Double conversion of HTML entities for <title> and <meta> tags  (Read 985 times)
raxx7
Joomla Newbie
*

Karma: +1/-0
Offline Offline

Posts: 1


View Profile
Double conversion of HTML entities for <title> and <meta> tags
« on: December 16, 2005, 09:05:23 PM »

Hello all,
I came across this issue while using the Joomla-SMF bridge for a portuguese site.
When viewing the SMF forum, in some parts of the site the page title would show up mangled.
For example, instead of Tópicos actualizados, it would apear T&oacute;picos actualizados.

The issue seems to be a conflict in the way such strings are handled in SMF and Joomla!
The problematic strings come from the Portuguese SMF translation, in which strings are already expressed using html entities.
This works fine for a standalone SMF instaltion, but when integrated into Joomla!, the bridge grabs the page title from SMF and passes it to Joomla!. Inside Joomla! the string is parsed by htmlspecialchars() and becomes mangled.

I fixed this by parsing the strings retrived from SMF before passing them to Joomla!, but I'm not sure it's the best way.

Below is the changes I used.
Any comments are welcome.


diff -Nur com_joomla_smf_forum_1.0.2a/smf.php com_joomla_smf_forum_1.0.2a.htmlentities/smf.php
--- com_joomla_smf_forum_1.0.2a/smf.php 2005-10-26 09:10:02.000000000 +0100
+++ com_joomla_smf_forum_1.0.2a.htmlentities/smf.php    2005-12-17 01:31:22.413529800 +0000
@@ -101,10 +101,11 @@
        unset($MH_WARNING);
 }

-if (isset($context['page_title'])) {
-       $mainframe->SetPageTitle( $context['page_title'] );
-       $mainframe->prependMetaTag( 'description', $context['page_title'].'.');
-       $keywords = implode(", ", str_word_count($context['page_title'], 1));
+if (isset($context['page_title'])) {
+    $page_title = html_entity_decode($context['page_title'], ENT_NOQUOTES, _ISO);
+       $mainframe->SetPageTitle( $page_title );
+       $mainframe->prependMetaTag( 'description', $page_title.'.');
+       $keywords = implode(", ", str_word_count($page_title, 1));
        $mainframe->prependMetaTag( 'keywords', $keywords);
        unset($keywords, $str);
 }
@@ -131,4 +132,4 @@
        exit;
 }

-?>
\ No newline at end of file
+?>


Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Joomla Forum | Powered by SMF 1.1 RC1.
© 2001-2005, Lewis Media. All Rights Reserved.
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Joomla Hacks is a Joomla Components, Joomla Modules, Joomla Templates, & Joomla Mambots resource portal. None of the text or images in this public website may be copied without the expressed written consent of the authors. Copyright 2005 by JoomlaHacks.com. Powered by Joomla. All rights reserved.
Terms of Use
Joomla Hacks



Joomla Hacks
German Lang French Lang Italian Lang Spanish Lang Japanese Lang Chinese Lang
MamboBuzz.com
Search Contact About Advertise Blogs Topsites Submit News Register Login