Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update web site using php and mysql?

Status
Not open for further replies.

jen0dorf

IS-IT--Management
Apr 15, 2008
104
0
0
GB
Hi

I'm trying to find a way that a client can update their news page on their web site themselves. Just want to make sure my logic is Ok because I've searched google and not found any "readymade" software.

I can populate a page from a mysql database using an echo command ( sorry mysql is a new learning curve)

I can create a login screen to ensure only the user can log in.

I Thought of using a form to populate the database using a form to email sequence but I'm not sure if such a thing exists in mysql
Can some kind person tell me if I'm on the right track?

thanks

Ian
 
mysql is just a database server. it's not going to be able to parse an email or the like. you need to use a programming language to intermediate that. php can do that for you, but parsing emails is a long way round the issue.

consider a CMS like joomla, drupal etc. or even a blogging platform like wordpress. all of these do what you want out of the box. in fact they do a LOT more, which may be where you run into problems: sledgehammers and nuts.

your logic is otherwise sound.
 
Hi

thanks for that, off to do some research

Ian
 
You could quite simply use MySQL to store the markup, or you could use a flat file (flat file is usually preferable if you don't anticipate updates frequently)

Right now I'm working on a site that the client requested just that much (being able to update some of the content on their own). The problem of course is that they're not exactly the most computer literate bunch out there, and frontpage was out of the question. So I had to come up with a compromise of some sort that would allow them to markup the content, but also somehow keep it somewhat consistant with the rest of the site.

So I created a back end that was password protected, links for each of the content file ( which contains the markup for only the contents, say the /sections folder)

Then I downloaded and implemented a little javascript editor (it doesn't load files or anything its just an editor, so you'll have to figure out how to plug the existing content into the editor, I used the Ajax.Request method then inserted into the editor)

The idea is this.

On the site itself, you have the index.php, and depending on the page passed to it (say index.php?page=home)

there would be a <? include("path.to.root/sections/home.php"); ?> in the part of the page where you wanted the content for that particular page to load.

On the back end the editor (say TinyMCE a popular free javascript editor), would load the same file and allow the client to editor the markup, bolding and what not as a simple WYSIWYG editor, and you would just simply have a button somewhere such as in a form for "Save" which would send the data in the editor (which is treated like a textarea in a form) to another page, such as save.php , and that would use fwrite and such to overwrite the file in the sections folder with the new content.

That's one way to go about it, otherwise you use a MySQL database, setup a table of pages, and have something like PAGE|CONTENT|LASTUPDATE or something like that, and pull the content from the database into the editor, and back up into it.

Except with a MySQL approach you're not doing inclusions of folders in sections, but rather doing something like "SELECT content FROM PAGES where PAGE = 'home'"

Hopefully I wasn't going in a million different directions. But I would say flat file for infrequent updates, and mysql approach if there's going to be frequent updating/changing.

Karl Blessing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top