View Full Version : Updater
benslayton
06-02-2006, 05:46 AM
I fixing to start a site for a friend. He is a musician, and when he has a concert he wants to be able to update the site by himself. He doesnt know anything about html, or anything. So I was wondering, well let's start off with this.
1.Basically I need a some codes, Using DD's WYSIWYG editor (http://www.dynamicdrive.com/dynamicindex16/openwysiwyg/index.htm) to display the text to a page, just something real basic.
EXAMPLE: edit.php is the page with the WYSIWYG editor. when you click save it saves it to index.php. Mostly that's it.
2.When you open up the editor again I need it to show what is already on index.php
* Hope its not too confusing.
* I'm out for tonight. Little late in tennessee.
*Thanks for any help!
I suggest you store concert dates in a database and create a really simple interface.
benslayton
06-02-2006, 11:41 AM
Is it to big of a problem to make?
benslayton
06-02-2006, 02:29 PM
Ok Ok sorry to ask so many questions. Just got tons of ideas going through my head.
But could I not use Djr33's comment board and somehow redo some of the code to do what I need it to do?
djr33
06-02-2006, 05:17 PM
Tell him to LEARN html.
Aside from that...
Sure, just use the comment thing. That does it well enough.
All you'd need to do is leave as is, and take out the part where it gets the current contents of the file and adds them to the new input... so it will replace the old with the new, rather than adding.
Seems like this should work.
Or just write your own...
a database would help.
benslayton
06-06-2006, 07:05 PM
Ok Ive tried every way, but because im very new to php how do I
take out the part where it gets the current contents of the file
Have tried it.
benslayton
06-06-2006, 07:19 PM
ok so far I have it working where there is no name showing and no email.
http://benslayton.awardspace.com
Edit:Please note Im working on it right now. So if it does differently, give it a couple of secs, and it will work.
benslayton
06-06-2006, 07:50 PM
Anyone?
benslayton
06-06-2006, 09:22 PM
Ok, Never mind finally fiqured it out...
But now when I'm on add.php I can click enter on the keyboard and it drops but on the index.php page it doesnt. It just makes spaces. How can I fix that....
djr33
06-06-2006, 09:30 PM
You have a textbox. You need to type html. a <br> will be a line break, whether it's on the same line, or after/before a return.
If you need to be able to do wysiwyg, instal the openwysiwyg editor to it, and be sure to, as I said in another thread, look at my thread at the top of the dd scripts forum for important fixes.
Seems like you mentioned that at the beginning... just didn't do it yet?
benslayton
06-06-2006, 10:36 PM
I tried it it woulnt work right... But I changed it.
benslayton
06-06-2006, 10:47 PM
Ok its up but there is an error here is the add.php code...
<html>
<head>
<title>Add Comment Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript" src="http://www.bellsouthpwp2.net/c/h/christwebs/WYSIWYG/wysiwyg.js">
</script>
</head>
<body>
<div align="center">
<p><font size="+1">Add Comment Demo:</font></p>
<form name="form1" method="post" action="sent.php" onSubmit="forcehtmlmode('textareaname');">
<textarea id="textarea1" name="test1" style="height: 170px; width: 500px;">
<?php
if ($file = @file_get_contents("comments.phpdata")) {
echo $file."\n";
}
else {echo "Sorry, But your page is blank";}
?>
</textarea>
<script language="javascript1.2">
generate_wysiwyg('textarea1');
</script>
</p>
<p>
<input type="submit" id="button" />
</p>
</form> <a href="index.php">Back</a>
</div>
</body>
</html>
You've got one } too many.
benslayton
06-06-2006, 11:02 PM
what?
<?php
if ($file = @file_get_contents("comments.phpdata")) {
echo $file."\n";
}
else {echo "Sorry, But your page is blank";}
?> The red brace has no matching opening brace.
benslayton
06-07-2006, 02:13 AM
well I took it out and it says "
Parse error: parse error, unexpected $ in /home/www/benslayton.awardspace.com/add.php on line 32" so apparently its supp. to be there.
benslayton
06-07-2006, 02:27 AM
Ok I fixed it. the WYSIWYG editor kinda works but the it writes the actual code, and not like bold or color red etc.... Need help.:) :)
djr33
06-07-2006, 03:39 AM
huh?
The wysiwyg editor is supposed to be used on your site so you can use it's functions and it will sent to the next page the code. (Use my fix to make it work if you're in code view instead; otherwise it will just sent as text, not code... hard to explain).
If you choose a color or bold in the editor, it will send as code, like <strong>something</strong> and you just need to implement it on the next page, like you were doing before, where the line break became a space.
benslayton
06-07-2006, 03:44 AM
I tried your fix from the sticky under DD scripts right, and it will not show the Editor at all. Maybe Im not understanding something.:eek:
djr33
06-07-2006, 03:46 AM
Probably.
I think I made it pretty clear in that thread.... not sure what else to say.
Remove/reset it to where it works in the default way, then maybe I can help with the changes I made.
benslayton
06-07-2006, 03:50 AM
Wait I think I just found it. In your fix I was copying and pasting the fix which had "[something]" something to this effect to save on space. Let me change that. I'll tell you how it works out.:) :) :)
djr33
06-07-2006, 04:00 AM
Alright. Glad it's working.
benslayton
06-07-2006, 04:13 AM
Wait no its not working. Here is my codes.....
*index
<html>
<head>
<title>Comment Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
<div align="left">
<table width="80%" border="" cellspacing="0" cellpadding="0">
<tr>
<td align="left">
<?php
if ($file = @file_get_contents("comments.phpdata")) {
echo $file."\n";
}
else {echo "Sorry, but no comments were found.";}
?>
</td>
</tr>
</table>
</div>
<p align="left"><a href="add.php">Add Comment</a></p>
</div>
</body>
</html>
*add.php
<html>
<head>
<title>Add Comment Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript" src="http://www.bellsouthpwp2.net/c/h/christwebs/WYSIWYG/wysiwyg.js">
</script>
</head>
<body>
<div align="center">
<p><font size="+1">Add Comment Demo:</font></p>
<form name="form1" method="post" action="sent.php" onSubmit="formatText('ViewText','comment');">
<textarea name="comment" id="textarea1" cols="60" rows="10"><?php
if ($file = @file_get_contents("comments.phpdata")) {
echo $file."\n";
}
else {echo "Sorry, But your page is blank";}
?></textarea><br>
<script language="javascript1.2">
generate_wysiwyg('textarea1');
</script>
<input type="submit" value="submit">
</form>
<a href="index.php">Back</a>
</div>
</body>
</html>
*Sent.php
<?php
$filename = "comments.phpdata";
if ($name = stripslashes($_POST['comment'])) {
$comment = str_replace("<","<",$comment);
$comment = str_replace(">", ">", $comment);
$file = @fopen($filename, "w+");
@fwrite($file, $comment);
@fclose($file);
$message = "Your comment was successfully added.<br>Redirecting to index.php";
}
else {
$message = "You either entered no data or it was entered incorrectly.<br>Redirecting to index.php";
}
?>
<html>
<head>
<title>Comment Added Demo</title>
<meta http-equiv="refresh" content="3;url=index.php">
</head>
<body>
<div align="center">
<p><font size="+1">Comment Added Demo:</font></p>
<?php echo $message; ?>
</div>
</body>
</html>
365
Maybe you might know what the problem is by looking at these. Please dont give up.:)
Edit:http://benslayton.awardspace.com
djr33
06-07-2006, 04:18 AM
Er... try using this php code instead of what is there right now:
<?php
$filename = "comments.phpdata";
if ($comment = stripslashes($_POST['comment'])) {
$file = @fopen($filename, "w+");
@fwrite($file, $comment);
@fclose($file);
$message = "Your comment was successfully added.<br>Redirecting to index.php";
}
else {
$message = "You either entered no data or it was entered incorrectly.<br>Redirecting to index.php";
}
?>
Note: Yes, remove:
$comment = str_replace("<","<",$comment);
$comment = str_replace(">", ">", $comment);
benslayton
06-07-2006, 04:21 AM
Naw, that doesnt work either. Any other Suggestions?
djr33
06-07-2006, 04:23 AM
I edited, changing a couple things. Make sure you have the newest version.
benslayton
06-07-2006, 04:25 AM
Ok your edit above did work. Thanks!!!:D
One other problem It wont let me add color to the back, text, etc. (to all the popups) any sugg. there?:)
djr33
06-07-2006, 04:26 AM
Popups?
benslayton
06-07-2006, 04:28 AM
Yea, when you click on the background color button, the font color button, the hyperlink button.... They open up popups. But doesnt change the color.
djr33
06-07-2006, 04:29 AM
I just tried quotes.
I also edited (after I posted the last time).... 'cause I figured out what was wrong.
change the if line to:
if ($comment = stripslashes($_POST['comment'])) {
benslayton
06-07-2006, 04:32 AM
ok that works better noticed some change...
See my posts above about the popups..
djr33
06-07-2006, 07:09 AM
Er... use the color thing to change color.
To modify those popups, modify the page in the directory included with the zip file of the pages.
benslayton
06-07-2006, 01:16 PM
I know what pages to modify. The pages that DD gave me in the zip don't work. They will Pop up but they wont change the color. Thats what I need help with...
benslayton
06-07-2006, 06:38 PM
Anyone Hello?:)
Wouldnt this be javascript???
No.
Best way to do it is to use a database.
benslayton
06-07-2006, 09:00 PM
Im takling about modifying the popups so they actually add the stuff.
djr33
06-07-2006, 09:36 PM
Er... which popup? They work just fine.
Change the files if you want to change the look of the popup....
As for changing the color of a link, if that's what you're asking, it's a limited editor... dunno if it allows that. Not a great idea anyway.
benslayton
06-07-2006, 10:13 PM
* The buttons: text color, background color, Insert table, insert picture, and create link, are not doing that.
* They do not add color to the text, color to the background, insert tables, insert pictures, or create links.
* Yes, they do popup just fine...
Im using IE and FF....
benslayton
06-08-2006, 03:53 AM
Ok got some of the stuff fixed.... The background colors, the hyperlink and the table button do not do what they were made to do....(in FF)
(in IE) the text color works, and the table works, but the hyperlink, and the background colors still dont add what they are supp. to.
But the text colors work.
EDIT IN THIS POST
benslayton
06-08-2006, 06:23 AM
Sorry to be so annoying but its really important for me to get this fixed. Please Help.
djr33
06-08-2006, 06:36 AM
Eh, script probly just has issues. I dunno.
The hyperlink and image popup work for me in FF, but not the table thing.
Ah, and the color/bgcolor work too.
Dunno about the popup for tables... cancel closes the window, so JS appears to be working, but submit doesn't do anything.
I'd reupload the file from the original .zip just in case.
I didn't code this, nor did anyone from dynamic drive... it's an outside script. I gave the creator an email a while back, but I didn't get an answer, so he may be quite busy. Anyway, you could try asking him. I think you can follow a link on the script's page to his site or something.
benslayton
06-08-2006, 06:37 AM
Ok thanks. I'll try to email him.:)
djr33
06-08-2006, 06:43 AM
Maybe someone else can help.
But, really, just try uploading the file(s) again. See if that helps anything. It works on my site...
benslayton
06-08-2006, 04:11 PM
Ok I found out that its best used in IE. I reuploaded the files again, and the table works now but the hyperlink doesnt work at all, it just dont add a hyperlink. Well let me go find the your sticked post, I remember something about that in there.
benslayton
06-09-2006, 05:36 PM
Even DD's Demo doesnt add the example. Could that be a bug?:confused:
benslayton
06-09-2006, 06:05 PM
Or I've been trying to use this
// CreateLink
else if (id == "CreateLink") {
//function to insert link
var szURL = prompt("Enter a URL:", "");
try {
//ignore error for blank urls
rteCommand(rte, "Unlink", null);
rteCommand(rte, "CreateLink", szURL);
} catch (e) {
//do nothing
}
}
it pop ups but still doesnt add the link....
I dont care witch way that yall can get it to work, just need it to work...
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.