Child links with images

Author Message

Izzy Lindsay

Saturday 25 September 2004 4:32:27 pm

Hi,

I'm currently using the following code to list the links to articles in a folder. However, as well as just showing the name for the link, I'd also like to display an image from each article as well. The image is added to the articles using related object but it is called "image". Any idea what I need to add to the following code to make it happen?

Thanks

<div class="pagetitle">
<br>
</div>

{* Grab all the child nodes. *}
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                          sort_by,        $node.sort_array ))}

    <table class="member_list" cellpadding="0" cellspacing="0" border="0">

        {* Loop through all nodes that we just fetched. *}
        {section name=Child loop=$children}

            {* Output the name as a link to the node containing the member. *}
            <tr>
                <td>
                    <a href={$:item.url_alias|ezurl}>{$:item.name}</a> 
                </td>
            </tr>

        {* End of loop. *}
        {/section}

    </table>

{/let}

Izzy Lindsay

Monday 27 September 2004 7:25:28 am

Solved it by doing this:

{* FULL LIST WITH IMAGES AND NAMES AS LINKS *}

{* Grab all the child nodes. *}
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                          sort_by,        $node.sort_array ))}


        {* Loop through all nodes that we just fetched. *}
        {section name=Child loop=$children}

            {* Output the name as a link to the node containing the member. *}

            <a href={$:item.url_alias|ezurl}>{attribute_view_gui image_class=gallerythumbnail 
attribute=$Child:item.object.data_map.image.content.data_map.image}</a><br>                    
            <a href={$:item.url_alias|ezurl}>{$:item.name}<br><br></a> 

        {* End of loop. *}
        {/section}


{/let}

Izzy Lindsay

Monday 27 September 2004 7:31:54 am

I'd like to have the above image and name links set out as grid rather than a long list.

I'd also like the grid to change depending on the width of the page so an 800x600 screen might see 24 links as 3x8 but a 1280x1024 screen would see them something like 6x4

I'm guessing that I just need to enclose some of the code in a div that floats each link to the left. Anything that doesn't fit on the first row drops down to the second row and so on. However, I've tried it and I can't seem to get it to work.

Any ideas?

Randeep Walia

Monday 27 September 2004 9:01:28 am

For future reference you could have noticed that EZ's default display of an article listing included a thumbnail- the code of which you would have found in the article line template.

As for the float question, different browsers render floated divs differently which may explain your varied results, but floating a div would be your best bet, maybe specifying a height and width if you can- or controlling the layout by linking it with some javascript. Either, that's a topic better suited for an HTML forum and probably not this one.

__________________________________
Randeep Walia is http://www.rundeep.net powered by EZ Publish

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:19:17
Script start
Timing: Jan 18 2025 19:19:17
Module start 'layout'
Timing: Jan 18 2025 19:19:17
Module start 'content'
Timing: Jan 18 2025 19:19:18
Module end 'content'
Timing: Jan 18 2025 19:19:18
Script end

Main resources:

Total runtime0.8423 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 589.0156152.6094
Module start 'layout' 0.00490.0031 741.625039.4141
Module start 'content' 0.00800.8327 781.0391546.2578
Module end 'content' 0.84070.0016 1,327.296912.1875
Script end 0.8422  1,339.4844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3933160.0002
Check MTime0.00140.1653160.0001
Mysql Total
Database connection0.00060.071610.0006
Mysqli_queries0.790093.7896600.0132
Looping result0.00050.0611580.0000
Template Total0.807695.920.4038
Template load0.00220.263420.0011
Template processing0.805495.617920.4027
Template load and register function0.00020.021610.0002
states
state_id_array0.00050.063510.0005
state_identifier_array0.00210.251620.0011
Override
Cache load0.00170.2022190.0001
Sytem overhead
Fetch class attribute can translate value0.00050.063520.0003
Fetch class attribute name0.00180.210350.0004
XML
Image XML parsing0.00210.246720.0010
class_abstraction
Instantiating content class attribute0.00000.004450.0000
General
dbfile0.00240.2810160.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs