dynamisch menu voor editten van pagina's
voor mijn eigen cms heb ik een edit pagina aangemaakt voor de artikelen op de voorpagina, het bericht wat je wil aanpassen kun je selecteren om hem daarna te kunnen editten. maar het lukt me niet om het juiste "id" te editten want hij stuurt me door naar de titel van de pagina ipv het id!
Hier onder de code.. Wan doe ik fout?? al vast bedankt!
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php require_once('../Connections/***.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO content (voorpagina, `Voorpagina titel`) VALUES (%s, %s)",
GetSQLValueString($_POST['voorpagina'], "text"),
GetSQLValueString($_POST['Voorpagina_titel'], "text"));
mysql_select_db($database_RCM, $RCM);
$Result1 = mysql_query($insertSQL, $RCM) or die(mysql_error());
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE content SET paginaid=%s, `Voorpagina titel`=%s WHERE voorpagina=%s",
GetSQLValueString($_POST['paginaid'], "int"),
GetSQLValueString($_POST['Voorpagina_titel'], "text"),
GetSQLValueString($_POST['voorpagina'], "text"));
mysql_select_db($database_RCM, $RCM);
$Result1 = mysql_query($updateSQL, $RCM) or die(mysql_error());
$updateGoTo = "editfrontpage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_RCM, $RCM);
$query_frontpage = "SELECT paginaid, voorpagina, `Voorpagina titel` FROM content";
$frontpage = mysql_query($query_frontpage, $RCM) or die(mysql_error());
$row_frontpage = mysql_fetch_assoc($frontpage);
$totalRows_frontpage = mysql_num_rows($frontpage);
?>
<?php include("configuration.php"); ?>
<?php echo "<link rel=\"stylesheet\" href=\"$GLOBALS[mosConfig_live_site]/test/css/template_css.css\" type=\"text/css\"/>" ; ?>
<html>
<head>
<script language="javascript" type="text/javascript" src="../tinyfck/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
<!--
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
template_external_list_url : "example_template_list.js"
});
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Paginaid:</td>
<td><select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="" <?php if (!(strcmp("", $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>>selecteer</option><?php
do {
?>
<option value="<?php echo $row_frontpage['paginaid']?>"<?php if (!(strcmp($row_frontpage['paginaid'], $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_frontpage['Voorpagina titel']?></option>
<?php
} while ($row_frontpage = mysql_fetch_assoc($frontpage));
$rows = mysql_num_rows($frontpage);
if($rows > 0) {
mysql_data_seek($frontpage, 0);
$row_frontpage = mysql_fetch_assoc($frontpage);
}
?>
</select> </td>
<tr>
<tr valign="baseline">
<td nowrap align="right">Voorpagina titel:</td>
<td><input type="text" name="Voorpagina_titel" value="<?php echo $row_frontpage['Voorpagina titel']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top">Voorpagina:</td>
<td><textarea name="voorpagina" cols="90" rows="5"><?php echo $row_frontpage['voorpagina']; ?></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input name="Submit" type="submit" value="Update content">
<label>
<input type="reset" name="Submit2" value="Opnieuw">
</label></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="voorpagina" value="<?php echo $row_frontpage['voorpagina']; ?>">
</form>
<p> </p>
<?php
mysql_free_result($frontpage);
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO content (voorpagina, `Voorpagina titel`) VALUES (%s, %s)",
GetSQLValueString($_POST['voorpagina'], "text"),
GetSQLValueString($_POST['Voorpagina_titel'], "text"));
mysql_select_db($database_RCM, $RCM);
$Result1 = mysql_query($insertSQL, $RCM) or die(mysql_error());
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE content SET paginaid=%s, `Voorpagina titel`=%s WHERE voorpagina=%s",
GetSQLValueString($_POST['paginaid'], "int"),
GetSQLValueString($_POST['Voorpagina_titel'], "text"),
GetSQLValueString($_POST['voorpagina'], "text"));
mysql_select_db($database_RCM, $RCM);
$Result1 = mysql_query($updateSQL, $RCM) or die(mysql_error());
$updateGoTo = "editfrontpage.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_RCM, $RCM);
$query_frontpage = "SELECT paginaid, voorpagina, `Voorpagina titel` FROM content";
$frontpage = mysql_query($query_frontpage, $RCM) or die(mysql_error());
$row_frontpage = mysql_fetch_assoc($frontpage);
$totalRows_frontpage = mysql_num_rows($frontpage);
?>
<?php include("configuration.php"); ?>
<?php echo "<link rel=\"stylesheet\" href=\"$GLOBALS[mosConfig_live_site]/test/css/template_css.css\" type=\"text/css\"/>" ; ?>
<html>
<head>
<script language="javascript" type="text/javascript" src="../tinyfck/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
<!--
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
template_external_list_url : "example_template_list.js"
});
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Paginaid:</td>
<td><select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="" <?php if (!(strcmp("", $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>>selecteer</option><?php
do {
?>
<option value="<?php echo $row_frontpage['paginaid']?>"<?php if (!(strcmp($row_frontpage['paginaid'], $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_frontpage['Voorpagina titel']?></option>
<?php
} while ($row_frontpage = mysql_fetch_assoc($frontpage));
$rows = mysql_num_rows($frontpage);
if($rows > 0) {
mysql_data_seek($frontpage, 0);
$row_frontpage = mysql_fetch_assoc($frontpage);
}
?>
</select> </td>
<tr>
<tr valign="baseline">
<td nowrap align="right">Voorpagina titel:</td>
<td><input type="text" name="Voorpagina_titel" value="<?php echo $row_frontpage['Voorpagina titel']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top">Voorpagina:</td>
<td><textarea name="voorpagina" cols="90" rows="5"><?php echo $row_frontpage['voorpagina']; ?></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input name="Submit" type="submit" value="Update content">
<label>
<input type="reset" name="Submit2" value="Opnieuw">
</label></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="voorpagina" value="<?php echo $row_frontpage['voorpagina']; ?>">
</form>
<p> </p>
<?php
mysql_free_result($frontpage);
?>
Gewijzigd op 01/01/1970 01:00:00 door Rick steenbergen
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
<option value="" <?php if (!(strcmp("", $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>>selecteer</option><?php
do {
?>
<option value="<?php echo $row_frontpage['paginaid']?>"<?php if (!(strcmp($row_frontpage['paginaid'], $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_frontpage['Voorpagina titel']?></option>
<?php
} while ($row_frontpage = mysql_fetch_assoc($frontpage));
$rows = mysql_num_rows($frontpage);
if($rows > 0) {
mysql_data_seek($frontpage, 0);
$row_frontpage = mysql_fetch_assoc($frontpage);
}
?>
</select>
<option value="" <?php if (!(strcmp("", $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>>selecteer</option><?php
do {
?>
<option value="<?php echo $row_frontpage['paginaid']?>"<?php if (!(strcmp($row_frontpage['paginaid'], $row_frontpage['paginaid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_frontpage['Voorpagina titel']?></option>
<?php
} while ($row_frontpage = mysql_fetch_assoc($frontpage));
$rows = mysql_num_rows($frontpage);
if($rows > 0) {
mysql_data_seek($frontpage, 0);
$row_frontpage = mysql_fetch_assoc($frontpage);
}
?>
</select>
@Rick: * Bumpen * mag pas na 24 uur.
Gesloten wegens dubbelpost