Copy link to clipboard
Copied
In the past i have given clients customised CMS functions which allow them to create links which are added to the homepage
I have stored the links in a mysql database table and data in other tables is used to populate the pageent
for example if the client has a ecommerce site
i would give him a function that lets him add product categories
anda sperate function that lets him add products - one of the fileds would be product categories
both the links which appear on the homepage, and the list of product categories the clinet can choose from when adding prodcuts would be generated from the list of categories.
when a customer clicks on the link a mysql query selects all products which match the category and these are used to populate the page
This works well when i am filling pages with items which have to have many distinct values assosiated with one object such as products in a shop
but what if i have a site where a clinet can make new pages which only display a block of text
like about, contact and faq pages - excpet my cms system allows the clinet to create his own pages of these types
I could have a seperate table which stores the page name and the text content and a mysql query which selects the entry with the right page name and insters the assoliated block of text, but this seams to be rather complex for something so simple.
would the following idea be better in this siuation
have one table which lists all the page names (same as before)
then instead of having a second table I would have text files which contain the text.
The clinet would be given a simple interface with 2 text boxes, one for choosing the page name and one for entering the text
the page name is added to the table of pages using mysql query
and using simple fopen and fwrite functions the text is written into a text file which is given the page name for its file name.
When a visitor looks at the site the list of links is populated from the table, and when the visitor clicks on a link the file which matches the name of the link is opened and its content is printed into the page
is this a better way of dynamically creating pages which only display simple data that could be stored in a single database cell.
Copy link to clipboard
Copied
I could have a seperate table which stores the page name and the text content and a mysql query which selects the entry with the right page name and insters the assoliated block of text, but this seams to be rather complex for something so simple.
That's the way it is normally done, a single table containing the title, content, and id.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now