make an archive

Author Message

justin kazadi

Thursday 21 August 2008 7:06:41 am

hello all,
i want to know how can i fetch (displayed) or group nodes by year and by month. in
design\ezwebin\templates\parts\blog\extra_info.tpl i have see the following code :


<div class="attribute-archive">
                            <h1>{"Archive"|i18n("design/ezwebin/blog/extra_info")}</h1>
                            <ul>
                            {foreach ezarchive( 'blog_post', $used_node.node_id ) as $archive}
                                <li><a href={concat( $used_node.url_alias, "/(month)/", $archive.month, "/(year)/", $archive.year )|ezurl} title="">{$archive.timestamp|datetime( 'custom', '%F %Y' )}</a></li>
                            {/foreach}
                            </ul>
                        </div>

i have try this in my pagelayout with

{$used_node=2} 

but it doesn't work and i have the following sql errors :

Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ),
        ' at line 14. Query: SELECT MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) AS month,
                                                YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) AS year,
                                                UNIX_TIMESTAMP( CONCAT( YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) , '-', MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) , '-', 01 ) ) AS timestamp
                                        FROM ezcontentobject_attribute,
                                             ezcontentclass,
                                             ezcontentclass_attribute,
                                             ezcontentobject_tree
                                        WHERE ezcontentclass_attribute.contentclass_id = ezcontentclass.id
                                            AND ezcontentclass.identifier = 'article'
                                            AND ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id
                                            AND ezcontentclass_attribute.identifier = 'publication_date'
                                            AND ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id
                                            AND ezcontentobject_tree.parent_node_id = 
                                            GROUP BY MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ),YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) )
                                                  

and this error


SELECT MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) AS month,
                                                YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) AS year,
                                                UNIX_TIMESTAMP( CONCAT( YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) , '-', MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ) , '-', 01 ) ) AS timestamp
                                        FROM ezcontentobject_attribute,
                                             ezcontentclass,
                                             ezcontentclass_attribute,
                                             ezcontentobject_tree
                                        WHERE ezcontentclass_attribute.contentclass_id = ezcontentclass.id
                                            AND ezcontentclass.identifier = 'article'
                                            AND ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id
                                            AND ezcontentclass_attribute.identifier = 'publication_date'
                                            AND ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id
                                            AND ezcontentobject_tree.parent_node_id = 
                                            GROUP BY MONTH( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) ),
                                                      YEAR( FROM_UNIXTIME( ezcontentobject_attribute.data_int ) )


i need same help to resolve this problem.
thanks in advance

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

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 10:00:07
Script start
Timing: Jan 19 2025 10:00:07
Module start 'layout'
Timing: Jan 19 2025 10:00:07
Module start 'content'
Timing: Jan 19 2025 10:00:07
Module end 'content'
Timing: Jan 19 2025 10:00:07
Script end

Main resources:

Total runtime0.6825 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 589.0313152.6094
Module start 'layout' 0.00760.0023 741.640639.4141
Module start 'content' 0.00990.6709 781.0547485.0391
Module end 'content' 0.68080.0016 1,266.093812.1875
Script end 0.6825  1,278.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.5458160.0002
Check MTime0.00140.2085160.0001
Mysql Total
Database connection0.00180.260910.0018
Mysqli_queries0.633692.8282460.0138
Looping result0.00040.0555440.0000
Template Total0.652695.620.3263
Template load0.00210.304020.0010
Template processing0.650595.307720.3252
Template load and register function0.00020.022710.0002
states
state_id_array0.00110.155910.0011
state_identifier_array0.00070.103920.0004
Override
Cache load0.00170.2475170.0001
Sytem overhead
Fetch class attribute can translate value0.00060.093610.0006
Fetch class attribute name0.00070.103720.0004
XML
Image XML parsing0.00260.384210.0026
class_abstraction
Instantiating content class attribute0.00000.000820.0000
General
dbfile0.00380.5628160.0002
String conversion0.00000.000940.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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs