Forums / Setup & design / Error when searching

Error when searching

Author Message

Kjell Inge Sandvik

Wednesday 31 August 2005 7:55:36 am

Hello again!

I want to make a (simple) searchform, and the template for this is:

{set-block scope=root variable=cache_ttl}0{/set-block}
<div id="mediaSok">
	<div id="tittel"><h2>Mediasøk<img src={"mappeIkon.gif"|ezimage}></h2></div>
	<form action={"/content/advancedsearch/"|ezurl} method="get">
		<input class="inputText" type="text" name="AnyWordSearchText" value="" />
		<select size="1" class="inputSelect" name="SearchContentClassID">
			<option value="-1" selected>Alle medium</option>
			<option value="77">Bilder</option>
			<option value="84">Dokumenter</option>
			<option value="95">Media</option>
		</select>
		<input class="inputSubmit" name="SearchButton" type="submit" value="" />
	</form>
</form>
</div>

When executed, I get a rather ugly error:
<i>Fatal error: Call to a member function on a non-object in /home/mediabase/domains/mediabase.no/public_html/kernel/content/advancedsearch.php on line 129</i>

What is wrong here?

Sandvik Web & Data

Kristof Coomans

Wednesday 31 August 2005 11:48:39 pm

Relevant code in advancedsearch.php:

if ( $http->hasVariable( 'SearchContentClassID' ) and
     $http->variable( 'SearchContentClassID' ) != -1 )
{
    $searchContentClassID = $http->variable( 'SearchContentClassID' );
    $searchContentClass =& eZContentClass::fetch( $searchContentClassID );
    $searchContentClassAttributeArray =& $searchContentClass->fetchSearchableAttributes();
}

I think one of the option values in your template is not a valid content class ID, and eZContentClass::fetch( ) returns false. $searchContentClass is not an object, and you'll get the error.

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

Kjell Inge Sandvik

Thursday 01 September 2005 12:48:04 am

How can I proceed here?

Sandvik Web & Data

Kristof Coomans

Thursday 01 September 2005 12:57:13 am

Check the class ID's of Bilder, Dokumenter and Media.

You can also make the options more dynamic with the following code, if you can assume the class identifiers won't change:

{def $classes=fetch( 'class', 'list', hash( 'class_filter', array( 'bilder', 'dokumenter', 'media' ) ) )}
 
{foreach $classes as $class}
    <option value="{$class.id}">{$class.name|wash}</option>
{/foreach}

{undef $classes}

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

eZ debug

Timing: Jan 31 2025 06:04:05
Script start
Timing: Jan 31 2025 06:04:05
Module start 'content'
Timing: Jan 31 2025 06:04:05
Module end 'content'
Timing: Jan 31 2025 06:04:05
Script end

Main resources:

Total runtime0.2184 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.0053 587.9219180.8438
Module start 'content' 0.00530.0057 768.765697.9766
Module end 'content' 0.01100.2073 866.7422527.2500
Script end 0.2183  1,393.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00331.4978200.0002
Check MTime0.00120.5633200.0001
Mysql Total
Database connection0.00080.381910.0008
Mysqli_queries0.172679.02891410.0012
Looping result0.00120.52991390.0000
Template Total0.207094.810.2070
Template load0.00070.332910.0007
Template processing0.206294.449810.2062
Override
Cache load0.00050.215610.0005
Sytem overhead
Fetch class attribute can translate value0.00080.351710.0008
XML
Image XML parsing0.00030.126010.0003
General
dbfile0.00904.1413200.0005
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