A few questions about building self assembling CMS, seeking guidance


I’m pretty new to CSS, and was curious about how to build the following type of framework. I do a little design work so I thought I’d make graphic to help visually communicate what I want to do. I want php to automatically assign variable names to assets within directories, then call them into pre-set locations on a website.

Let me give you some background.
I want to build a database of case studies on non profit projects and their founders. I want to automate the insertion of content as much as possible, by using a framework that will insert content into its respective project page (each project page showcases a video episode). Each project will have a page, with an article about it, graphics, and video.

In order to make this system, ( I think) I need to build some php code that calls content out of content directories. That is, I will either have content stored in main directories, such as a graphics directory, which would contain subdirectories, with each subdir. containing content to be inserted into predetermined locations on its respective project page.

Another option, I think, would be having main directories for each project page, and then having sub directories for each type of content (graphics, video, animation, etc.)

For example,

Lets say there is a project called EcoSchool, with content including 1 text article, 4 graphics, 2 videos, 2 short clips and 2 animations. In fact, every single project will have the same data set of content listed above, to make things easy to automate.

First of all, I know I need to automate the creation of these datasets.
But, before I can do that, I think I need to build a sort of template data set, which plugs into a web template that I’ll make in html and css, with php in certain places to insert variables.
–Now, once I build this template as a sort of map, I want php to build all the other ones, looping until it creates 20 pages. So this means I would have to use php to create copies of my php and css, auto-incrementing variables that are unique within each data set. So, for example, every single project page would have directories that all have a graphic1.png thru graphic5.png (because there are 5 graphics per data set i.e. parent variable i.e. the project page)

I know that each project page is going to represent either an array or a parent variable (Which one, I wonder? still confused by difference between an array vs. a parent variable with a bunch of child variables).

Anyways, when a user clicks a link for the EcoSchool project to view it, they will be directed to a page that pulls up all the content into the preassembled template
“hey, pull all of the EcoSchool variables for the various content, and put them in the right spots”
Each spot will be a variable within the html.

I understand this far.

However, how what I am wondering is, how do I go about creating php that will call up content from directories automatically.
if there are 5 graphics in the graphics directory, php will automatically assume they are in the correct order, and place them in positions $EcoSchoolGraphic where represents that graphic’s order within the directory.

Basically, my question is:

  1. Which way do you think I should organize this site map?
    Option A: As depicted in the sitemap graphic I attached-- main dir: content specific, sub dir: episode specific
    Option B: Main dir: episode specific, sub dir: content specific

  2. Can php alone be used to build this type of self assembling site, or do you think that it may need some javascript involvement?

  3. Could you give me some idea of how you would go about building this type of framework?

  4. Do you know of any tutorials with similar ideas?

  5. How do I use php to automatically assign variable names assets with a directory? once I can do this, I can pull the variables up client side. So i’d just need a template I guess… right?

Any guidance is greatly appreciated.
Thanks tremendously.

link to graphic: https://dl.dropbox.com/u/85645202/Sitemap-for-self-assembling-site2_03.png

I’m pretty new to php* Ack!! this cold weather is numbing my brain.

For example,

How would I do this in php:

Go through the directory, select the first file in order --regardless of its name (how do I code “anyfile” or “no matter what its file name is”-- rename it graphic1 (preserving the extension).
Select the second graphic in the directory, rename it graphic2
etc. through graphic5

How would I do that?

So, I did a little research. Looks like I will need to do a ‘for’ loop to iterate through the graphics subdirectory 5 times, since I want the 5 graphic files renamed.

So, I have this code:

<?php for ($num=1; $num<=5; $num++) // this iterates thru 5 times. { echo "hello world"."
"; } ?>

the next step is to replace the echo function with a function that will actually do what I need it to do: rename the files to graphic1, graphic2, etc. while preserving extension.
i’m off to do more research…

Sponsor our Newsletter | Privacy Policy | Terms of Service