Forums / Setup & design / get class id for search from content browse

get class id for search from content browse

Author Message

David Suela

Monday 16 October 2006 6:54:32 am

Hi!

I need to add search function to the content browse admin of an object relation attribute. Everything ok, except that i can't filter search by class id. The $browse variable have the class name, but not the class_id of the object relation. How can i get the class_id of the object relation?

For example, if i can only relation objects of class foo, i have to search all objects, i can't only search for foo objects.

Thanks in advance,

David.

xsto.info <el acceso a la información>
http://xsto.info
http://dominios.coop

Kristof Coomans

Tuesday 17 October 2006 12:06:57 am

Hello David

Are you using $browse.class_array? It indeed is an array with content class identifiers. And the content/search fetch function expects an ID or an array of ID's.

You can loop over the $browse.class_array, fetch the class and build an array with class id's:

{def $classIDList=array()}

{foreach $browse.class_array as $classIdentifier}
  {def $class=fetch('content', 'class', hash( 'class_id', $classIdentifier ))}
    {set $classIDList=$classIDList|append($class.id)}
  {undef $class}
{/foreach}

{* place search code here *}

{undef $classIDList}

Can you share your template when it's finished? That would be a nice contribution ;-)

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

David Suela

Wednesday 18 October 2006 12:44:48 am

Hi!

I'll try your code this week, it's what i looking for, thanks.

I hope to finish (and clean) the template this weekend and then share it. Now the template is a caos of commentaries and loops and ...

Thanks a lot,

David.

xsto.info <el acceso a la información>
http://xsto.info
http://dominios.coop

David Suela

Friday 27 October 2006 9:04:24 am

Hi!

Your solution works perfect. I upload the template to http://ez.no/community/contribs/hacks/search_form_in_admin_content_browse_tpl

One thing more, how can i override this template?

xsto.info <el acceso a la información>
http://xsto.info
http://dominios.coop

Kristof Coomans

Friday 27 October 2006 10:03:14 am

Do you want to replace the default one with yours from inside an extension?

Or do you want to override it when certain conditions are met? See http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_override_conditions content/browse.tpl

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

eZ debug

Timing: Jan 18 2025 11:21:35
Script start
Timing: Jan 18 2025 11:21:35
Module start 'content'
Timing: Jan 18 2025 11:21:35
Module end 'content'
Timing: Jan 18 2025 11:21:35
Script end

Main resources:

Total runtime0.1984 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 587.8438180.8125
Module start 'content' 0.00690.0096 768.656397.9609
Module end 'content' 0.01650.1817 866.6172526.2500
Script end 0.1982  1,392.8672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00371.8892200.0002
Check MTime0.00140.7220200.0001
Mysql Total
Database connection0.00070.370510.0007
Mysqli_queries0.114657.77871410.0008
Looping result0.00130.65351390.0000
Template Total0.181091.210.1810
Template load0.00080.421310.0008
Template processing0.180190.783410.1801
Override
Cache load0.00060.292910.0006
Sytem overhead
Fetch class attribute can translate value0.00120.587610.0012
XML
Image XML parsing0.00020.114510.0002
General
dbfile0.01366.8541200.0007
String conversion0.00000.003430.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.0005 secs