Columns --> Colspan?

Author Message

Mark Overduin

Friday 31 October 2003 6:51:03 am

I know how to display articles in 2 columns (http://www.ez.no/developer/ez_publish_3/forum/setup_design/how_to_solve_this_creating_columns), but if there are 5 articles that need to be displayed, you now get the following result:

(col 1)______(col 2)
Article1_____Article2
Article3_____Article4
Article5

...but what I want is this:

Article1_____Article2
Article3_____Article4
A . r . t . i . c . l . e . 5

...so the width of the column where Article5 is diplayed in is twice the width of the normal articles (1-4). What I need is something like 'colspan=2'.

Is this possible? If so, how?

-- Mark

Mark Overduin

Monday 03 November 2003 3:53:16 am

Anyone?

Mark Overduin

Wednesday 05 November 2003 1:31:36 am

I believe this is possible. I just don't know how it can be done.

So again: Anyone?

Paul Forsyth

Wednesday 05 November 2003 2:48:16 am

Can't you just take the code you have and put in special logic to do something different when the count reaches a modulo of 5?

paul

Mark Overduin

Wednesday 05 November 2003 3:57:59 am

Probably. But unfortunately, I don't have a clue how to do this...
Can you give me a hint or the required code? It'll be very helpful.

-- Mark

Paul Forsyth

Wednesday 05 November 2003 4:10:30 am

In your linked post:

http://www.ez.no/developer/ez_publish_3/forum/setup_design/how_to_solve_this_creating_columns

you seem to do such tests.

Look in the manual for other arithmetic functions.

paul

Mark Overduin

Wednesday 05 November 2003 11:30:59 pm

Ah, now I get it. Yesterday, I did not quite understand your reply, but now I do.
Anyways, that might be a solution, yes, and maybe I can use it somehow, but the real 'problem' is, that I never know how many articles there are. I mean, what if there are 7 articles? Then I'd like the seventh article to be 'colspan=2'.

So thanx for your solution. I'm sure I can use it somehow/somewhere.

But, is it possible to get the number of articles that will be listed?
And then, is it possible to 'ask' ezPublish if an article is the last article to be listed? (and if it's even or not).

-- Mark

Tom Couwberghs

Thursday 06 November 2003 12:07:07 am

Of course it can be done

For example:

{let noOfArticles=fetch(content','list_count', hash('parent_node_id',2,'class_filter_array',array(2),'class_filter_type','include'))}
{/let}

will count all the articles directly below the root node. Consult the documentation of the fetch function for further possibilities and the correct syntax

Once you've got the number of articles you could test whether it's even or not using the mod function

mod(16, 2) will return 0, mod(13,2) will return 1

To know which element you're handling inside the loop consider one of these

* index - is a number which starts at 0 and increases for each iteration.
* number - same as index but starts at 1
* key - if an array is iterated the key of the current item is set, if a number it will be the same as item
* item - if an array is iterated the current item is set, if a number the current iteration index is set (same as index)

Consult the section documentation page for more about these

hth

Tom

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 19 2025 03:20:32
Script start
Timing: Jan 19 2025 03:20:32
Module start 'layout'
Timing: Jan 19 2025 03:20:32
Module start 'content'
Timing: Jan 19 2025 03:20:32
Module end 'content'
Timing: Jan 19 2025 03:20:32
Script end

Main resources:

Total runtime0.0139 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 589.0313152.6094
Module start 'layout' 0.00500.0023 741.640639.4297
Module start 'content' 0.00730.0048 781.070397.3047
Module end 'content' 0.01220.0017 878.375038.3047
Script end 0.0138  916.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002215.9673140.0002
Check MTime0.00107.4372140.0001
Mysql Total
Database connection0.00075.345910.0007
Mysqli_queries0.002215.761430.0007
Looping result0.00000.078910.0000
Template Total0.001510.510.0015
Template load0.00085.706110.0008
Template processing0.00074.764310.0007
Override
Cache load0.00053.769210.0005
General
dbfile0.00096.229480.0001
String conversion0.00000.034340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs