Forums / Setup & design / Customize calendar.tpl. Fetching content by a date field attribute instead of the default published. How to ?

Customize calendar.tpl. Fetching content by a date field attribute instead of the default published. How to ?

Author Message

laurent le cadet

Saturday 25 September 2004 4:54:30 am

Hi,

I'm trying to use the calendar.tpl, which work fine but what I need is to fetch the the content of a specific node with an attribute instead of the published date.

I created a class with a date field, let us call it "publication_date".
I think it's possible to sort by attribute but I just don't know how.
I presume the date field use the same structure as the published date (2000,00,00) so I change the 'published' by the date field attribute ID (here it's '187'):

    {let log_node=fetch( content, node, hash( node_path, $show_subtree ) )
         show_week=false()
         month_list=fetch( content, tree, hash( parent_node_id, $log_node.node_id,
                                                class_filter_type, include,
                                                class_filter_array, array( 'agenda' ),
                                                attribute_filter, array( and, array( '187', '>=',
                                                                                      $time_start ),
                                                                              array( '187', '<=',
                                                                                      $time_end ) ),
                                                group_by, array( "published", "day" ),
                                                as_object, false() ) )
         month=$month_list|month_overview( 'published', $time_published,
                                           hash( current, $time_current,
                                                 current_class, 'selected',
                                                 today_class, 'today',
                                                 link, $log_node.url_alias,
                                                 month_link, true(), year_link, true(), day_link, true(),
                                                 next, hash( link, $log_node.url_alias ),
                                                 previous, hash( link, $log_node.url_alias ) ) )}
        {include name=Month uri="design:navigator/monthview.tpl" month=$month show_week=$show_week}
     {/let}

But it still working the same way.

Or maybe we have to change the $time_published :
time_published=maketime( 0, 0, 0, $today_info.month, $today_info.day, $today_info.year )

Someone has an idea ?

Laurent

laurent le cadet

Monday 27 September 2004 11:58:36 pm

Is it possible or not ? I really stuck on this....

Paul Borgermans

Tuesday 28 September 2004 12:09:51 am

No,

But there is a contribution which does this:

http://ez.no/community/contributions/applications/agenda_v1_0

It is for including in templates for node views (not pagelayout.tpl, that needs some tweaking)

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

laurent le cadet

Tuesday 28 September 2004 12:17:32 am

Thanks Paul,

Your answer is really clear.
I already had a look at Stefano's template without a great success. I'm going to try again to make it works.

Laurent.

Tore Skobba

Tuesday 28 September 2004 1:26:01 am

Hi

Use the Agenda, it is more flexible then EZ calendar view, the later I find very difficult to use and adapt.. I like the idea very much but I think it is currently to complex and lacking documentation to be of any good use.

For an example of an adapted agenda see: www.grunderskolen.no and alumni.grunderskolen.no

Cheers
Tore

laurent le cadet

Tuesday 28 September 2004 2:19:21 am

Hi Torre,

I managed to reproduce the calendar as you did on alumni.grunderskolen.no by including Stefano template in a pagelayout. First step (Champaign !).
But I have few problems :

- I can't print out the result (content/view/full/...).
Stefano told about a fetch instruction that way :

{let temp_ts=makedate( $view_parameters.month, $view_parameters.day, $view_pa
rameters.year )
events=fetch( 'content', 'list', hash( 'parent_node_id', 247,
'attribute_filter',
array( 'and',
array( 'event/date_from', '<=', $temp_ts
),
array( 'event/date_to', '>=', $temp_ts )
) ) ) }

...but I don't know how to use it.

- The previous/next buttons jump to the home page

- All the days of the current month between the first event and the end of the month are show as a link (even if there is no event).

I'm lost a little...

laurent le cadet

Tuesday 28 September 2004 8:06:10 am

headhach...

I stuck on printing out the agenda result, what and where ?

<b>"Create a new override for results"</b> <i>Stefano</i>

I tryed turning on the debug to print which template is call to display the result of the agenda event but no info.
I tested wiew/full or line whithout ant result.

May I have some help or where can I fund a more consistent doc ?

It's a case of emergency before a nervous breakdown...(look at me on your right)

Laurent

Tore Skobba

Wednesday 29 September 2004 2:32:07 am

You need to do an node override in order to display the agenda template code.. I.e in:

settings/siteaccess/YOURDESIGN/override.ini.append

add something like this:
[agenda]
Source=node/view/full.tpl
MatchFile=node/view/agenda.tpl
Subdir=templates
Match[node]=NODE_NUMBER , the node number of the content object which holds all the calendar events

laurent le cadet

Wednesday 29 September 2004 3:16:11 am

Hello Tore,

It was already done (full and line) but without the node ID...I add the line, claer all caches, but no way :(

Actually :

- the agenda display links from the first event record with the date_from attribute till the end of the month.
- the links relative to the day I created events (not the date_from attribute) show agenda view as lines
- previous/next buttons jump to the home page

It's a new step (line view) but still not really efficient.

Do you have another idea ?

Laurent.

laurent le cadet

Wednesday 10 November 2004 10:58:16 am

Hi (and sorry) to be back again,

I stopped for a while the site I work on (I was making a CD-ROM), and I'm back again with the calendar V1.

I feel very stupid and frustrate that I can't not achieve this part by myself.
The calendar works very well (date_from, date_to) but the I don't know how to write the template which is call.
I tryed this :

{let temp_ts=makedate( $view_parameters.day, $view_parameters.month, $view_parameters.year )
events=fetch( 'content', 'list', hash( 'parent_node_id', 63, 'attribute_filter', array
( 'and', array( 'agenda/date_from', '<=', $temp_ts), array( 'agenda/date_to', '>=', $temp_ts ) ) ) ) }
{section name=eventsLoop loop=$events}

{node_view_gui view=element content_node=$eventsLoop:item}

{/section}
{$temp_ts}
{/let}

You can see I try also to print out $temp_ts but it's only = "-1"...

Someone can copy/paste here his own .tpl ?

Thanks.

Laurent

Bjarte Lunde

Thursday 13 January 2005 7:06:10 am

Hi Laurent...

I'm working with adapting this template myself.
I want the week to start on monday.

Here is the code i'm using to show the contents of an event:

{let counter=0 
temp_ts=makedate( $view_parameters.month, $view_parameters.day, $view_parameters.year)
events=fetch( 'content', 'list', hash( 'parent_node_id', 880, 
'attribute_filter',array( 'and',array( 'event/date_from', '<=', $temp_ts),array('event/date_to', '>=',$temp_ts )) ) ) }

{section loop=$:events}
{set counter=$:counter|inc}
<h2>{$:item.object.data_map.title.content|wash}</h2>
{$:item.object.data_map.body.content.output.output_text}
{/section}
{/let}

My body field is a XML Text field. You might need to modify this a bit.

eZ debug

Timing: Jan 20 2025 03:16:07
Script start
Timing: Jan 20 2025 03:16:07
Module start 'content'
Timing: Jan 20 2025 03:16:09
Module end 'content'
Timing: Jan 20 2025 03:16:09
Script end

Main resources:

Total runtime1.6008 sec
Peak memory usage4,096.0000 KB
Database Queries222

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 589.6016180.7344
Module start 'content' 0.00751.4122 770.3359736.3359
Module end 'content' 1.41970.1810 1,506.6719348.3516
Script end 1.6007  1,855.0234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.2575210.0002
Check MTime0.00170.1035210.0001
Mysql Total
Database connection0.00090.055210.0009
Mysqli_queries1.491593.17312220.0067
Looping result0.00230.14562200.0000
Template Total1.565697.820.7828
Template load0.00220.137820.0011
Template processing1.563497.663220.7817
Template load and register function0.00010.006210.0001
states
state_id_array0.00190.118810.0019
state_identifier_array0.00260.162020.0013
Override
Cache load0.00200.1272990.0000
Sytem overhead
Fetch class attribute can translate value0.00150.093150.0003
Fetch class attribute name0.00110.0708130.0001
XML
Image XML parsing0.00170.106850.0003
class_abstraction
Instantiating content class attribute0.00010.0034190.0000
General
dbfile0.00420.2628340.0001
String conversion0.00000.000430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
8content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
26content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
11content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 62
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs