Author
|
Message
|
eve f
|
Tuesday 21 December 2004 5:53:37 pm
i notice that the looping of objects is always by rows,
article 1
---------
article 2
---------
article 3 ---------
however, i want my object to loop in the follwing maner
article 1 | article 2
----------|----------
article 3 | article 4 ----------|---------- is it possible to do it this way??? if yes, where to change the file or function.. ??
thanks you :)
|
Tobias Persson
|
Tuesday 21 December 2004 11:59:46 pm
Hi, yes its possible :-) check this for an example on how to do 2 columns: http://www.ez.no/ez_publish/documentation/customization/custom_design/examples/common_template_issues/complex_list
|
eve f
|
Wednesday 22 December 2004 12:49:22 am
thanks Tobias, it work well... just wonder if there is any radom function so that i can randomoly display my images. thanks a lot.
|
Tobias Persson
|
Wednesday 22 December 2004 12:57:26 am
Hmm, I havn't seen or used any rand() function.
But I think http://www.ez.no/community/contribs/template_plugins/random_sort_array_or_fetch_shuffle_operator
could work. But I haven't used it. There is a nice thread about it to here: http://ez.no/community/forum/setup_design/struggling_with_shuffle_operator
|
eve f
|
Wednesday 22 December 2004 6:10:03 pm
thanks tobias... is just what i want.. thanks you. :) but still got slight problem. i cant activate the extension.. why is this so?? i follow closely as stated, but cant activate it.. i click on the activate button, nothign happen..(PS:i have check the checkbox) :( when click on the activate button, what will happen?? when i click, there is no alert saying is done or whatever.. it jus go back to the same page and the extension is still there...
|
Tobias Persson
|
Wednesday 22 December 2004 11:20:44 pm
There are no confirmation that the extension is activated. But you can see if it has been started. It should be checked at the "Extension"-page.
|
eve f
|
Thursday 23 December 2004 12:24:31 am
oh i see... so it means it already started?? hmm.. think is my code again.. bcos, my banner dont come out, it is not being display can check for mi whether my codes are correct
{let randomised_array=fetch('content','list', hash('parent_node_id', '76', class_filter_type, "include", class_filter_array, array(2)))|shuffle} {section name=random loop=$randomised_array max=1} {node_view_gui view=element content_node=$random:item}
{/section} {/let} thanks a lot
|
Tobias Persson
|
Thursday 23 December 2004 1:02:57 am
Try and check randomised_array to see if you get some (and expected) output. I would use: {$randomised_array|attribute(show)}
|
eve f
|
Sunday 26 December 2004 7:13:39 pm
is it like this??
{let randomised_array=fetch('content','tree', hash('parent_node_id', '76', class_filter_type, "include", class_filter_array, array(2)))|shuffle} {section name=random loop=$randomised_array max=1} {$randomised_array|attribute(show)}
{/section} {/let}
it doesn't display anything.. just want to ask, the arrary(2), means what?? the 'tree' refers to what?? thankz :)
|
Tobias Persson
|
Sunday 26 December 2004 11:05:30 pm
I meant like this:
{let randomised_array=fetch('content','tree', hash('parent_node_id', '76',
class_filter_type, "include", class_filter_array, array(2)))|shuffle}
{$randomised_array|attribute(show)}
{/let}
Seems like you need to check out the docs for fetch function ;-) Here are some explanation in my own words: The 'array(2)' is combined with the class_filter_array that stands infront of it. (ie class_filter_array=array(2)). In all it means that the fetch will just include content that has the class id = 2 . You need to check what class the object you want to loop has. The 'tree' is the type of fetch you want to do. The tree-type-fetch grabs all content below parent_node_id including content in sub-folders.
Check out the docs for fetch and you will find more alot more info (and probably better explained ;-) ) http://www.ez.no/ez_publish/documentation/reference/data_fetching/content
|
eve f
|
Sunday 26 December 2004 11:41:20 pm
oh okie.. think im still nt clear with the syntax.. i try the above codes, and i only got the following output Attribute Type Value
what does it show?? no items being call??
--------- thanks..
|
Tobias Persson
|
Monday 27 December 2004 12:37:20 am
oki, try without the shuffle function first:
{let randomised_array=fetch('content','tree', hash('parent_node_id', '76',
class_filter_type, "include", class_filter_array, array(2)))}
{$randomised_array|attribute(show)}
{/let}
And make sure that the parent_node and that the class of the objects you want to get is correct. If you use the above code the parent node should be 76 and class = 2 If those are correct you should get all objects printed. Can you get it working?
|
eve f
|
Monday 27 December 2004 12:41:42 am
erm.. found the id.. it is wrking.. my class id is wrong.. thanks alot :) how can i display the image??
|
Tobias Persson
|
Monday 27 December 2004 12:49:41 am
The parent_node should be: 'Node ID' of the folder where you have your objects. (in ezpublish 3.4 you find the number in top of the preview of every object.) (in 3.5 you find it in 'Details' of every object)
The class ID (or ID)can you find in Configuration/Classes (thats for ez 3.4). In 3.5 you find the ID in Setup/Classes. Edit: Saw that you got it working while I wrote this. Great :-) Now can you add the shuffle function.
|
eve f
|
Monday 27 December 2004 12:54:35 am
hmm.. can help me with the codes. i not too good in the codes. so nw how should i edit the codes??
|
Tobias Persson
|
Monday 27 December 2004 1:00:25 am
What do you want to do?? Maybe better to take this over email. Send to: syrgas at gmail.com and I try to help you when I have time.
|
M M
|
Monday 27 December 2004 3:25:16 am
I need to loop the object for six times and show its name at the same time meaning that: {section name=Loop Loop=5} -- anything in here is repeated 6 times successfully-- {/section} The problem is that i need to display the name of some specific children for 6 times [looping over a variable] {section name=Child loop=fetch('content','list', hash('parent_node_id', 58))} } {$:item.name} {/section} So how could i merge both cases in the Loop parameter Hope you can help me Thanks in advance Mona
|
Łukasz Serwatka
|
Monday 27 December 2004 3:28:12 am
Hi, You can use "max" attribute
{section name=Child loop=fetch('content','list',
hash('parent_node_id', 58))} max=6}
{$:item.name}
{/section}
http://www.ez.no/ez_publish/documentation/reference/template_functions/program_flow/section
Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog
|
M M
|
Monday 27 December 2004 5:14:40 am
Hi, Thanks a lot for answering, but using the max attribute needs at least 6 objects to be entered through the content while i need to fix 6 cells [to keep the design look ] even if there's only one object entered and that's what the { loop=6} does , So unfortunately this is not what i want Please do infrom me with any solution u may reach
Thanks in advance
|
Łukasz Serwatka
|
Monday 27 December 2004 5:51:15 am
Hi, Fetching 6 nodes, so it loops 6 times or i don`t understand what you want to do ...
fetch('content','list', hash('parent_node_id', 58, limit, 6))
Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog
|