value minus value

More
12 years 3 months ago #42662 by ggppdk
Replied by ggppdk on topic value minus value
Hello

for category layout of blog template

edit
category_items.php
category_items_html5.php

-- 1 --
Add a new column title:
Code:
<th scope="col"><?php echo JText::_('My column title'); ?></th>

Add above code
before or after:
<?php foreach ($columns as $name => $label) : ?>
<th id="field_<?php echo $name; ?>" scope="col"><?php echo $label; ?></th>
<?php endforeach; ?>




-- 2 --
Add the data:
Code:
<?php $field_id1 = 55; $field_id2 = 55; $flds_arr = & $item->fieldvalues; echo $flds_arr[$field_id2][0] - $flds_arr[$field_id1][0];

Add the above
before:
<!-- BOF item fields -->
or after:
<!-- EOF item fields -->


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #42745 by days of summer
Replied by days of summer on topic value minus value
i used it and i worked well
thanks Mr ggppdk (Y) (Y) (Y)
it was not shown inside the table
so i added a
<td></td> tag
before and after and it works well now !

can i ask another question please ...
is it possible to show the sum of their values ?

you taught me how to do that when i deal with fields

but now i don't know if it is possible to show the sum of the results ؟

this is example of what i mean

this is the column ( you helped me with )
it has its values under it



can i show the sum of them in the category view ?

many thanks

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #42748 by ggppdk
Replied by ggppdk on topic value minus value
Hello

this is very easy to do for a developer

it is a calculation inside a loop and display of it, after loop ends

inside ITEM (row) loop do
(and just after the loop that creates the columns of a each row), thus after:
<?php foreach ($columns as $name => $label) : ?>
<th id="field_<?php echo $name; ?>" scope="col"><?php echo $label; ?></th>
<?php endforeach; ?>


add:
Code:
if ( !isset($earn_sum) ) $earn_sum = (int)$flds_arr[$field_id2][0] - (int)$flds_arr[$field_id1][0]; else $earn_sum += (int)$flds_arr[$field_id2][0] - (int)$flds_arr[$field_id1][0];

and after foreach of item loop (will look like):
Code:
<?php endforeach; ?> </tbody> </table>
alter above to insert a:
Code:
<?php endforeach; ?> <tr> <td colspan="<?php echo count($columns)+1;?>"></td> <td><?php echo $earn_sum; ?></td> </tr> </tbody> </table>

just such questions,
despite not being difficult it takes some time to answer, and are neither bug nor configuration questions , but we will have a special subscription soon for everything,

except for bug reporting (and fixing which will be free)

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #42751 by days of summer
Replied by days of summer on topic value minus value
thanks for your reply Mr ggppdk

i don't know what to do
these codes will replace the codes we used before ?
or i should put them with it ?

i tried to follow the steps
it showed a new row in the bottom of the table
but with no results inside it :s

and i tried to write a new text echo it appeared normally !

i have made so edits to the code
i add
<?php ?> tag to
Code:
if ( !isset($earn_sum) ) $earn_sum = (int)$flds_arr[$field_id2][0] - (int)$flds_arr[$field_id1][0]; else $earn_sum += (int)$flds_arr[$field_id2][0] - (int)$flds_arr[$field_id1][0];

and added it just after
Code:
<?php foreach ($columns as $name => $label) : ?> <th id="field_<?php echo $name; ?>" scope="col"><?php echo $label; ?></th> <?php endforeach; ?>

and before this line
Code:
<th scope="col"><?php echo JText::_('My column title'); ?></th>

is that right ?

and i am really thankful Mr ggppdk
and i hope the subscription is not very expensive so that i can join it

by the way
i have made some custom templates for flexicontent category and i will share them as soon as possible

thanks :)

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #42763 by ggppdk
Replied by ggppdk on topic value minus value
Hello

please answer my PM with a PM,

(you seem to have forgotten to add this)
Code:
<tr> <td colspan="<?php echo count($columns)+1;?>"></td> <td><?php echo $earn_sum; ?></td> </tr>

the above code should work, it might need a correction but it is what you need

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #42765 by days of summer
Replied by days of summer on topic value minus value
i have replied
thanks Mr ggppdk

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save