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. :)
Updater
Started by jclarke, Nov 15 2009 04:15 PM
19 replies to this topic
#1
Posted 15 November 2009 - 04:15 PM
|
|
|
#2
Posted 15 November 2009 - 04:55 PM
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...
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
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 15 November 2009 - 05:09 PM
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
Posted 15 November 2009 - 05:24 PM
it's just a case on how you write the SQL query.
Example for MySQL:
Example for MySQL:
SELECT * FROM events WHERE startdate > CURDATE()
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#5
Posted 15 November 2009 - 05:40 PM
Well, I am not looking at mySQL becuase I have no experience in this way, but is there other alternative codes besides this?
#6
Posted 15 November 2009 - 05:50 PM
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.
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
I study Information Systems at Karlstad University when I'm not on CodeCall
#7
Posted 15 November 2009 - 06:06 PM
would you be able to give me a similar code of this?
#8
Posted 15 November 2009 - 06:09 PM
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
I study Information Systems at Karlstad University when I'm not on CodeCall
#9
Posted 15 November 2009 - 06:28 PM
<?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
Posted 15 November 2009 - 07:00 PM
Ahhh, I'll give that a go :)
#11
Posted 15 November 2009 - 07:02 PM
Sseems not to work unfortunately, no text has been displayed which I should expect :S
#12
Posted 15 November 2009 - 07:05 PM
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
I study Information Systems at Karlstad University when I'm not on CodeCall


Sign In
Create Account


Back to top










