[Solved] Anchor Tags Don't Work with Joomla SEF on

Started by oSa, November 23, 2006, 04:53:28 PM

Previous topic - Next topic

oSa

This time i have a problem when the joomla sef is on.

Joomla: 1.0.11
SMF: 1.1rc3
bridge: 1.1.6
Joomla Core SEF: On
SMF SEF: off

The problem is that links such as last post, PMs and Up/Down don't work as they should. When you click, they take you to the top of the page instead of the exact message/place in the page. I found a few posts related to PMs but the solutions were PMs specific only. I wonder if this can this be solved? Thanks in advance...

Edit: When i manually add #new after the urls, they work. So i think, it must be the missing part in the urls. There must be a way to add it.

Edit after Solution: I've summarized the solutions here:
For Personal Messages # problem: here.
For Up/Down, First Unread Post, and LAtest Post links: here.

oSa

Soryy to bump, but this is an important issue (i know many of the topics are important but i couldn't help myself). It is very annoying to manually scroll down everytime you enter a topic and i can't cancel sef because there are some external links to my site, so it will cause page not found errors. I would appreciate any help. Thanks...


oSa

Forum url: http://www.artifm.net/component/option,com_smf/Itemid,26/lang,tr/

p.s. you can select the english language from top of the page. It will help you on some parts of the forum.

Orstio

Find this in smf.php:

$mainframe->addCustomHeadTag( '<script language="JavaScript" type="text/javascript" src="'. $settings['default_theme_url']. '/script.js?rc2"></script>' );
$mainframe->addCustomHeadTag( '<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'. $settings['theme_url']. '";
var smf_images_url = "'. $settings['images_url']. '";
var smf_scripturl = "'. un_htmlspecialchars(mambo_smf_url($scripturl)) . '";
var smf_session_id = "'. $context['session_id'] . '";
// ]]></script>' );


Replace it with this:

$mainframe->addCustomHeadTag( '<script language="JavaScript" type="text/javascript" src="'. $settings['default_theme_url']. '/script.js?fin11"></script>' );
$mainframe->addCustomHeadTag( '<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'. $settings['theme_url']. '";
var smf_images_url = "'. $settings['images_url']. '";');
if ($mosConfig_sef=='1')
$mainframe->addCustomHeadTag( ob_mambofix('var smf_scripturl ="'. $scripturl . '";'));
else
$mainframe->addCustomHeadTag( 'var smf_scripturl = "'. un_htmlspecialchars(mambo_smf_url($scripturl)) . '";');

$mainframe->addCustomHeadTag( ' var smf_session_id = "'. $context['session_id'] . '";
// ]]></script>' );

oSa

#5
i've tried this, but it didn't solve the problem. It still goes to top of the page, not to the last message in the topic and the pm links still don't get you to the pm. However, up/down buttons work correctly now.

This is a sample pm link from my forums:
http://www.artifm.net/component/option,com_smf/Itemid,26/action,pm/lang,tr
and this is a sample pm link from smf forums here:
http://www.simplemachines.org/community/index.php?action=pm#37661

As you can see the pm#XXXX part is missing.

This is a sample link to a new post from my forums:
http://www.artifm.net/component/option,com_smf/Itemid,26/topic,94.msg692
and this is from smf forums:
http://www.simplemachines.org/community/index.php?topic=25008.msg530688#new

This time #new is missing.

Also there is a strange problem: the "new" icon links to a message number which doesn't exist in the topic ???


Orstio

And, as for your "new" icon link, it does the same thing on your stand alone forum:

http://www.artifm.net/forum/index.php?board=14.0

It is most likely some bad code in the theme.

oSa

Pm links are solved, thanks. But on my stand alone forum, last post links do have #new at the end of the links. i.e.
http://www.artifm.net/forum/index.php?topic=104.msg735#new
but wrapped forum doesn't have:
http://www.artifm.net/component/option,com_smf/Itemid,26/topic,104.msg735

I suppose this is has nothing to do with the theme?

Orstio

Are you sure this is bridge 1.1.6?

Can you confirm this code is in smf.php?

//Fix for anything previous to Joomla! 1.0.10
if ($_VERSION->PRODUCT != 'Joomla!' || ($_VERSION->PRODUCT == 'Joomla!' && $_VERSION->DEV_LEVEL <= '9'))
$sefurl = substr($sefurl, 0, strpos($sefurl, 'option')) . preg_replace('/(\/)([^,]*)(#)/', '$1$2,$2$3', substr($sefurl, strpos($sefurl, 'option'), strlen($sefurl)));

oSa

#10
Yes, it is 1.1.6. And here is the code you asked directly forum my smf.php
//Fix for anything previous to Joomla! 1.0.10

if ($_VERSION->PRODUCT != 'Joomla!' || ($_VERSION->PRODUCT == 'Joomla!' && $_VERSION->DEV_LEVEL <= '9'))

$sefurl = substr($sefurl, 0, strpos($sefurl, 'option')) . preg_replace('/(\/)([^,]*)(#)/', '$1$2,$2$3', substr($sefurl, strpos($sefurl, 'option'), strlen($sefurl)));


And here is the code for new.gif link from my message.index.template.php
// Is this topic new? (assuming they are logged in!)

if ($topic['new'] && $context['user']['is_logged'])

echo '

<b>';



echo '

', $topic['is_sticky'] ? '<b>' . substr($txt['quick_mod_stickyshort'], 0, 6) . ':</b> ' : '' , '<span id="msg_' . $topic['first_post']['id'] . '" title="', $topic['first_post']['preview'], '">', $topic['first_post']['link'], '</span>';



// Is this topic new? (assuming they are logged in!)

if ($topic['new'] && $context['user']['is_logged'])

echo '

<a href="', $topic['new_href'], '" id="newicon' . $topic['first_post']['id'] . '"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" /></b>';


I've compared it with the default one and there isn't a difference other than the substr($txt['quick_mod_stickyshort'], 0, 6) part. Also the link comes from $topic['new_href'] i guess.

oSa

Noooo :'( Both the quote and inline edit functions stopped working after these modifications.

Orstio


oSa

1.0.10 Turkish from joomlaturkiye.org
1.0.11 update from joomla.org i guess. Is there a problem with my Joomla installation?

Orstio

Possibly.

Can you look in the file version.php in your includes folder, and post the values of $DEV_LEVEL and $PRODUCT from that file?

oSa

   var $DEV_LEVEL    = '11';
   var $PRODUCT    = 'Joomla!';

Orstio

I noticed that everything you've quoted from the code is double spaced.  What editor are you using when you make the code changes?

oSa

That's php designer 2006 - beta. But i use CuteFtp to edit the files that are on my site.

Orstio

Strange.

Alright, can you PM me an email address where I can send a file?

oSa


Advertisement: