News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Quote function not working

Started by kai920, November 04, 2007, 12:08:16 PM

Previous topic - Next topic

Orstio


kai920

thanks, I will give that a look. think I am running into the
same problems w the "ajax quick reply" mod.

kai920

#22
Another question on AJAX functions: Under the forum's statistics center, when I click to expand each month - a bunch of extra table cells are generated. The attachments will clearly explain what I mean.

Is this also related to javascript and SEF URLs?  AFAIK, no javascript errors show up in FF console...

Extra tables cells are obviously not generated in standalone forum :)

PS. Is SMF's site attachment width not set at 600px? My attachments came in at the original width..

kai920

#23
Quote from: Orstio on June 09, 2008, 11:14:15 PM
Yes, but you would need to turn your js files into php files:

1. Does this mean I need to rename the js into a php and "echo" everything out. The J/M one would then be called something xml_topic_wrapped.js with the commas, slashes changed etc.  Or is it more involved than that?

2. Should I use if (empty($_REQUEST['option'])) to check for the presence of Mambo/Joomla?

3. The file to edit would be index.template.php? I only see 2 calls to js in there.. sha1.js (I can leave this alone yes?) and script.js?fin11.

PS. Could I add a check right inside the javascript somehow to check the state of _REQUEST['option']?  Since this is how technoadvice recommended checking for M/J. would it be possible to do something like this?


if (!empty($_REQUEST['option'])){
    sendXMLDocument(smf_scripturl + "/action,post2/topic," + smf_topic + "/xml,xml", x.join("&"), onPostDone);
} else {
    sendXMLDocument(smf_scripturl + "?action=post2;topic=" + smf_topic + ";xml", x.join("&"), onPostDone);
}

kai920

Quote from: kai920 on June 11, 2008, 09:46:48 PM
PS. Could I add a check right inside the javascript somehow to check the state of _REQUEST['option']?  Since this is how technoadvice recommended checking for M/J. would it be possible to do something like this?

Hey Orstio,

I found a nice function here that can parse variables from a Joomla/Mambo non-SEF url.


function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

This works for a standard URL like index.php?option=com_smf&Itemid=888. I can get the parameter using gup('option').

Do you know how to modify this function to automatically parse J/M SEF URLs? Ideally it would be able to auto-detect the presence of $mosConfig_sef.

Would this work?

if 'option' does not exist in the URL, assume we're SMF-only.
1. -- use regular SMF URLs (ie. smf_scripturl + "?action=post2;topic=888" )

if 'option does exist in the URL, assume we're in Joomla/Mambo.
2. -- if sef on, use SEF URLs (ie. smf_scripturl + "/action,post2/topic," + smf_topic)
3. -- if sef off, use regular URLs (ie. ie. smf_scripturl + "?action=post2;topic=888")

Advertisement: