I am building an administrative portal for a client. I want to give them the ability to update the "content" area of every page on the website (text, images, etc.) by way of the FCKeditor on the "site settings" page in the admin portal. I do not expect that anyone with administrative access (besides me) will be changing too many things, so I'm not concerned with anyone messing up too much.
The way I want to do this is by creating a drop down list which contains either A: a static list of variables which pertain to each page on the site -OR- B: a dynamic list of variables pulled from the tbl_text table, which also stores the page content. Right now I got as far as creating a dynamic drop down:
After this I have the php for the fckeditor and the remainder of the form:
Now each query works fine, but I have no idea how to combine the two. In the regular php world, I could figure this out, but with the $oFCKeditor stuff, I am completely lost. If I can't do this, I'll have to build a special page for this (outside of the site_settings.php page) and just send a row ID over through the URL I guess.
Any help would be greatly appreciated.
The way I want to do this is by creating a drop down list which contains either A: a static list of variables which pertain to each page on the site -OR- B: a dynamic list of variables pulled from the tbl_text table, which also stores the page content. Right now I got as far as creating a dynamic drop down:
<?php include '+config.php'; include '+opendb.php'; $sql = "SELECT * FROM tbl_text WHERE location != 'portalnews'"; //*Don't want anyone but the webmaster changing portal homepage news *// $result = mysql_query($sql); ?> <form action="site_settings.php?mid=9" method="post"> //*when they select a value in the drop down, it will POST it to a function on the same page, and update the editor...supposedly *// <p></p>Select which page you would like to edit: <SELECT name="location" id="location"> //*They select the page *// <OPTION value="">---SELECT---</OPTION> <?php while ($list = mysql_fetch_array($result)) { ?> <OPTION value="<?php echo $list['location'] ?>"><?php echo $list['location'] ?></OPTION> <?php } ?>
After this I have the php for the fckeditor and the remainder of the form:
<?php $oFCKeditor = new FCKeditor('fcktext2'); $oFCKeditor->BasePath = "../scripts/fckeditor/"; $oFCKeditor->Value = $list["text"]; $oFCKeditor->Width = 540; $oFCKeditor->Height = 400; echo $oFCKeditor->CreateHtml(); include '+closedb.php'; ?> <input type="hidden" name="submit_form" value="2" /> <input type="submit" value="Save Form" /> </form>
Now each query works fine, but I have no idea how to combine the two. In the regular php world, I could figure this out, but with the $oFCKeditor stuff, I am completely lost. If I can't do this, I'll have to build a special page for this (outside of the site_settings.php page) and just send a row ID over through the URL I guess.
Any help would be greatly appreciated.
Re: change content of editor with dropdown box
(By the way I'm doing all of this page editing stuff in a Greybox, so that makes things even more interesting)
1) the page_editor.php page has instructions, examples, and a dynamic dropdown box which pulls the pagenames from the "pages" table of the db (doing is dynamically because eventually the users will be able to create brand new pages, disable pages, and delete pages, from the portal).
2) when a user selects a page and clicks "submit", the value is passed to a new page, page_edit.php, and assigned to a variable.
3) the db is opened, and the pagename field of the text table is compared to that variable. If the variables match, the BLOB field is displayed in the fckeditor.
4) when the user does is work, he presses "submit" and the variables assigned are sent back to the first page and the db update script is run.
It's kind of a round about way of doing it, and believe me i tried to get it all to happen on one page. I could sort of get it to work, but because I already have a rather large DIV on the first page, and I don't want the user to have to scroll, it's better this way.
Now I just have to feed all the static pages' content into the db, rewrite each page to query the db and i'll be set!