| Author | Post |
|---|
realtchr Member
| Joined: | Thu Sep 7th, 2006 |
| Location: | |
| Posts: | 2 |
|
Posted: Mon Sep 3rd, 2007 02:15 am |
|
This is what I need to do - I have a school site where things like daily announcements and student news needs to get updated frequently and stored for retrieval.
The site also has a number of sections that never get updated - School History, Welcome, etc. I was wondering can I use editwrx to create a form that will write to three tables: announcements, news and kudos. And then display the last five entries for each table in specific editblocks on a page? (I can find the answer to displaying the five most recent entries using php, but I need help with the editwrx portion.)
You'll understand what I need to do if you visit the first page of our site: http://www.jamiesonschool.org
Thanks
Realtchr
|
Keith Moderator
| Joined: | Fri Apr 8th, 2005 |
| Location: | |
| Posts: | 583 |
|
Posted: Thu Sep 6th, 2007 05:54 pm |
|
It looks like what you want is merely wysiwyg capabilities for submitting to your current database. EditWrx could not do that without major changes. EditWrx is setup to edit pages, not snippets stored in databases.
Go to http://htmlarea.com. There are numerous editor modules there that can be added to a "form" for submitting snippets to a database.
|
realtchr Member
| Joined: | Thu Sep 7th, 2006 |
| Location: | |
| Posts: | 2 |
|
Posted: Fri Sep 14th, 2007 01:25 am |
|
Thanks Keith,
What I'm looking for is a little different. I need teachers to be able to edit their general pages using editwrx, but things like announcements that appear on the left margins should be pulled from a simple php database. For instance checkout http://www.jamiesonschool.org/principal.html He will edit his page but the announcements on the left and right should come in from the database so I don't have to retype it on every page. I hope I'm a little clearer.
|
Keith Moderator
| Joined: | Fri Apr 8th, 2005 |
| Location: | |
| Posts: | 583 |
|
Posted: Fri Sep 14th, 2007 03:18 pm |
|
Ah, you're talking horses and I was talking rabbits. Sorry about that.....
What you want is exactly what editblocks were originally designed for. First of all, turm principal.html into a php page so the server will read the page and execute any php code found on the page before delivering the page to the browser. Rename it principal.php.
Then, on your left side you have an editblock enclosing the Announcements section. You want that pulled from a database. So, remove the editblock and replace that entire area with a php include that pulls from the database. Since there will still be an editblock on the page enclosing the center section the user will not be able to edit the area with the php include. Do the same thing for the News & Events section on the right.
That's actually all you need to do. One editblock enclosing the principal's area and two php includes to pull in the Announcements and News&Events sections.
Something you need to understand - once an editblock is on a page EditWrx can not see the parts of a page that are not enclosed in the editblock(s). When you save, the browser sends only the editblock(s) to the server, the server opens the page's file, finds the editblock(s) and overwrites them. So, any part of a page that is generated by a php include code (outside of editblocks) can not be touched by the editor.
A simple schematic layout for principal.php would be:
<table>
<tr><td><?php include("announcements.php"); ?></td>
<td><div editblock="one">Principal's comments</div><!-- editblock="one" --></td>
<td><?php include("news_events.php"); ?></td></tr>
</table>
That takes care of allowing the principal to edit only his section of the page. But what about the Announcements and News&Events?
1) We assume that announcements.php and news_events.php have to process some logic to determine what announcements and news to present. Since the php codes are outside of the editblocks this entire system for filling those two areas is left intact when editing the principal's content
2) We assume that those two sections require no logic and their content shows up on all pages, so when announcements.php or news_events.php are changed all pages get the changed content as they are included by php include codes on all pages. The announcements.php and news_events.php chould actually be renamed announcements.txt and news_events.txt since they are simple flat files containing text (there is no need for the server to parse them as a php file). Well, EditWrx also has a way to do those with wysiwyg instead of with a database.
First of all, create a special EditWrx user, let's call her "manager". Make manager a Super User. A Super User can see the /editwrx folder but regular users can not. Now place a page in the /editwrx folder named manager.php with the following layout:
<table>
<tr><td><div includeblock="/announcements.txt"><?php include("../announcements.txt"); ?></div></td>
<td>A bunch of Lorem Ipsum filler content</td>
<td><div includeblock="/news_events.txt"><?php include("../news_events.txt"); ?></div></td></tr>
</table>
When manager loads manager.php in the editor the two php includes are editable. And when manager saves the edits announcement.txt and news_events.txt get overwritten with the changes - and all pages that include those two files get automatically updated.
This configuration does away with the need for an actual "database". One should always keep in mind - the most efficient "database" you have is your file system, the second most efficient database is the www itself, and sql is the least efficient of the three and should only be used in the special cases where neccessary.
|
 Current time is 05:18 pm | |
|