[PHP] Tekst aanpassen op bepaald uur en dag

Gestart doorPublitime13 reacties25 weergaven

14 berichten · pagina 1 van 1

Publitime

Lid · Topicstarter

Berichten
1.031
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hey,

Ik vroeg me af of het mogelijk was om op een bepaalde dag van de de week een tekst te laten plaatsen zonder dat ik op dat bepaald uur dat moet publiceren.

Bijvoorbeeld:
(Op maandag 20u00) The simpsons is nu op tv!

Wie weet hoe je dat kan doen en wie kan me helpen?

Alvast bedankt! smile
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Cronjob ofzo zou je kunnen gebruiken
0
Berichten
35.796
Reputatie
1
Punten
0,00
Lid sinds
Laatst gezien
Of de begin- en eindtijd en je berichtje in een database stoppen en op de pagina zelf controleren welk berichtje dan moet hebben.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]"Mon2000"[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De Simpsons is nu op TV!![/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Remi

Lid

Berichten
1.270
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Luukvdo schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]"Mon2000"[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De Simpsons is nu op TV!![/COLOR][COLOR= #007700];
}[/COLOR]
?>
Ja, maar als het voor nieuws is word hij alleen toegevoegd als iemand om 20.00 precies de site bezoekt, en om 20.01 niet meer.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Remi schreef:
Eerdere citaten tonen
Luukvdo schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]"Mon2000"[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De Simpsons is nu op TV!![/COLOR][COLOR= #007700];
}[/COLOR]
?>
Ja, maar als het voor nieuws is word hij alleen toegevoegd als iemand om 20.00 precies de site bezoekt, en om 20.01 niet meer.

Klopt, maar:
Publitime schreef:
(Op maandag 20u00)
Als het van 20.00 tot 21.00 moet zijn:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DH"[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]"Mon20"[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De Simpsons is nu op TV!![/COLOR][COLOR= #007700];
}[/COLOR]
?>


Als het van 20.00 tot (bijv.) 20.30 moet zijn:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #DD0000]"Mon2000"[/COLOR][COLOR= #007700]) && ([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) <=[/COLOR] [COLOR= #DD0000]"Mon2030"[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De Simpsons is nu op TV!![/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Remi

Lid

Berichten
1.270
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En hij moet het eenmalig posten he, niet dat het bij iedere hit opnieuw gepost word lijkt me yummie
0
Publitime

Lid · Topicstarter

Berichten
1.031
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bedankt voor jullie hulp ik zal het zeker eens proberen! smile
0
Publitime

Lid · Topicstarter

Berichten
1.031
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb het nu uitgebreid getest ma het blijkt toch niet ideaal te zijn winkZo werkt een tekst die moet duren van maandag 20u55 tot woensdag 20u55 niet.

Alles werkt zolang het maar op dezelfde dag gebeurt! Iemand een oplossing hiervoor? wink
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Wel waardes aanpassen dan:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #DD0000]"Mon2000"[/COLOR][COLOR= #007700]) && ([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) <=[/COLOR] [COLOR= #DD0000]"Wed2030"[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De Simpsons is nu op TV!![/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Werkt:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #DD0000]"Mon2055"[/COLOR][COLOR= #007700]) && ([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"DHi"[/COLOR][COLOR= #007700]) <=[/COLOR] [COLOR= #DD0000]"Wed2055"[/COLOR][COLOR= #007700])) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je blaat hier[/COLOR][COLOR= #007700];
}[/COLOR]
?>


?
0
Publitime

Lid · Topicstarter

Berichten
1.031
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het is de bedoeling om een heel grote tekst te updaten elke dag, want ik ben zon 3 dagen weg en dat moet dringend gebeuren smile Als ik dat probeer te doen met dat scriptje krijg ik na 2 dagen al een melding van programeerfout redface Terwijl alles wel klopt hoor..
0
Publitime

Lid · Topicstarter

Berichten
1.031
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nah bumpje dan maar smile Het is echt zeer dringend want ik kan geen 200 bezoekers per dag in steek late smile
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"N-H-i"[/COLOR][COLOR= #007700]) >=[/COLOR] [COLOR= #DD0000]"1-20-55"[/COLOR][COLOR= #007700]) && ([/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"N-H-i"[/COLOR][COLOR= #007700]) <=[/COLOR] [COLOR= #DD0000]"3-20-55"[/COLOR][COLOR= #007700])) {[/COLOR] [COLOR= #FF8000]//Bij N: 1 = maandag, 2= dinsdag enz.[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Je blaat hier[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren