Jump to content

Editing pages


iarp

Recommended Posts

Hey,

 

Just wondering what you guys think would be easier. Having all the content in a database table and just called to the page as someone views it, or have the information on the page itself with no database involvement.

 

Which would be easier for using a WYSIWYG editor. I'm trying to create a website for a volunteer company and they person who works on it is as smart as a brick when it comes to any type of coding. If it's got GUI and he can see what it'll look like right away then he's fine. So i'm wondering if it's easier to edit the content when it's in a database or on the page itself.

 

And does anyone have any recommendations for any good editors? What i was after was having a script that would allow site admin to click an Edit link somewhere on the page and have that open the page editor.. edit the page, save and then reload to see his changes.... any suggestions?

Link to comment
Share on other sites

i am using a .inc.php file for editable content and writing to it when it is changed

 

e.g.

i have a form that submits the data. $data

then i have a code that writes this data to the .inc.php file

then i include the file on everypage

then refer to the content by

echo "$data";(or something similar)

then make a form for them to edit it.

Link to comment
Share on other sites

i am using a .inc.php file for editable content and writing to it when it is changed

 

e.g.

i have a form that submits the data. $data

then i have a code that writes this data to the .inc.php file

then i include the file on everypage

then refer to the content by

echo "$data";(or something similar)

then make a form for them to edit it.

 

So have the pages information in a completely separate page and just include(''); that everyone? From what i read, your putting 1 set of data into $data and then that exact same data is being shown on every page which wouldn't make sense.

Link to comment
Share on other sites

erm, a better example.

page 1 code

<?php
require_once 'edited.inc.php';
echo"$user_edited";
?>

edited.inc.php

<?php
$user_edited = "Stuff for users to edit";
?>

then you have a script, (which i have if you need) that will write this data into the edited.inc.php
the data there can be taken from a form. Bit like mysql, without the database.

Link to comment
Share on other sites

If i'm not mistaken that should allow php coding inside of that as well and work?

 

For my example, i'm working on http://moha.iarp.ca and when someone logins it would still say Welcome, <firstname> to the Minor Oaks ... etc

 

And if you wouldn't mind showing me that code to write to the file that would be awesome. Plus this file can have other pages information on it i take it?

Link to comment
Share on other sites

http://www.phpfreaks.com/forums/index.php/topic,192840.msg866700.html#msg866700

read this for more info on the .inc.php file

this code will write to the file( to edit it i am still unsure, as i beleive this rewrites the whole file)

<?php
//it makes this file, if it doesn't exist
$config_file = "../includes/config.inc.php";

$fw=fopen($config_file,"w+") 
or die("Unable to open file!");	// Unable to open file

$config_host = "\$dbhost = \"".$dbhost."\";\n";
$config_user = "\$dbuser = \"".$dbuser."\";\n";
$config_pass = "\$dbpass = \"".$dbpass."\";\n";
$config_db = "\$dbname = \"".$dbname."\";";

$config_write = $config_host.$config_user.$config_pass.$config_db;

fwrite($fw, "<?php\n".$config_write."\n?>");

fclose($fw);

?>

Link to comment
Share on other sites

Im completely with darkwater. Blade280891's alternative is for a different approach. Have the users stored in the db and when they login, query the db with their data and show the firstname (which should normally be stored in the db too :). As for the editor, tinymce is great and free.

Link to comment
Share on other sites

Im completely with darkwater. Blade280891's alternative is for a different approach. Have the users stored in the db and when they login, query the db with their data and show the firstname (which should normally be stored in the db too :). As for the editor, tinymce is great and free.

 

Yeah, and databases are MUCH faster and easier to use.

 

Oh, and if you use Windows, get Notepad++ for an editor.  That's what I use when I'm forced (yes, forced) to use someone's Windows box and help them or something. 

 

I absolutely despise Windows. =(

Link to comment
Share on other sites

yer, but this is for storing information that you want to edit, like the page title for example. He wasn't asking where to store user data.

 

For page title and stuff that is perfect, but he is needing mysql :)

 

@darkwater. I guess he is talking about a web WYSIWYG editor :) . And yeah i despise windows too, but as i mostly use photoshop, 3d max and such graphic apps, im forced to :(.

Link to comment
Share on other sites

yer, but this is for storing information that you want to edit, like the page title for example. He wasn't asking where to store user data.

 

Page title is different.  Storing a whole page's content is better off in MySQL. 

 

@GuiltyGear: Oh, good point, lol.  Although you can run Photoshop with WINE on a linux box without many issues.

Link to comment
Share on other sites

i disagree, i think it is easier to edit and access using .inc.php and databases (from what i have seen from PHP cms) are not generally used to store large pieces of data, like whole page content.

 

He's not willing to store large piece of data, he wants to store user data and text information which can be edited easily. Its easier, faster and smarter then to have several text files which are read (slowly) and written (slowly).

 

@DarkWater. Yep ive read about wine but never tried it. Not sure about the performance but ill give it a try, definitely.

Link to comment
Share on other sites

@guilty_gear so correct, How can you really design a soild

sms with files, no way a database way out smarts that idear....

 

a sms is very easy to design, it only lets you output the current

data and update and delete the database entrys in some cases also used to set web site settings...

 

 

Link to comment
Share on other sites

no, not what i meant, i mean this

<?php
echo "$welcome";
?>

 

this is editable, would this be better to be saved in .inc.php file or mysql

 

That's COMPLETELY different.  You'd store that in a header file or whatever and do $welcome="WELCOME MESSAGE"; right before the include() statement.  You'd NEVER need to fopen() or fwrite() to that file.  Ever.  MySQL is better for a CMS when storing pages though.  Like, articles and stuff.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.