Magento : add script to all footer's pages - magento

i have a script for showing modal box by footer link :
<script>
...
</script>
How can i put that script in the footer of all magento pages ?

you can add script in footer using footer.phtml located in
[app\design\frontend\YOUR_PACKAGE\YOUR_THEME\template\page\html\footer.phtml]

Just go to system config->design->footer and type your script in misc. html box. Job done.

You can do this through two options:
You can edit template\page\html\footer.phtml file and put your script.
You can create new js file for the same and load it into header through layout\page.xml file.
Hope this solution will for for you.

Related

Hello Guys I am new in joomla and I want to display search module in header using code

Hello I am new in Joomla and I need help
I just want to display my new module into my header.php file I try with
but I don't see any search form in my header. Can anyone help me step by step thanks in advance
Note: create new module from my Joomla admin using default search module new module name = Header Search Module
You need to use <jdoc:include type="modules" name="your-position-name" /> in the file you want to display that module. Have you tried this?

How to make sure custom js file loaded last in joomla

I am trying to include a custom JS file into my joomla site. What I did is to edit the template's index.php file, and add <script src='custom.js"></script> right before </head>. But when the page is loaded, there are two other JS files loaded after my custom JS file. I thought by inserting my script loading line right before the closing head tag, my JS file should be the last one to load. What could possibly load those 2 JS files after my JS file, and how?
Try this,
you can use addCustomTag option this will not load the JS file inside your head tag but it should be last (from where you are calling there it load.)
$stylelink .= '<link rel="stylesheet" href="../css/IEonly.css" />';
$document = JFactory::getDocument();
$document->addCustomTag($stylelink);
For more details
Hope it works..
There is an option to specify execution of the script after page has loaded (defer). This is a HTML feature and addScript() exposes this in its interface. Doc: https://docs.joomla.org/JDocument/addScript
Example:
$document = JFactory::getDocument();
$document->addScript('js/myscript.js', 'text/javascript', true);

Integrate Jquery plugin into CodeIgniter

Ok i wanna integrate jquery into codeIgniter view file, and i have trouble put my jquery plugin into right place.
in view file my code is
<script>
$(document).ready(function(){
$("ul.youtube-videogallery").youtubeVideoGallery( {assetFolder:'localhost/yt'} );
});
</script>
I made folder called yt in my root file htacces/rip/yt - and put plug in into it. How to write {assetFolder:'localhost/yt'} in correct way. My plugin isnt working. So help me to taret assets folder???
Assuming your CI-directory is localhost (that is, not a subfolder of localhost):
{assetFolder:'<?php echo base_url(); ?>yt'}

How to add share buttons in magento CMS pages?

I have created CMS pages in Magento and I want to share with Social site using share buttons Facebook, Twitter, Google+ so any one to tell me how to do that ?
Add this part to :
your_package/your_theme/template/page/html/head.phtml
before this line --> <?php echo $this->helper('core/js')->getTranslatorScript() ?>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-c297c92f-9661-1cf3-697d-47c19ab7e281"});</script>
Add this part to your cms page :
<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_googleplus_hcount' displayText='Google +'></span>
NOTE: using sharethis extension
You can check below URL for Addthis button, select style of button you want to share, grab the code and add that code to Magento Admin >> CMS >> Pages. click on to Html view of Editor and paste the code which you have grab from Addthis site, and you will see share buttons on front end. Another method is you can add this code to your template file commonly used for Example 1column.phtml is used for CMS pages and you need Share buttons on all CMS pages then you can paste the same code in .phtml template file.
Add this : https://www.addthis.com/get/sharing#.UK8_PoafHcc
Although this is an old thread i would like to share my answer which i found.
Add a meta tag in
template/page/html/head.phtml
<meta property="og:site_name" content="yoursite.com"/>
Create a Custom Variable from System/Custom Variables by pasting the Facebook sharing button code to Variable HTML Value.
To add like/share button to cms or static block, use the “Insert Variable” button to insert the Custom Variable you have just created.

How to call a cms page in a phtml file in magento?

I need to display a CMS page inside my custom module's phtml file. Is there any way I can include it either through xml layout or via coding directly in phtml file? I know we can add a cms block but how can we add a cms page?
Try the below code in your phtml file
$page = Mage::getModel('cms/page')->load('home_page','identifier');
echo $page->getContent();
This code check if cms page is active then it will display page content
$page = Mage::getModel('cms/page')->load('top_offer','identifier');
echo $page->getIsActive()?$page->getContent():'';

Resources