News:

Wondering if this will always be free?  See why free is better.

Main Menu

Automatically update age each year html

Started by njtweb, September 13, 2019, 01:37:37 PM

Previous topic - Next topic

njtweb

Is this possible in html, jquery or javascript?

I have hockey player profile pages with their birth date and age. It's all hard coded with no automation. I'd like the ages on each profile page to update per their listed birth date each successive year. This way I don't have to constantly go back and update manually.

Is this possible?

Thank you

Illori

i thought it did this automatically in SMF as long as the year is filled in for their birthday.

njtweb

Quote from: Illori on September 13, 2019, 01:45:43 PM
i thought it did this automatically in SMF as long as the year is filled in for their birthday.

Hi Illori, I have Tinyportal pages. Ex. in the middle of this player profile page is the players birth year and age. I'd like the players age to automatically update each year thereafter on it's own without me having to go back and manually edit from 13 to 14.

https://www.youthhockeyinfo.com/index.php?page=54

Illori

you would need to use php instead of HTML if you want that auto updated. you could look at the code for the profile and modify that to show what you want.

even possibly looking at a staff mod may help you with what you want.

njtweb

Quote from: Illori on September 13, 2019, 02:00:21 PM
you would need to use php instead of HTML if you want that auto updated. you could look at the code for the profile and modify that to show what you want.

even possibly looking at a staff mod may help you with what you want.

Ok, thank you. I've been scouring google and I've found a few Java script instructions for the html but no actual script to download. I should also note, I can't use PHP pages because they have problems posting on social media.

Illori

they should not have a problem posting on social media... SMF itself is php so it would have an issue. maybe if you explained the issue a solution could be offered.

njtweb

Quote from: Illori on September 13, 2019, 02:12:16 PM
they should not have a problem posting on social media... SMF itself is php so it would have an issue. maybe if you explained the issue a solution could be offered.

It's not TP's php articles, the problem posting php articles from Tinyportal is because of "Optimus". It posts the image and the title but the description shows a block of PHP code. I never followed up with the mod author on that because I don't know PHP anyway. HTML articles post perfectly. Basically all I'm looking for is java code to read the date of birth for the player profile and the age will automatically always update when the next year changes. I also don't have any idea how to code php. I can do pretty much anything in HTML.

Mick.

Not sure if it would stay recorded. Doubt it. Have a look here
https://codepen.io/tipsoftheday/pen/hwFde after I input my birthday 3/4/1971 it showed my age. I tried to refresh the page with my phone but it didnt. No idea if input stays recorded. Like Illori said, php is the way to go.

Pipke

if i where you then i should making more profile fields (https://wiki.simplemachines.org/smf/How_to_use_Advanced_Profile_Fields)  and enter there info in there, after that you can create a costum action page (https://wiki.simplemachines.org/smf/Add_a_custom_action) , and retrieve the data to that costum action with global vars and load the users data and place it on that page.


$id = xx;

loadMemberData($id);
loadMemberContext($id);


"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

njtweb

Quote from: Mick. on September 14, 2019, 09:25:08 AM
Not sure if it would stay recorded. Doubt it. Have a look here
https://codepen.io/tipsoftheday/pen/hwFde after I input my birthday 3/4/1971 it showed my age. I tried to refresh the page with my phone but it didnt. No idea if input stays recorded. Like Illori said, php is the way to go.

Hi Mick,

I get an error 502 when I browse to that page.

Thank you

njtweb

Quote from: Pipke on September 14, 2019, 02:35:32 PM
if i where you then i should making more profile fields (https://wiki.simplemachines.org/smf/How_to_use_Advanced_Profile_Fields)  and enter there info in there, after that you can create a costum action page (https://wiki.simplemachines.org/smf/Add_a_custom_action) , and retrieve the data to that costum action with global vars and load the users data and place it on that page.


$id = xx;

loadMemberData($id);
loadMemberContext($id);


My player profiles are built in Tinyportal HTML articles, not SMF topics.

Advertisement: