Jump to content

Updater

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
19 replies to this topic

#1
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
I am a imediate website designer, and I learn new things for the build of websites, but I would like to find out if there is an code or a tool that updates the date of social event automatically once a month for the specific website I build....


Example


Social night: 27th November 2009 - once this date passes, it automatically takes over to 6th December 2009, without me hard coding it.

Is there a code that does this? I don't care what kind, it can be XML, pHp, CSS, or whatever... but a encouragement and recommendations from you would be much appericated. :)

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
Two ways, either you generate it directly in php selecting everything that is after today's date from your database (which I assume you use for this?)

The other way is that your php generates an xml with the same info, and lets JS and AJAX read it into the page...
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#3
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
Could you give me a similar code? I am not an expert in pHp but willing to learn, and not expert in xml either.... any siimlar code would help! :)

#4
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
it's just a case on how you write the SQL query.
Example for MySQL:
SELECT * FROM events WHERE startdate > CURDATE()

__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#5
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
Well, I am not looking at mySQL becuase I have no experience in this way, but is there other alternative codes besides this?

#6
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
then I can see the option of hard coding a xml file with the data of the events
and a javascript does an ajax on and it, and only reads out those posts who are not passed, that way, you don't have to hard code the events more on change/additions of them at least.

you could also do it as a json file if you wish, what is easiest, I don't know.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#7
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
would you be able to give me a similar code of this?

#8
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
No, not really, as I'm not good at javascript :( Hope someone else hear this
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#9
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
<?PHP
function getDate() {
	$now = date('u', strtotime('now'));
	if($now <= date('u', strtotime('27th November 2009'))) {
		return "concert 1";
	} else if(4now <= date('u', strtotime('6th December 2009'))) {
		return "concert 2";
	}
	return false;
}
?>

Try something like that.

#10
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
Ahhh, I'll give that a go :)

#11
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
Sseems not to work unfortunately, no text has been displayed which I should expect :S

#12
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
it's a function, you need to call it and then treat the return in some way
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall