Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

new way for me to write CMS functions

Community Beginner ,
Jun 07, 2012 Jun 07, 2012

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.

TOPICS
Server side applications
542
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 10, 2012 Jun 10, 2012
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines