iarp Posted April 21, 2008 Share Posted April 21, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/ Share on other sites More sharing options...
ublapach Posted April 21, 2008 Share Posted April 21, 2008 will load faster from a database Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522414 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522416 Share on other sites More sharing options...
iarp Posted April 21, 2008 Author Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522426 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522431 Share on other sites More sharing options...
iarp Posted April 21, 2008 Author Share Posted April 21, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522442 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 I'd suggest using a MySQL database. Much better alternative. >_> Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522452 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522458 Share on other sites More sharing options...
Fadion Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522460 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 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. =( Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522465 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522466 Share on other sites More sharing options...
Fadion Posted April 21, 2008 Share Posted April 21, 2008 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 . Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522469 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522472 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522473 Share on other sites More sharing options...
Fadion Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522481 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 o ok, then so for my CMS/Website Template would you recomend storing things like welcome message etc. in the database rather than a .inc.php file? Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522484 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 Wait, what? You wouldn't need fopen() or fwrite() for a welcome message, you could just include() it. Two different scenarios, buddy. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522486 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522493 Share on other sites More sharing options...
redarrow Posted April 21, 2008 Share Posted April 21, 2008 @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... Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522494 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522497 Share on other sites More sharing options...
DeanWhitehouse Posted April 21, 2008 Share Posted April 21, 2008 ok, Quote Link to comment https://forums.phpfreaks.com/topic/102063-editing-pages/#findComment-522500 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.