Developer's Forum

Solving daily Web Developing problems

Developer's Forum Logo

How to edit banner.phtml

Tags:

No tags yet.

  1. Krite

    into the Matrix
    Joined: Nov '10
    Posts: 129

    offline

    from code in banner.phtml
    <style>
    .slideshow {
    position:relative;
    }

    .slideshow .items div {
    float:left;
    opacity:0.0;
    position:absolute;
    z-index:8;
    }

    .slideshow .items div.active {
    opacity:1.0;
    z-index:10;
    }
    </style>

    <script>
    function slideSwitch() {
    var active = jQuery('.slideshow .items .active');
    // use this to pull the images in the order they appear in the markup
    var next = jQuery(active).next().length ? jQuery(active).next() : jQuery('.slideshow .items div:first');
    jQuery(next).css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
    jQuery(active).removeClass('active');
    });

    jQuery(active).animate({opacity:0.0}, 1000, function(){
    });
    }

    // execute your scripts when the DOM is ready. this is mostly a good habit
    jQuery('document').ready(function() {
    var active = jQuery('.slideshow .items .active');
    if ( active.length == 0 ) {
    active = jQuery('.slideshow .items div:first');
    active.addClass('active').animate({opacity: 1.0}, 1000);
    }

    jQuery(function() {
    setInterval( "slideSwitch()", 5000 );
    });
    });
    </script>
    <div class="slideshow">
    <div class="items">
    <?php foreach($this->sectionArr as $key => $section) { ?>
    <div class="">
    <?php echo $section; ?>
    </div>
    <?php } ?>
    </div>
    </div>

    and if i want change jqurey to Nivo Slider ( http://nivo.dev7studios.com/ ) How did i do? please tech me. thank you.

    Posted 6 months ago #
  2. Rick

    Administrator
    Joined: May '10
    Posts: 397

    offline

    Just take the Demo from Nivo and paste it all there.

    http://nivo.dev7studios.com/demos/

    Once you got it working start making your own changes

    Posted 6 months ago #
  3. Krite

    into the Matrix
    Joined: Nov '10
    Posts: 129

    offline

    i put jquery-1.6.1.min.js in skin\frontend\default\Toys\js\jquery-1.6.1.min.js and if i want add this code
    <?php echo $this->helper('core/js')->includeSkinScript('js/jquery-1.6.1.min.js'); ?>
    <?php echo Mage::getBaseDir() . "js/jquery-1.6.1.min.js" ?>

    where is i put it? in banner.phtml

    Posted 6 months ago #
  4. Rick

    Administrator
    Joined: May '10
    Posts: 397

    offline

    You can try to use the Get Base URL function:

    http://php.quicoto.com/getbaseurl-magento-url-path/

    However I'd recomend using Google's hosted jQuery Version

    https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js

    http://code.google.com/intl/es-ES/apis/libraries/devguide.html#jquery

    Posted 6 months ago #
  5. Krite

    into the Matrix
    Joined: Nov '10
    Posts: 129

    offline

    in a SpinOneSolutions( http://www.spinonesolutions.com/2010/10/magento-custom-widget/comment-page-1/#comment-31396) is call me is : In my example there the code that runs the slideshow lives in /widgetglider/banner.phtml.

    So if you wanted to use FancyTransistions and jQuery to run the slideshow all you would need to do is edit whatever template your using. In my example that template would be /widgetglider/banner.phtml.

    You can put whatever HTML/CSS/JS you want into those templates. The block model provides the data to the template and the template handles the HTML/CSS/JS formatting. And No. 2 of the email when I want to change it. http://nivo.dev7studios.com/ he said
    The JS file should either go in:
    /skin/frontend/default/mytheme/js
    or
    /js

    It depends on whether the JS is to be used in multiple themes or if it's specific to one theme.

    You can include the JS file in the .phtml file with:
    <?php echo $this->helper('core/js')->includeSkinScript('js/jquery.nivo.slider.js'); ?>
    <?php echo Mage::getBaseDir() . "js/jquery.nivo.slider.js" ?>

    However you typically include JS files.
    If you want the pictures to be a certain size just add a <style></style> block at the top of your .phtml file and use CSS to modify the size.

    please explain for me. thank you

    Posted 6 months ago #

Reply

You must log in to post.