Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Help with display.template.php

Aloittaja Elisa, lokakuu 28, 2004, 08:03:43 AP

« edellinen - seuraava »

Elisa

I would want to modify the file display.template.php so as to to see in the post, beyond to avatar, number of post... also the age.  How I can make?  I have found this mod that it allows to see the location, but do not succeed to modify it.  Someone can help me?

                // Show their location?
            if (!empty($message['member']['location']))
                echo 'Residenza:
                        ', $message['member']['location'], '<br />
                  <br />';

Kirby

So.. you want it to show the age of the member in topic view?

Add:

            // Age
            if (!empty($message['member']['birthdate]))
                echo 'Age:
                        ', $message['member']['biirthdate'], '<br />
                  <br />';

This will only show the birth date, in order to add age you have to modify the main sources I think...

Elisa

Therefore the modification does not work.  And a way however we must be, because in the summary of the profile it does not appear the date of birth but the age. Thanks the same one!

Jerry

well you could open up your profile template and find were it shows the age and copy it ?  :-\


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Kirby

I'm not sure, I never saw it in Load.php (not sure though)

[Unknown]

I believe the problem is you have too many is in "biirthdate" :P.

-[Unknown]

Elisa

Obviously Unknown, I have written 'birthdate' and I have added the ' that it lacks but the same one does not work.... tanks.

[Unknown]

Well, excuse me for trying to be helpful.  Gosh.

It's actually birth_date...

-[Unknown]

Elisa

#8
You can write the exact code to me, that it works?
I then would want to see the age, not the birth date and obviously only if the customer has compiled the field.  Hour I see also the zero: 0000-00-00

And... what is Gosh? I speak little little english, and excuse me if you he seems that I have to you offended, but I have read a little irony in your participation, while I have need of aid because I do not know to program.


Peter Duggan

Lainaus käyttäjältä: Elisa - lokakuu 29, 2004, 07:58:25 AP
And... what is Gosh?

Basically just a harmless exclamation (although it seems to have originated as a mild substitute for 'God'), so don't worry about that.

Lainaa
I speak little little english, and excuse me if you he seems that I have to you offended, but I have read a little irony in your participation, while I have need of aid because I do not know to program.

While I can't speak for [Unknown], I think you'll find this exclamation to have been directed at himself (not you) for correcting 'biirthdate' to 'birthdate' instead of 'birth_date'! ;)

Elisa


Tank you very much. And for this?!

Lainaus käyttäjältä: Elisa - lokakuu 29, 2004, 07:58:25 AP
You can write the exact code to me, that it works?
I then would want to see the age, not the birth date and obviously only if the customer has compiled the field.  Hour I see also the zero: 0000-00-00

Jerry

I think you wanted this?

            // Age
            if (!empty($message['member']['birth_date']))
                echo 'Age:
                        ', $message['member']['birth_date'], '<br />
                  <br />';
I am not sure but I think thats what unkown meant by the birth_date thing.


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Elisa

Not, therefore I see the date of birth, while I want to read the age, like in the summary of the profile.  :(

Jerry

#13
How about             // Age
            if (!empty($message['member']['age']))
                echo 'Age:
                        ', $message['member']['age'], '<br />
                  <br />';
I took $context['member']['age'] from the profile template :-\ not sure if it works, maybe I should try it myslef. . .

didn't work. . . :(


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Jerry

#14
Add this instead
  // Set the age...
if (!empty($message['member']['birth_date']))
{
list ($birth_year, $birth_month, $birth_day) = sscanf($message['member']['birth_date'], '%d-%d-%d');
$datearray = getdate(forum_time());
$message['member'] += array(
'age' => empty($birth_year) ? $txt[470] : $datearray['year'] - $birth_year - (($datearray['mon'] > $birth_month || ($datearray['mon'] == $birth_month && $datearray['mday'] >= $birth_day)) ? 0 : 1),
'today_is_birthday' => $datearray['mon'] == $birth_month && $datearray['mday'] == $birth_day
);
}
            // Age
            if (!empty($message['member']['age']))
                echo 'Age:
                        ', $message['member']['age'], '<br />
                  <br />';
that worked for my forum :)


- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Elisa

Hour it works!!!!!!!!!!!  Thanks!!!!!!!!!!!!!!!!!!!!  You are my salvation!

Jerry



- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Advertisement: