Forums / Setup & design / View Slideshow by default

View Slideshow by default

Author Message

Andy Woods

Wednesday 18 May 2011 3:25:31 am

I have a gallery with images in it.

Is it possible to display the slideshow by default when visiting the page rather than having to click on the 'View as slideshow' link?

Thanks,

Andy

Veronique Jamilloux

Thursday 19 May 2011 2:21:45 am

Hi,

In my home page have a slide show using a javascript :

 // Lister ci-dessous toutes les images qui vont s'afficher

NewImg = new Array (
"images/ble_centre.jpg",
"images/dnoxia_centre.jpg",
"images/riz_centre.jpg",
"images/botrytis_centre.jpg",
"images/mais_centre.jpg",
"images/muscadine_centre.png"
);
var ImgNum = 0;
var ImgLength = NewImg.length - 1;

//Time delay between Slides in milliseconds
var delay = 2000;

var lock = false;
var run;

function chgImg(direction) {
    if (document.images) {
        ImgNum = ImgNum + direction;
        if (ImgNum > ImgLength) {
            ImgNum = 0;
        }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (ImgNum < 0) {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ImgNum = ImgLength;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; document.slideshow.src = "/design/urgi/" + NewImg[ImgNum];
&nbsp;&nbsp; }
}

function auto() {
&nbsp;&nbsp;&nbsp; if (lock == true) {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lock = false;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; window.clearInterval(run);
&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp; else if (lock == false) {
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lock = true;
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; run = setInterval("chgImg(1)", delay);
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
}

In my template where I define the <body> tag, I put

&nbsp;<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" {if eq($currentNode.node_id,$Root_Node)}onload="auto();"{/if}>

This is my case, may be it will help you.

Bye

VĂ©ronique

URGI - INRA
Webmaster
Route de Saint Cyr
78000 Versailles

Andy Woods

Thursday 19 May 2011 7:57:20 am

Hi Veronique,

Thanks for your post.

I chose to copy the slideshow code from the ezwebin image.tpl instead and add it to my gallery.tpl.  I just needed to change the fetch statements a little so that the parent node_id wasn't selected.

{def $sort_order=$node.parent.sort_array[0][1]
     $sort_column=$node.parent.sort_array[0][0]
     $sort_column_value=cond( $sort_column|eq( 'published' ), $node.object.published,
                             $sort_column|eq( 'modified' ), $node.object.modified,
                             $sort_column|eq( 'name' ), $node.object.name,
                             $sort_column|eq( 'priority' ), $node.priority,
                             $sort_column|eq( 'modified_subnode' ), $node.modified_subnode,
                             false() ) }
{if $sort_column_value|eq( false() )}
    {set $sort_column_value = $node.object.published
         $sort_column = 'published'}
{/if}
{def
    $previous_image = fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
                                                       'class_filter_type', 'include',
                                                       'class_filter_array', array( 'image' ),
                                                       'limit', '1',
                                                       'attribute_filter', array( 'and', array( $sort_column, $sort_order|choose( '>', '<' ), $sort_column_value ) ),
                                                       'sort_by', array( array( $sort_column, $sort_order|not ), array( 'node_id', $sort_order|not ) ) ) )
     $next_image = fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
                                                   'class_filter_type', 'include',
                                                   'class_filter_array', array( 'image' ),
                                                   'limit', '2',
                                                   'attribute_filter', array( 'and', array( $sort_column, $sort_order|choose( '<', '>' ), $sort_column_value ) ),
                                                   'sort_by', array( array( $sort_column, $sort_order ), array( 'node_id', $sort_order ) ) ) ) }  
<div class="content-view-full">
    <div class="class-image">
        <div class="attribute-header">
            <h1>{$next_image[0].name|wash()}</h1>
        </div>
        {if is_unset( $versionview_mode )}
        <div class="content-navigator">
            {if $previous_image}
                <div class="content-navigator-previous">
                    <div class="content-navigator-arrow">&laquo; </div><a href={$previous_image[0].url_alias|ezurl} title="{$previous_image[0].name|wash}">{'Previous image'|i18n( 'design/ezwebin/full/image' )}</a>
                </div>
            {else}
                <div class="content-navigator-previous-disabled">
                    <div class="content-navigator-arrow">&laquo; </div>{'Previous image'|i18n( 'design/ezwebin/full/image' )}
                </div>
            {/if}
            {if $previous_image}
                <div class="content-navigator-separator">|</div>
            {else}
                <div class="content-navigator-separator-disabled">|</div>
            {/if}
            {def $parent=$next_image[0].parent}
                <div class="content-navigator-forum-link"><a href={$parent.url_alias|ezurl}>{$parent.name|wash}</a></div>
            {if $next_image[0]}
                <div class="content-navigator-separator">|</div>
            {else}
                <div class="content-navigator-separator-disabled">|</div>
            {/if}
            {if $next_image[1]}
                <div class="content-navigator-next">
                    <a href={$next_image[1].url_alias|ezurl} title="{$next_image[1].name|wash}">{'Next image'|i18n( 'design/ezwebin/full/image' )}</a><div class="content-navigator-arrow"> &raquo;</div>
                </div>
            {else}
                <div class="content-navigator-next-disabled">
                    {'Next image'|i18n( 'design/ezwebin/full/image' )}<div class="content-navigator-arrow"> &raquo;</div>
                </div>
            {/if}
        </div>
        {/if}
        <div class="attribute-image">
            <p>{attribute_view_gui attribute=$next_image[0].data_map.image image_class=imagelarge}</p>
        </div>
        <div class="attribute-caption">
            {attribute_view_gui attribute=$next_image[0].data_map.caption}
        </div>
        {include uri='design:parts/image/related_content.tpl'}
    </div>
</div>

eZ debug

Timing: Jan 17 2025 22:39:22
Script start
Timing: Jan 17 2025 22:39:22
Module start 'content'
Timing: Jan 17 2025 22:39:23
Module end 'content'
Timing: Jan 17 2025 22:39:23
Script end

Main resources:

Total runtime0.8459 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.7109180.8438
Module start 'content' 0.00600.7339 768.5547599.2969
Module end 'content' 0.74000.1059 1,367.8516344.7500
Script end 0.8458  1,712.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.4395210.0002
Check MTime0.00140.1614210.0001
Mysql Total
Database connection0.00080.089710.0008
Mysqli_queries0.767190.67621940.0040
Looping result0.00170.19941920.0000
Template Total0.821197.120.4106
Template load0.00210.247420.0010
Template processing0.819096.817920.4095
Template load and register function0.00020.019310.0002
states
state_id_array0.00070.083710.0007
state_identifier_array0.00070.077420.0003
Override
Cache load0.00190.2304940.0000
Sytem overhead
Fetch class attribute can translate value0.00110.124830.0004
Fetch class attribute name0.00080.099440.0002
XML
Image XML parsing0.00090.105730.0003
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00200.2336270.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs