Columns --> Colspan?

Columns --> Colspan?

Friday 31 October 2003 6:51:03 am - 7 replies

Modified on Friday 31 October 2003 6:51:52 am by Mark Overduin

Author Message

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

You must be logged in to post messages in this topic!

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