test
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • betty118 Friend
    #188869

    Hi,
    I have create one group extra fields with some fields.
    In my articlesdo not need to fill in all fields..but when I preview my article I see the empty fields.
    How can I solved it?
    Thanks

    HeR0 Friend
    #498766

    Hi Betty,

    It depends on layout of item in the template – which is active. If you open file item.php, you could find code block to display extra field

    <?php foreach ($this->item->extra_fields as $key=>$extraField): ?>

    <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
    <?php if($extraField->type == 'header'): ?>
    <h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
    <?php else: ?>
    <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
    <span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
    <?php endif; ?>
    </li>

    then you need to change it to

    <?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
    <?php if($extraField->value != ''): ?>
    <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
    <?php if($extraField->type == 'header'): ?>
    <h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
    <?php else: ?>
    <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
    <span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
    <?php endif; ?>
    </li>
    <?php endif; ?>

    for hide extra fields which has value null

    Hope this helps.

    Regards

    betty118 Friend
    #498814

    I thank’s for you reply.
    Where can I find “item.php” ?
    Thank’s

    betty118 Friend
    #498851

    I have try “item.php” on my folder template but nothing, so I have search on k2searchcomponent’s folder, but nothing..
    Where can I find this file?
    Thank’s so much

    betty118 Friend
    #498901

    Can you help me?:((

    HeR0 Friend
    #498986

    Dear,

    Sorry for late reply. In the your site, if you have not overridden k2 template, you could find item.php file in the components/com_k2/templates/default folder.

    Otherwise, you find it in the templates/template_avtive_name/html/com_k2/default(the k2 active theme) folder.

    Hope this clear to you.

    Regards

    betty118 Friend
    #499067

    Hi
    thanks for your reply. I have find the file in components/com_k2/templates/default folder. but nothing..
    I can see the value null in the web site..why?

    betty118 Friend
    #499073

    <em>@betty118 380810 wrote:</em><blockquote>Hi
    thanks for your reply. I have find the file in components/com_k2/templates/default folder. but nothing..
    I can see the value null in the web site..why?</blockquote>

    Ok the problem is solved.
    I have wirte some text in the value null so the program can’t find the fields null
    thanks the problem is solved

Viewing 8 posts - 1 through 8 (of 8 total)

This topic contains 8 replies, has 2 voices, and was last updated by  betty118 11 years, 4 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum