Should I store php/mysql modules in database or files? - php

I have 10 different modules that are created to be used for the index page. I've created a jquery drop/sort function for the backend, so the admin of the site can change the layout of the front page without coding knowledge. However I'm having a problem finding a way to store the modules.
I have two types of modules:
1. An image, title, link and a dynamic php/mysql generated content (eg. last five reviews)
2. An image, title, link and plain text
What is the best way to store the modules that makes it possible to edit them easily in the backend? Should I store the php/mysql part in seperate php files or in mysql?
Any tips on making a good backend module solution would be appreciated.
Thanks

You should be storing your files in your filesystem, and your data in the database. That is how it is designed. You may slow things down if you put your files into the database.

Related

Storing page data in php

I'm trying to figure out the best way to store webpage data for a website build in PHP so that I can access it for components like navigation and breadcrumbs.
At the moment I've got an array in my config file which has each page's name, path and parent data, but I realise this is almost certainly wrong.
How should this data be optimally stored? I thought about a MySQL table but it seems like overkill for a small site.

how to create dynamic website using PHP, MySQL and MS Excel

I want to create a travel agency website in PHP with MySQL, the requirements are back end admin control and an excel file to add data so that can be uploaded from admin area to display contents on website.
Where should i start? any tutorial will be helpful btw i know how to build dynamic websites with dreamweaver.
It's not ideal utilising an Excel file for the Administration of a site; a Content Management System would be the best option.
If the client has their heart set on using Excel, the simplest and quickest way is to upload the file by phpMyAdmin - although that would mean giving your clients access to that area - and the field headings in the file would need to be the same (and naive clients may add headings left right and centre).
As replied earlier, explain the disadvantages of utilising Excel, show them something like this > http://dhtmlx.com/docs/products/dhtmlxGrid/ - a Javascript datagrid.
But CMS is the best option.
Mike

html and css in mysql

I am having trouble designing a solution to a complex problem. I am building a site that creates html templates including both the css files and html files. Users will be able to create multiple templates/sites.
In an attempt to create a normalized database I have a user table (id, name, email, password, etc.), a site list table (user_id, site_id, site_name, description), and the rest I am having trouble figuring out.
I am trying to develop a way to break down both the html files and css files into a database that can be used to reproduce the designed template. Constant editing and adding to the database will take place when creating/editing a template. Basically, an extremely simplified dreamweaver. Flat files may be an option as well.
Any input or suggestions on how to go about such site would be greatly appreciated such as how to break down the html and css into mysql tables/records. Im not so much looking for code, but the fundamental concepts/workings of such a site. Thanks in advance.
First of all, are you sure you even want to store that content in the database? That's going to place a heavy burden on your servers over generating them as files onto the filesystem inside the DocumentRoot and directly servable by the web server. I can see storing the configuration options (color choices, image names, etc) in the database, but not the files themselves.
Can these websites have any content the customer wants, or are they variations on a theme? If it's the former, then you really can't automate it much. You can store the content in a database instead of a file, but it won't really be advantageous.
Your best bet, I think, is to look how CMS programs like WordPress/Joomla break up a page into separate include files (header, footer, left menus, right menus, etc) and use that as a model. The customer picks a template, and each template has defined sections that can be laid out separately with different content.
You could store the templates in text files then store settings (such as CSS attributes or images they may want) in the database. That way, you just load the template with the applied settings.

First Larger-Scale Web Dev Project - Advice for Content Management?

I'm familiar with HTML, CSS, and some PHP and Javascript. I've made several fairly complicated websites for which I've acted as webmaster, manually adding all content in HTML.
I'm about to put in a proposal for my first outside client at a larger business. They have an IT person that would be responsible for updating the website that I create for them.
My question is what to do about content management. I've looked into things like Drupal, but they seem overly complex for this kind of situation, with a single person adding updates of things like text, images, and PDFs.
What would you recommend as the next step above the simple way of manually uploading files and editing HTML like I'm used to? Something like a MySQL database and PHP calls? Would I then store all the images in the database as well?
I guess I'm just trying to figure out what's most common at a medium-sized business. I appreciate any guidance you can offer!
Nathaniel
My company has built large scale projects and medium scale as well. What we like to do is setup a outer page with navigation and an inside page that the client has control of by a control panel with FCK Editor or TinyMCE.
So essentially we have a wrapper page (in our case a MasterPage but in PHP you would use an include or a index.php with a query string to pull the content) and then we drop in HTML content from the database.
That database is populated by the client in their control panel. FCK Editor allows them to upload images and manage links, etc.
For our bigger clients we get very specific in our control panel allowing them to add videos, PDF attachments, blog entries, FAQ content, etc.
Some examples we have are http://pspwllc.com and http://needsontime.com and http://nwacasa.org
Drupal can be bit complex at first but if you stick with the basic modules - it is great for website content management.You can write your own mini content management system - store text and images(MySQL blob format) in MySQL.It will be couple of PHP admin pages and a good render() function responsible for page rendering.
Also have a look at wordpress, it is much easier than drupal. It is less powerful but it may serve your needs. You will NOT need to configure modules like FCKeditor, with it bcoz they come inbuilt. Anybody will be able to edit the content easily. Do note that wordpress is not just for blogs, you can create different kinds of websites with it. Another choice is Joomla, it is also simpler than drupal. But, wordpress is the simplest.

How would the conversion of a custom CMS using a text-file-based database to Drupal be tackled?

Just today I've started using Drupal for a site I'm designing/developing. For my own site http://jwm-art.net I wrote a user-unfriendly CMS in PHP. My brief experience with Drupal is making me want to convert from the CMS I wrote. A CMS whose sole method (other than comments) of automatically publishing content is by logging in via SSH and using NANO to create a plain text file in a format like so*:
head<<END_HEAD
title = Audio
keywords= open,source,audio,sequencing,sampling,synthesis
descr = Music, noise, and audio, created by James W. Morris.
parent = home
END_HEAD
main<<END_MAIN
text<<END_TEXT
Digital music, noise, and audio made exclusively with
#=xlink=http://www.linux-sound.org#:Linux Audio Software#_=#.
END_TEXT
image=gfb#--#;Accompanying image for penonpaper-c#right
ilink=audio_2008
br=
ilink=audio_2007
br=
ilink=audio_2006
END_MAIN
info=text<<END_TEXT
I've been making PC based music since the early nineties -
fortunately most of it only exists as tape recordings.
END_TEXT
( http://jwm-art.net/dark.php?p=audio - There's just over 400 pages on there. )
*The jounal-entry form which takes some of the work out of it, has mysteriously broken. And it still required SSH access to copy the file to the main dat dir and to check I had actually remembered the format correctly and the code hadn't mis-formatted anything (which it always does).
I don't want to drop all the old content (just some), but how much work would be involved in converting it, factoring into account I've been using Drupal for a day, have not written any PHP for a couple of years, and have zero knowledge of SQL?
How would I map the abstraction in the text file above so that a user can select these elements in the page-publishing mechanism to create a page?
How might a team of developers tackle this? How do-able is it for one guy in his spare time?
You would parse the text with PHP and use the Drupal API to save it as a node object.
http://api.drupal.org/api/function/node_save
See this similar issue, programmatically creating Drupal nodes:
recipe for adding Drupal node records
Drupal 5: CCK fields in custom content type
Essentially, you create the $node object and assign values. node_save($node) will do the rest of the work for you, a Drupal function that creates the content record and lets other modules add data if need be.
You could also employ XML RPC services, if that's possible on your setup.
Since you have not written any PHP for a long time, and you are probably in a hurry, I suggest you this approach:
Download and install this Drupal module: http://drupal.org/project/node_import
This module imports data - nodes, users, taxonomy entries etc.- into Drupal from CVS files.
read its documentations and spend some time to learn how to use it.
Convert your blog into CVS files. unfortunately, I cannot help you much on this, because your blog entries have a complex structure. I think writing a code that converts it into CVS files takes same time as creating CVS files manually.
Use Node Import module to import data into your new website.
Of course some issues will remain that you have to do them manually; like creating menus etc.

Categories