Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

xml - adding some jquery script to Magento page -


this has been driving me insane. can't figure out how append jquery script head section of particular page in magento 1.4.2. i've added latest jquery library pages editing page.xml, , i've added no conflict thing.

i know need add code custom layout update area page in question. nothing works, i've tried many pieces of code , none appear in head of page when later check source code.

i posted same question on official mangeto forum 8 days later , no replies. forum horrible getting advice questions unanswered :(. idea how add head via custom layout update example?

$(document).ready(function(){     $("a").click(function(event){         alert("thanks visiting!");     }); }); 

i've tried enclosing in script tags, in reference = head tag. nothing works. pulling hair out , i've googled every word phrase can think of no examples of how add scrip page's head in magento. please help.

expanding on alan's excellent summary. if want add file 1 specific page can use following snippet in layout update xml field:

<reference name="head">     <action method="addjs"><script>path/to/my/file.js</script></action> </reference> 

and place file http://example.com/js/path/to/my/file.js

or if want residing in skin folder use

<reference name="head">     <action method="additem"><type>skin_js</type><name>js/file.js</name><params/></action> </reference> 

with expected location http://example.com/skin/frontend/base/default/js/file.js change base , default according package , theme using

you can use above snippet in other layout/?.xml file place within layout handle want address. example place in cms pages in cms.xml you'll find

<cms_page>  .... </cms_page> 

and change to

<cms_page>     ...     <reference name="head">         <action method="addjs"><script>path/to/my/file.js</script></action>     </reference> </cms_page> 

and easy 1 adding snippet of javascript pages go system > configuration > design > footer > miscellaneous html

further reading:

using local.xml theme customisations

demystifying magento’s layout xml


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -