Forums

Can't get "Custom display type" to work

JvdStel 25 Apr, 2015
Where "Table display type" works just fine, I can't get the "Custom display type" version to work. Not even for the same table, same Model. Can someone tell me what I am missing?

here's what I have:
I have a simple table holding base data for members of the local footbal club. I have created a Model1 called "Leden". In the model I have set a condition as follows:

<?php
$Naam = JRequest::getVar('Achternaam', '' , 'post');
$Status = JRequest::getVar( 'Status_lidmaatschap', '' , 'post');

if ($Naam){
	if ($Status){
			return array("Achternaam LIKE" => "$Naam%","Status_lidmaatschap =" => "$Status");
	}else{
		return array("Achternaam LIKE" => "$Naam%");
	}
}elseif ($Status){
			return array("Status_lidmaatschap =" => "$Status");
}else{
	return array("Status_lidmaatschap =" => "dummy");
}
?>


Input variables are set in Front List > List display > Custom > Header code.
The same condition seems to work just fine in the Table version. Because a Columns list in Front List > Settings as shown below, gives me the excpected results via Table Display type.

Leden.Achternaam:Achternaam
Leden.Tussenvoegsel:Tussenvoegsel
Leden.Voorletters:Voorletters
Leden.Roepnaam:Roepnaam
Leden.Relatienummer:Nummer
Leden.Status_lidmaatschap:Status


When I try to do the same via Custom Display type via the following code in Front List > List display > Custom > Body code .....

<?php
$i++;
echo "<br>".$i." ".$row->Voorletters." (".$row->Roepnaam.") ".$row->Tussenvoegsel." ".$row->Achternaam." ".$row->Relatienummer;
?>


..... it gives me empty rows. Strange enough 14 empty rows, even if I would expect only 3 based on the data in the table (and shown as such via Table Display type).

I have also tried display in HTML via {Leden.Achternaam}, but that gives me a fatal error:

Fatal error: Cannot use object of type stdClass as array in



WHAT'S WRONG HERE???
JvdStel 25 Apr, 2015
I believe I have solved the issue. Seemed I had an older version of CC5 installed. After I have removed this, the code seems to do what it should be.
This topic is locked and no more replies can be posted.