Forums / Setup & design / Can not fetch my "home made" objects...

Can not fetch my "home made" objects...

Author Message

Milad P

Tuesday 19 December 2006 8:05:04 am

Hi,

I created a simple class which only contains a textinput. Then i created a folder with several of my new class objects. My problem is when i try to fetch information from that node, i got nothing back. It works if i put some other objects (like article, link, folder etc.) but not my new class?

Why? it seems very strange?

This is the code that i use to fetch my objects. I can not find any problems with the code.


        {def $children_count=fetch('content', 'list_count', hash('parent_node_id', 12785 ) ) }
        {def $children=fetch('content', 'list', hash('parent_node_id', 12785) ) }

        {do}
                {def $nr = rand(0,$children_count)}
        {/do while($children[$nr].object.data_map.name.content|null())}
        <b>{"Did you know that"|i18n('chsmisc')}</b>
        {$children[$nr].object.data_map.name.content}



Claudia Kosny

Wednesday 20 December 2006 1:18:49 am

Hi Milad

Is the problem caused by the fetch functions or by the loop? Do you get any messages in debug output?

You cannot use {def ... in a loop as you can define a variable only once in a template. So you either {undef $nr} in the loop again or you put {def $nr = 0} (or so) before the loop and use {set $nr = ...} in the loop.

Check whether $children_count and $children contain anything. Check whether $children[$nr].object.data_map.name exists (maybe you have a typo in your class definition).

Regarding the loop itself: if you just want to have a random node where the attribute name contains something, it might be more efficient to limit the fetch to these noses using the attribute filter and to use the limit and offset parameter to fetch just one node.

For fetching random content see here:
http://ez.no/community/forum/setup_design/how_to_fetch_random_content_3_8/re_how_to_fetch_random_content_3_8

Claudia

Milad P

Wednesday 20 December 2006 5:58:38 am

Hi again,

The problem is in the fetch line. $children and $children_count contains nothing. $children returns a empty array and $children_count = 0.

//Milad

Claudia Kosny

Wednesday 20 December 2006 1:02:34 pm

Hi Milad

Do you see your custom objects in the admin view under the specified parent node?
If not, you have the wrong parent node.
If yes, I think there is something wrong with either the visibility, the permissions or the translations of your custom objects. So add the following parameters to your fetch parameters:

'ignore_visibility' => true(),
'limitation' => array(),
'only_translated' => false()

Clear the cache and try again. Does that help?

Claudia

Milad P

Thursday 21 December 2006 1:18:57 am

Thank you for your advise. It seems that i have forgot to set the proper permissions for my new object. Problem solved.

eZ debug

Timing: Jan 30 2025 21:31:40
Script start
Timing: Jan 30 2025 21:31:40
Module start 'content'
Timing: Jan 30 2025 21:31:40
Module end 'content'
Timing: Jan 30 2025 21:31:40
Script end

Main resources:

Total runtime0.3571 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0104 587.9531370.2891
Module start 'content' 0.01040.0135 958.24221,005.5469
Module end 'content' 0.02390.3331 1,963.78913,894.4922
Script end 0.3570  5,858.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00511.4224200.0003
Check MTime0.00150.4102200.0001
Mysql Total
Database connection0.00080.222910.0008
Mysqli_queries0.255271.45171410.0018
Looping result0.00150.42821390.0000
Template Total0.332693.110.3326
Template load0.00090.250910.0009
Template processing0.331792.874510.3317
Override
Cache load0.00060.174510.0006
Sytem overhead
Fetch class attribute can translate value0.00160.446910.0016
XML
Image XML parsing0.00020.062710.0002
General
dbfile0.00641.8009200.0003
String conversion0.00000.002030.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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