This topic is locked

Select only some field

6/11/2012 9:06:32 AM
PHPRunner General questions
M
maxcolo author

In List Page I have a series of fields (field1,field2,field3.........field70), that you/they contain 1 or zero, it is possible only in List Page to visualize only the fields that contain 1.

Thanks

C
cgphp 6/11/2012

In the "Before display" event of the List page, enter the following code:

$xt->assign('fieldname_fieldheader',$xt->getvar("fieldname_value") == 1);

$xt->assign('fieldname_fieldcolumn',$xt->getvar("fieldname_value") == 1);



Replace fieldname with the real name of the field. If the name of your field is field1 the code will be:

$xt->assign('field1_fieldheader',$xt->getvar("field1_value") == 1);

$xt->assign('field1_fieldcolumn',$xt->getvar("field1_value") == 1);
M
maxcolo author 6/12/2012

Hi Cristian,

no error, but not works

any idea

grazie

C
cgphp 6/12/2012

Post your code. What is the db type field? INT or VARCHAR?

M
maxcolo author 6/14/2012

The Field are INT



$xt->assign('prod1_fieldheader',$xt->getvar("prod1_value") == 1);

$xt->assign('prod1_fieldcolumn',$xt->getvar("prod1_value") == 1);

$xt->assign('prod2_fieldheader',$xt->getvar("prod2_value") == 1);

$xt->assign('prod2_fieldcolumn',$xt->getvar("prod2_value") == 1);

$xt->assign('prod3_fieldheader',$xt->getvar("prod3_value") == 1);

$xt->assign('prod3_fieldcolumn',$xt->getvar("prod3_value") == 1);

$xt->assign('prod4_fieldheader',$xt->getvar("prod4_value") == 1);

$xt->assign('prod4_fieldcolumn',$xt->getvar("prod4_value") == 1);

$xt->assign('prod5_fieldheader',$xt->getvar("prod5_value") == 1);

$xt->assign('prod5_fieldcolumn',$xt->getvar("prod5_value") == 1);

$xt->assign('prod6_fieldheader',$xt->getvar("prod6_value") == 1);

$xt->assign('prod6_fieldcolumn',$xt->getvar("prod6_value") == 1);
C
cgphp 6/14/2012

Make sure prod1 is the real name of the field.

M
maxcolo author 6/14/2012

This is the SQL table



CREATE TABLE IF NOT EXISTS `assortimento` (
`id_cluster` int(11) NOT NULL AUTO_INCREMENT,
`cedec` varchar(50) DEFAULT NULL,
`tipo_cluster` varchar(50) DEFAULT NULL,
`data_umod` varchar(50) DEFAULT NULL,
`field` varchar(50) NOT NULL,
`prod1` int(11) DEFAULT NULL,
`prod2` int(11) DEFAULT NULL,
`prod3` int(11) DEFAULT NULL,
`prod4` int(11) DEFAULT NULL,
`prod5` int(11) DEFAULT NULL,
`prod6` int(11) DEFAULT NULL,
`prod7` int(11) DEFAULT NULL,
`prod8` int(11) DEFAULT NULL,
`prod9` int(11) DEFAULT NULL,
`prod10` int(11) DEFAULT NULL,
`prod11` int(11) DEFAULT NULL,
`prod12` int(11) DEFAULT NULL,
`prod13` int(11) DEFAULT NULL,
`prod14` int(11) DEFAULT NULL,
`prod15` int(11) DEFAULT NULL,
`prod16` int(11) DEFAULT NULL,
`prod17` int(11) DEFAULT NULL,
`prod18` int(11) DEFAULT NULL,
`prod19` int(11) DEFAULT NULL,
`prod20` int(11) DEFAULT NULL,
`prod21` int(11) DEFAULT NULL,
`prod22` int(11) DEFAULT NULL,
`prod23` int(11) DEFAULT NULL,
`prod24` int(11) DEFAULT NULL,
`prod25` int(11) DEFAULT NULL,
`prod26` int(11) DEFAULT NULL,
C
cgphp 6/14/2012

Go to the Visual editor of the List page, switch to html and check if the prod1_fieldheader exists.

M
maxcolo author 6/14/2012

Hi Cristian,
yes exists, I dont' know!!!!



{END data_umod_fieldheadercolumn}{BEGIN prod1_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod1_fieldheader}<A {$prod1_orderlinkattrs}>CROISSANT CLASSICO "Soffice Sfoglia" 6pz

</A>{END prod1_fieldheader}</TH>

{END prod1_fieldheadercolumn}{BEGIN prod2_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod2_fieldheader}<A {$prod2_orderlinkattrs}>CROISSANT CLASSICO "Soffice Sfoglia" 10 pz

</A>{END prod2_fieldheader}</TH>

{END prod2_fieldheadercolumn}{BEGIN prod3_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod3_fieldheader}<A {$prod3_orderlinkattrs}>CROISSANT "Passione" CILIEGIA 6pz

</A>{END prod3_fieldheader}</TH>

{END prod3_fieldheadercolumn}{BEGIN prod4_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod4_fieldheader}<A {$prod4_orderlinkattrs}>CROISSANT "Passione" CILIEGIA 10pz

</A>{END prod4_fieldheader}</TH>

{END prod4_fieldheadercolumn}{BEGIN prod5_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod5_fieldheader}<A {$prod5_orderlinkattrs}>CROISSANT "Cuor" CACAO 6pz </A>{END prod5_fieldheader}</TH>

{END prod5_fieldheadercolumn}{BEGIN prod6_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod6_fieldheader}<A {$prod6_orderlinkattrs}>CROISSANT "Cuor" CACAO 10pz </A>{END prod6_fieldheader}</TH>

{END prod6_fieldheadercolumn}{BEGIN prod7_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod7_fieldheader}<A {$prod7_orderlinkattrs}>CROISSANT "Voglia" ALBICOCCA 6pz

</A>{END prod7_fieldheader}</TH>

{END prod7_fieldheadercolumn}{BEGIN prod8_fieldheadercolumn}<TH class="runner-cc ">

{BEGIN prod8_fieldheader}<A {$prod8_orderlinkattrs}>CROISSANT "Voglia" ALBICOCCA 10pz

</A>{END prod8_fieldheader}</TH>