简体   繁体   中英

php joomla k2 code suggestion

i'm working with k2, the joomla content module. i'm using extra fields and i have a particular need. i associated some link type extra fields to a k2 category: i need them to be invisible to users while they create items from frontend, but then come back visible after i (administrator) filled those fields from backend. so i just need to hide those extrafields (all the link type) from the itemform view: below is the code where i should add something like IF THEN ELSE END but i don't know nothing about php code compiling... can any body suggest something???

CODE:

<table class="admintable" id="extraFields"> 
<?php foreach($this->extraFields as $extraField): ?> 
<tr> 
<td align="right" class="key"> 
<?php echo $extraField->name; ?> 
</td> 
<td> 
<?php echo $extraField->element; ?> 
</td> 
</tr> 
<?php endforeach; ?> 
</table>

Change that code to this -

<table class="admintable" id="extraFields"> 
<?php foreach($this->extraFields as $extraField): ?> 
<?php if ($extrafield->name !="name of field you want to hide") { ?>
<tr> 
<td align="right" class="key"> 
<?php echo $extraField->name; ?> 
</td> 
<td> 
<?php echo $extraField->element; ?> 
</td> 
</tr> 
<?php } ?>
<?php endforeach; ?> 
</table>

Be sure to do it as a template override so it doesn't get killed when you update.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM