I am writing an extension, I have most the php done. But I need to include a java-script file and a css file. How would I do this. I tried looking at other extensions that do this, but to no avail at all.
-Adam
what type of extension are you making? a special page? an extension tag? or a hook? if so, what are you hooking?
-- Jim R. Wilson (jimbojw)
On Wed, Feb 27, 2008 at 6:08 PM, Adam Meyer meyer7@mindspring.com wrote:
I am writing an extension, I have most the php done. But I need to include a java-script file and a css file. How would I do this. I tried looking at other extensions that do this, but to no avail at all.
-Adam
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Hmmm... I guess I figured to make a special page I needed a hook. but im trying to make my ajax image search/ insert (for quick adds to edits) into a proper extension.
I have a php function for the sql search, but I need to call it using sajax_do_call (java script calls the php function and tells the putput where to go.
-Adam
On Feb 27, 2008, at 8:10 PM, Jim Wilson wrote:
what type of extension are you making? a special page? an extension tag? or a hook? if so, what are you hooking?
-- Jim R. Wilson (jimbojw)
On Wed, Feb 27, 2008 at 6:08 PM, Adam Meyer meyer7@mindspring.com wrote:
I am writing an extension, I have most the php done. But I need to include a java-script file and a css file. How would I do this. I tried looking at other extensions that do this, but to no avail at all.
-Adam
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Hmmm... I guess I figured to make a special page I needed a hook. but im trying to make my ajax image search/ insert (for quick adds to edits) into a proper extension.
I have a php function for the sql search, but I need to call it using sajax_do_call (java script calls the php function and tells the putput where to go.
-Adam
You may be able to use one of these two hooks to inject your javascript into the headers:
"BeforePageDisplay" (see http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Memorize/Mem orize.php for an example) "OutputPageParserOutput" (see http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SmoothGaller y/SmoothGallery.php for an example).
V/r,
Ryan Lane
Sounds like you'll probably need two things then: a SpecialPage to process the SQL, and another hook to inject your custom JavaScript.
Either of the aforementioned hooks should work. I haven't used them in particular, but I've had good experiences with OutputPageBeforeHTML.
$wgHooks['BeforePageDisplay'][] = 'yourJSInjectingFunction'; // or OutputPageBeforeHTML function yourJSInjectingFunction( &$out ) { global $wgJsMimeType; $out->addScript( "<script type="$wgJsMimeType" src="path/to/your/script"></script>" ); // - OR - $out->addScript( "<script type="$wgJsMimeType">/* your custom JS directly in here */</script>" ); return true; }
-- Jim
On Thu, Feb 28, 2008 at 8:50 AM, Lane, Ryan Ryan.Lane@ocean.navo.navy.mil wrote:
Hmmm... I guess I figured to make a special page I needed a hook. but im trying to make my ajax image search/ insert (for quick adds to edits) into a proper extension.
I have a php function for the sql search, but I need to call it using sajax_do_call (java script calls the php function and tells the putput where to go.
-Adam
You may be able to use one of these two hooks to inject your javascript into the headers:
"BeforePageDisplay" (seehttp://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Memorize/Mem orize.php for an example) "OutputPageParserOutput" (see http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SmoothGaller y/SmoothGallery.php for an example).
V/r,
Ryan Lane
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org