Iedere maand andere afbeelding
Wie weet hier een geschikt script voor?
Zelf heb ik het volgende gevonden
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var mondayimg="../m1.gif"
var tuesdayimg="../m2.gif"
var wednesdayimg="../m3.gif"
var thursdayimg="../m4.gif"
var fridayimg="../m5.gif"
var saturdayimg="../m6.gif"
var sundayimg="../m7.gif"
var mydate=new Date()
var today=mydate.getDay()
if (today==1)
document.write('<img src="'+mondayimg+'">')
else if (today==2)
document.write('<img src="'+tuesdayimg+'">')
else if (today==3)
document.write('<img src="'+wednesdayimg+'">')
else if (today==4)
document.write('<img src="'+thursdayimg+'">')
else if (today==5)
document.write('<img src="'+fridayimg+'">')
else if (today==6)
document.write('<img src="'+saturdayimg+'">')
else
document.write('<img src="'+sundayimg+'">')
//-->
</script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var mondayimg="../m1.gif"
var tuesdayimg="../m2.gif"
var wednesdayimg="../m3.gif"
var thursdayimg="../m4.gif"
var fridayimg="../m5.gif"
var saturdayimg="../m6.gif"
var sundayimg="../m7.gif"
var mydate=new Date()
var today=mydate.getDay()
if (today==1)
document.write('<img src="'+mondayimg+'">')
else if (today==2)
document.write('<img src="'+tuesdayimg+'">')
else if (today==3)
document.write('<img src="'+wednesdayimg+'">')
else if (today==4)
document.write('<img src="'+thursdayimg+'">')
else if (today==5)
document.write('<img src="'+fridayimg+'">')
else if (today==6)
document.write('<img src="'+saturdayimg+'">')
else
document.write('<img src="'+sundayimg+'">')
//-->
</script>
Echter werkt dit slechts met de dagen van de week. Ik heb dan ook iets nodig dat het per maand / of alle dagen van het jaar aanpast.
Alvast bedankt,
Gewijzigd op 01/01/1970 01:00:00 door Erwin Geen
date("z") geeft de dag van het jaar (0 t/m 365)
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var ja="../m1.gif"
var fe="../m2.gif"
var ma="../m3.gif"
var ap="../m4.gif"
var me="../m5.gif"
var ju="../m6.gif"
var jl="../m7.gif"
var au="../m7.gif"
var ok="../m7.gif"
var se="../m7.gif"
var no="../m7.gif"
var de="../m7.gif"
var mydate=new Date()
var month=mydate.getMonth()
if (today==1)
document.write('<img src="'+ja+'">')
else if (today==2)
document.write('<img src="'+fe+'">')
else if (today==3)
document.write('<img src="'+ma+'">')
else if (today==4)
document.write('<img src="'+ap+'">')
else if (today==5)
document.write('<img src="'+me+'">')
else if (today==6)
document.write('<img src="'+ju+'">')
else if (today==7)
document.write('<img src="'+jl+'">')
else if (today==8)
document.write('<img src="'+au+'">')
else if (today==9)
document.write('<img src="'+ok+'">')
else if (today==10)
document.write('<img src="'+se+'">')
else if (today==11)
document.write('<img src="'+no+'">')
else
document.write('<img src="'+de+'">')
//-->
</script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var ja="../m1.gif"
var fe="../m2.gif"
var ma="../m3.gif"
var ap="../m4.gif"
var me="../m5.gif"
var ju="../m6.gif"
var jl="../m7.gif"
var au="../m7.gif"
var ok="../m7.gif"
var se="../m7.gif"
var no="../m7.gif"
var de="../m7.gif"
var mydate=new Date()
var month=mydate.getMonth()
if (today==1)
document.write('<img src="'+ja+'">')
else if (today==2)
document.write('<img src="'+fe+'">')
else if (today==3)
document.write('<img src="'+ma+'">')
else if (today==4)
document.write('<img src="'+ap+'">')
else if (today==5)
document.write('<img src="'+me+'">')
else if (today==6)
document.write('<img src="'+ju+'">')
else if (today==7)
document.write('<img src="'+jl+'">')
else if (today==8)
document.write('<img src="'+au+'">')
else if (today==9)
document.write('<img src="'+ok+'">')
else if (today==10)
document.write('<img src="'+se+'">')
else if (today==11)
document.write('<img src="'+no+'">')
else
document.write('<img src="'+de+'">')
//-->
</script>
Alleen werkt het nog niet. Weet iemand wellicht wat ik fout doe?
Wat werkt er niet en waarom moet dat in javascript?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var ja="../m1.gif"
var fe="../m2.gif"
var ma="../m3.gif"
var ap="../m4.gif"
var me="../m5.gif"
var ju="../m6.gif"
var jl="../m7.gif"
var au="../m7.gif"
var ok="../m7.gif"
var se="../m7.gif"
var no="../m7.gif"
var de="{THEME}/images/topbanner_652x156.jpg"
var mydate=new Date()
var month=mydate.getMonth()
if (today==1)
document.write('<img src="'+ja+'">')
else if (today==2)
document.write('<img src="'+fe+'">')
else if (today==3)
document.write('<img src="'+ma+'">')
else if (today==4)
document.write('<img src="'+ap+'">')
else if (today==5)
document.write('<img src="'+me+'">')
else if (today==6)
document.write('<img src="'+ju+'">')
else if (today==7)
document.write('<img src="'+jl+'">')
else if (today==8)
document.write('<img src="'+au+'">')
else if (today==9)
document.write('<img src="'+ok+'">')
else if (today==10)
document.write('<img src="'+se+'">')
else if (today==11)
document.write('<img src="'+no+'">')
else
document.write('<img src="'+de+'">')
//-->
</script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var ja="../m1.gif"
var fe="../m2.gif"
var ma="../m3.gif"
var ap="../m4.gif"
var me="../m5.gif"
var ju="../m6.gif"
var jl="../m7.gif"
var au="../m7.gif"
var ok="../m7.gif"
var se="../m7.gif"
var no="../m7.gif"
var de="{THEME}/images/topbanner_652x156.jpg"
var mydate=new Date()
var month=mydate.getMonth()
if (today==1)
document.write('<img src="'+ja+'">')
else if (today==2)
document.write('<img src="'+fe+'">')
else if (today==3)
document.write('<img src="'+ma+'">')
else if (today==4)
document.write('<img src="'+ap+'">')
else if (today==5)
document.write('<img src="'+me+'">')
else if (today==6)
document.write('<img src="'+ju+'">')
else if (today==7)
document.write('<img src="'+jl+'">')
else if (today==8)
document.write('<img src="'+au+'">')
else if (today==9)
document.write('<img src="'+ok+'">')
else if (today==10)
document.write('<img src="'+se+'">')
else if (today==11)
document.write('<img src="'+no+'">')
else
document.write('<img src="'+de+'">')
//-->
</script>
Dus dan zou er nu een afbeelding moeten verschijnen aangezien het december is, maar dit wordt niet getoond. Verder moet het in javascript omdat ik het script in een .tpl bestand wil hebben en hierin geen php opties kan hebben.
Smarty kan wel php in het .tpl bestand laten uitvoeren.
En als je JS wilt kan je dit gebruiken:
En als je JS wilt kan je dit gebruiken:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var ja="../m1.gif"
var fe="../m2.gif"
var ma="../m3.gif"
var ap="../m4.gif"
var me="../m5.gif"
var ju="../m6.gif"
var jl="../m7.gif"
var au="../m7.gif"
var ok="../m7.gif"
var se="../m7.gif"
var no="../m7.gif"
var de="{THEME}/images/topbanner_652x156.jpg"
var mydate=new Date()
var today=mydate.getMonth()+ 1
if (today==1)
document.write('<img src="'+ja+'">')
else if (today==2)
document.write('<img src="'+fe+'">')
else if (today==3)
document.write('<img src="'+ma+'">')
else if (today==4)
document.write('<img src="'+ap+'">')
else if (today==5)
document.write('<img src="'+me+'">')
else if (today==6)
document.write('<img src="'+ju+'">')
else if (today==7)
document.write('<img src="'+jl+'">')
else if (today==8)
document.write('<img src="'+au+'">')
else if (today==9)
document.write('<img src="'+ok+'">')
else if (today==10)
document.write('<img src="'+se+'">')
else if (today==11)
document.write('<img src="'+no+'">')
else
document.write('<img src="'+de+'">')
//-->
</script>
<!--
<!--Week Of The Day Image Displayer script- By JavaScript Kit (www.javascriptkit.com) More free scripts here-->
var ja="../m1.gif"
var fe="../m2.gif"
var ma="../m3.gif"
var ap="../m4.gif"
var me="../m5.gif"
var ju="../m6.gif"
var jl="../m7.gif"
var au="../m7.gif"
var ok="../m7.gif"
var se="../m7.gif"
var no="../m7.gif"
var de="{THEME}/images/topbanner_652x156.jpg"
var mydate=new Date()
var today=mydate.getMonth()+ 1
if (today==1)
document.write('<img src="'+ja+'">')
else if (today==2)
document.write('<img src="'+fe+'">')
else if (today==3)
document.write('<img src="'+ma+'">')
else if (today==4)
document.write('<img src="'+ap+'">')
else if (today==5)
document.write('<img src="'+me+'">')
else if (today==6)
document.write('<img src="'+ju+'">')
else if (today==7)
document.write('<img src="'+jl+'">')
else if (today==8)
document.write('<img src="'+au+'">')
else if (today==9)
document.write('<img src="'+ok+'">')
else if (today==10)
document.write('<img src="'+se+'">')
else if (today==11)
document.write('<img src="'+no+'">')
else
document.write('<img src="'+de+'">')
//-->
</script>
Gewijzigd op 01/01/1970 01:00:00 door Erwin Geen
Dank je wel, dit werkt perfect.