News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Joomla Mambo Tag Cleanup

Started by Goosemoose, January 26, 2006, 08:41:07 PM

Previous topic - Next topic

Goosemoose

Link to Mod

Many Joomla/Mambo bridged sites have 2 or even 3 copies of keywords and html tags.

This mod inserts a switch into the Default,Classic & Babylon templates that prevents duplicate tags from appearing when the forum is being viewed with Joomla or Mambo.

Specifically it prevents meta tags duplicated in SMF and Joomla so only one copy will appear, it prevents duplicate <head> </head> , <body> </body> , and <html> </html> as well as duplicate javascript calls.

The mod also make sure the title is properly displayed on the top of the browser for search engines to find and it includes the code for the javascript functions used by the templates.

Goosemoose

9 Downloads, no comments. Is it working okay for you guys?

Aravot

#2
Haven't installed yet, next week.

iqapps

Quote from: Goosemoose on January 26, 2006, 08:41:07 PM
Link to Mod
This mod inserts a switch into the Default,Classic & Babylon templates that prevents duplicate tags from appearing when the forum is being viewed with Joomla or Mambo.

Hi

Installed Joomla 1.0.7 with Bridge Mambo, Joomla SMF 1[1][1].1.2 and I use 7dana_smf_1.1_RC2 themes. Does this mode work with this theme.

Regards
IQAPPS

vibez

very interesting. are there any advantages compared to this method?

http://www.technoadvice.com/advanced/developer/modify_an_smf_theme_for_joomla_and_mambo.html

I'm not running an default themes. Can I still use this mod?

Goosemoose

Quote from: vibez on January 28, 2006, 05:19:07 AM
very interesting. are there any advantages compared to this method?

http://www.technoadvice.com/advanced/developer/modify_an_smf_theme_for_joomla_and_mambo.html

I'm not running an default themes. Can I still use this mod?

The advantage is that it takes care of most of that stuff for you. Everytime you upgrade your forum you just apply the mod rather than doing it all by hand.

For anyone not using the three default themes, open up the xml file and look at the changes made to the default template. Then find the code in the equivalent file in your theme. It should be almost identical. Then you can add the code to the xml and package the zip back up. There are only 3-4 things to do so it should only take a few minutes. Once you do this package it up and post it here so others can use it :)


vibez

Ok I'm having a few problems. Firstly the component wouldn't install because it Could not find a Joomla! XML setup file in the package.

Secondly, the joomla index.php editing isn't very clear. Do we move all of this code to after the <head>>

<link href="<?php echo $mosConfig_live_site;?>/templates/<?php echo $mainframe->getTemplate(); ?>/css/template_css.css" rel="stylesheet" type="text/css" />


Where exactly does this code fit?

<?php 
global $sc$context$settings$modSettings;

if (!
defined('SMF')){
  require (
"administrator/components/com_smf/config.smf.php");
  require (
$smf_path."/SSI.php");
}

$sc = &$context['session_id'];
$_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];

mysql_select_db($mosConfig_db);
if(!empty(
$context['page_title'])){
     
$mainframe->setPageTitle($context['page_title']);
}
echo '
        
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js?rc2"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
var smf_scripturl = "'
$scripturl'";
var smf_session_id = "'
$context['session_id'], '";
// ]]></script>'
;

// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.

echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/style.css?rc2" />
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/print.css?rc2" media="print" />';


/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/fonts-compat.css" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" target="_blank" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="'
$context['forum_name'], ' - RSS" href="'$scripturl'?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' 
$scripturl '?board=' $context['current_board'] . '.0" />';

// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
$options['collapse_header'] = !empty($_COOKIE['upshrink']);

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '

<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header = '
, empty($options['collapse_header']) ? 'false' 'true'';
function shrinkHeader(mode)
{'
;

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");
document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
document.getElementById("upshrinkHeader2").style.display = mode ? "none" : "";

current_header = mode;
}
// ]]></script>'
;

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_ic = '
, empty($options['collapse_header_ic']) ? 'false' 'true'';
function shrinkHeaderIC(mode)
{'
;

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");
document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";
current_header_ic = mode;
}
// ]]></script>
'
;

?>


Do we remove any existing bridge code we already have in the index.php file?

Goosemoose

Hi Vibez,
The mod should be installed through SMF's package manager, not through Joomla's. You are also not editing jooma's index.php, you are editing your template, through the admin panel of joomla. Yes, you would replace the existing bridge code with this updated code. Let me know if you have any more questions :)

TwinsX2Dad

This may be a stupid question - if it is, feel free to whack me a few times. My question is......

Which bridge is this for?

I am running Orstio's bridge & Community Builder with Joomla 1.07 & SMF RC1.1

Goosemoose

This is for Ortiso's , the only real bridge, and the one supported by SMF :)

Goosemoose

Ok, this mod has been downloaded over 120 times now and so far Ortiso is the only one who has said it worked great. Can I assume everyone else has installed it fine? It should greatly reduce the number of xhtml errors too!

Aravot

I installed it manally (not through package manager) and it works fine.

TwinsX2Dad

#12
Quote from: Goosemoose on February 01, 2006, 01:50:34 PM
This is for Ortiso's , the only real bridge, and the one supported by SMF :)

Thank you, GM. Now what if the default theme is not appearing for me to edit that bridge file? Can I do it manually?

Wait - time out. I reread what you said and I was on the wrong track. I'll try this again before asking more stupid questions.  :D

TwinsX2Dad

Okay - now I have a problem.

I placed the css call directly after the <head> tag. I then took the above and pasted it in directly after that (all within Joomla). I then went to the SMF admin area and installed the package through that. This is where it got fun. I received a warning telling me this:

Quote!!Error in Package Installation

At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.

Then, under 'Install Actions' the first three were Type: 'Execute Modification', Action: ./Themes/default/index.template.php and Description: Test failed.

This is killing me!  :D

Goosemoose

You are getting closer :) What version of SMF are you running? I tested the mod on RC2. If you are getting errors it means that you files are different from the ones I tested on. Did you edit your default theme?

TwinsX2Dad

Quote from: Goosemoose on February 01, 2006, 05:29:02 PM
You are getting closer :) What version of SMF are you running? I tested the mod on RC2. If you are getting errors it means that you files are different from the ones I tested on. Did you edit your default theme?


I am on SMF 1.1 RC2 with Joomla 1.0.7 (Stable), using the default theme for SMF.

Community Builder is also in there, but I've not yet taken the time to figure out what it does.  :D

Goosemoose

Make sure that index.template.php has it's permissions set to 777 for at least the time while you update it. There should be no problem on a default theme with RC2.

Praedator

Works great for me Goosemoose good work ;) was thinking the same thing because i thought it was annoying to have two times <head> etc.  ;D
Predator

- Time is a created thing. To say, "I don't have time" is like saying "I don't want to."
- Lao-Tzu......

iqapps

Works OK. ;D

Installed it manally...
Little problem's with css but OK...
Using SMF 1.1 RC2 with Joomla 1.0.7 (Stable), using the 7dana theme for SMF.

Regards
IQAPPS

Goosemoose

Quote from: iqapps on February 03, 2006, 04:37:37 PM
Works OK. ;D

Installed it manally...
Little problem's with css but OK...
Using SMF 1.1 RC2 with Joomla 1.0.7 (Stable), using the 7dana theme for SMF.

Regards
IQAPPS

The mod had a problem with CSS, or you still have a problem with CSS? The mod won't clean up conflicts with CSS, it focuses on conflicts with alot of the tags that make your site not xhtml valid.

Advertisement: