News:

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

Main Menu

$scripturl variable not changing on forum pages

Started by ssoltz, July 13, 2006, 02:21:03 PM

Previous topic - Next topic

ssoltz

Hello,

I am having a problem, it appears with the $scripturl variable:

I just upgraded, on a local test server, from beta4 to RC1, wrapped mambo 4.5.3h: i am using a REQUEST check to check when com_smf is loaded, if so, i use a ssi_menubar to replace the mambo top menu, so that it looks consistent with the rest of the site...smf has all menus, header, etc. stipped down to the basics...

This used to work great (and currently does on my live 1.1b4 site), but now it is not converting the $scripturl correctly when on the forum pages and the ssi_menubar links are going to unwrapped versions of the forum...btw, using bridge 1.1.5...

Can;t show you a URL because I am only running this locally...thank you!
Steve Soltz
SSK Creatives, Inc.

Orstio

Bridge 1.1.x doesn't change $scripturl anymore.  It uses an alternative method.

ssoltz

Orstio,

Well, that would explain that...

BTW, sorry for PMing you...I did not see the message under your signature...would not want to be rude...

Is there a method I could use to do this kind of thing with the newer bridge? A different variable perhaps? $myurl?...something else...I suppose I just need a variable that gives me the Mambo component bridge link...there has got to be that variable sitting out there somewhere...

Or...do I have to hardcode it...I would rather avoid this...

Thanks for the quick reply, btw!
Steve Soltz
SSK Creatives, Inc.

Orstio

It's a bit more complicated so that SEF works 100%.


global $myurl, $mosConfig_sef, $mosConfig_live_site;

if ($mosConfig_sef==1) {
     echo sefReltoAbs($myurl.'whatever');
} else {
     echo $mosConfig_live_site . '/' . $myurl . 'whatever';
}


That would be as simple as it gets.

ssoltz

OK...looks like I got it working...of course, I don't understand it, but that's nothing new...

I had to do it a little differently, since it appears $myurl is not known for the forum pages...this may be obvious to most. I tried to require smf.php, one of the files where it is defined, but I started to realize this was probably a stupid path.

I defined a variable in the function template_menu() section:

$smfurl = basename($_SERVER['PHP_SELF']) . '?option=com_smf&Itemid=' . $Itemid . '&';

Here are the first three buttons of my template menu (the three I've finished so far):

//[home]
if ($mosConfig_sef==1) {
echo '
<div><a href="'. sefReltoAbs($smfurl. '">index</a></div>');
} else {
echo '
<div><a href="'. $mosConfig_live_site . '/' . $smfurl . '">index</a></div>';
}

//[help]
if ($mosConfig_sef==1) {
echo '
<div><a href="'. sefReltoAbs($smfurl. '?action=help" target="_blank">'.$txt[119].'</a></div>');
} else {
echo '
<div><a href="'. $mosConfig_live_site . '/' . $smfurl . '?action=help" target="_blank">' . $txt[119] . '</a></div>';
}

// How about the [search] button?
if ($context['allow_search']){
if ($mosConfig_sef==1) {
echo '
<div><a href="'. sefReltoAbs($smfurl. '?action=search">',$txt[182],'</a></div>');
} else {
echo '
<div><a href="'. $mosConfig_live_site . '/' . $smfurl . '?action=search">'.$txt[182].'</a></div>';
}
}


Now, am I on the right track? My biggest concern is since I DO plan on using Mambo SEF, will this work once SEF is turned on?

Thanks for the assistance,
Steve Soltz
SSK Creatives, Inc.

Orstio

Almost.  :)

Instead of ?action=help, you should use &amp;action=help. 

ssoltz

#6
Orstio,

Hmmm...even though I have the "&amp;" here?

$smfurl = basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $Itemid . '&amp;';

Do I need the $Itemid variable? If so, I'm not getting that passed here either...if so, how do I get it?

Thanks,

EDIT:

Now, suddenly, I do have the $Itemid...weird...oh well...we'll see what happens...time to move on to the next issue with this upgrade...
Steve Soltz
SSK Creatives, Inc.

Advertisement: