SitePoint Sponsor

User Tag List

Results 1 to 25 of 25
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Content Magagement Systems - Rolled vs Roll Your Own

    I want to learn how to make a content magagement system. I'm working on a site focusing on the animal kingdom, similar to the Animal Diversity Web, which uses Plone. But Plone is incredibly complex and would require me to more or less abandon PHP and MySQL for different technologies.

    I'm now trying Mambo and Drupal. Neither is as user friendly as I had hoped, and they, too, require me to abandon certain things I've spent a long time learning. For example, it sounds like I'd have to import my MySQL databases into a different kind of database with Drupal. And Mambo offers several variations of two confusing extenions - 404SEF and Xaneon - to make search engine-friendly URL's, with installation instructions that are all over the map.

    So I'm leaning increasingly towards making my own content management system. I'm beginning to think it might not be any more difficult than learning how to work with Mambo or Drupal, and I wouldn't be stuck with "proprietary" technology. Instead of 404SEF, I could learn how to use mod_rewrite, which is universally understood.

    Does this make sense? Have you had similar experiences?

    I know how to display information from databases on web pages. I can create two static pages that are identical except for one line in the head section:

    $mycode = 'wolf';
    $mycode = 'fox';

    ...and produce one page with information about the wolf, another with information about foxes. What I don't know how to do is dispense with the static pages and make these two sets of data display on one master page or template. Is there a term for that, so I can search for tutorials?

    I now understand that search engine-friendly URL's are made by mod_rewrite, and I also hope to use a little XML on my site.

    I just wondered what experiences others have had with the content management system racket. Thanks.

  2. #2
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The benefit of using a premade CMS is that its premade, ready to go. But my experience is that no a single one ever fully suits my needs and find it easier to program one from scratch for each new site.

    Regarding your question, I am a little unsure what you are asking. You would like a base template your website would use that would display different information depending on the page you are looking at? Example:
    http://www.photoshopguides.com - all database driven with CMS to manage its content.

    Is this what you are looking for?

  3. #3
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hand-made versus pre-made CMS. Hand made are always better , though lack the same functionality.

    My choice was a hand made CMS, without the use of external databases depending on the server. So whenever I wish I can move to another server, just copying my directories in less than 5 minutes .

  4. #4
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the tips. I think I can explain myself a little better like ths...

    I currently have an echo value in the head of each static page, like this:

    $mycode = 'wolf';

    That page would then display data from several different database tables that focus on the wolf. If I want to display the wolf's dental formula near the top of the page, floated to the right, then I might insert something like this:

    <div style="width: 200px; float: right"><?php echo $Mammals['DentalFormula']; ?></div>

    If I create a second static page and change $mycode...

    $mycode = 'tiger';

    Then it would automatically display a tiger's dental formula.

    So my pages are mostly made up of snippets of information from various database tables, all linked to a particular species (or family, order, etc.) by $mycode.

    So instead of creating 5,000 static pages, each with a different value for $mycode, I might create just ONE page with a $mycode similar to this:

    $mycode = '[VARIABLE]';

    If a visitor clicked a link named "Tiger," that variable would become $mycode = 'tiger'; (or $mycode = 'Panthera tigris';

    So it looks like it ought to be fairly simple, really. I just need to figure out how to translate whatever a visitor clicks into a value for $mycode. Is that how databases do it, or is there another option?

    Thanks.

  5. #5
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just create an extra table in your database to hold all the names of the animals. Output that list in some sort of navigation box and link them to animalinfo.php?animal=$entry[name] so when the page loads, $_GET[animal] is your $mycode value.

    After proof-reading that, I think I worded it a bit weird.. if you dont understand, I will try to better explain myself.

  6. #6
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shockt
    The benefit of using a premade CMS is that its premade, ready to go. But my experience is that no a single one ever fully suits my needs and find it easier to program one from scratch for each new site.

    Regarding your question, I am a little unsure what you are asking. You would like a base template your website would use that would display different information depending on the page you are looking at? Example:
    http://www.photoshopguides.com - all database driven with CMS to manage its content.

    Is this what you are looking for?
    Yes, I think that's an example. An even better example is the Animal Diversity Web. Their wolf page displays at...

    http://animaldiversity.ummz.umich.ed...nis_lupus.html

    Their coyote page is at...

    http://animaldiversity.ummz.umich.ed...s_latrans.html

    They apparently have a master page, or template. When a visitor searches for "wolf," then clicks a link (or when they simply type in a link), it somehow triggers something that displays all the information about the wolf.

    And I read that it's even possible to produce SEVERAL URL's that point to the same page, like this:

    www.geozoo.org/stacks/wolf/
    www.geozoo.org/stacks/Canis_lupus/
    www.geozoo.org/stacks/loupe/

    I would think it ought to be relatively simply, because I'll have all those names in my database.

    Thanks.

  7. #7
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops, I missed your post...

    Quote Originally Posted by Shockt
    Just create an extra table in your database to hold all the names of the animals.
    Done.

    Output that list in some sort of navigation box and link them to animalinfo.php?animal=$entry[name] so when the page loads, $_GET[animal] is your $mycode value.
    I understand what you're driving at...I'm just a little confused by the details.

    First, I display a list of names from my database, like this:

    wolf
    coyote
    fox

    But on my web page, in code view, they would look something like this?:

    <a href="animalinfo.php?animal=$entry['Name']">wolf</a>
    <a href="animalinfo.php?animal=$entry['Name']">coyote</a>

    If a visitor viewed my web page's source code, they would see this:

    <a href="animalinfo.php?animal=wolf">wolf</a>
    <a href="animalinfo.php?animal=coyote">coyote</a>

    Am I right so far? (I hope so, because this is something I actually understand how to do!)

    The next step is to translate that into a value for $mycode. This is where I get confused. I don't really understand what $_GET[animal] is. And what could be an example of what $mycode might look like if I converted it to a variable?

    Thanks.

  8. #8
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay for this sort of thing you would have a database table (or an array within a file) with a master list of all the unique animals in them. You would also have a template that the information would be loaded into.

    Here is a quick example with PHP and MySQL to give you an idea of what I mean..
    PHP Code:
    <?
    $animal_info 
    mysql_fetch_array(mysql_query("select * from animal_info where name='$_GET[animal]'"));

    echo 
    "
    <html>
    <head>
    <title>
    $animal_info[animal_name] Information</title>
    </head>
    <body>
    <b>Animals:</b>
    "
    ;
    $animals mysql_query("select * from animal_list");
    while(
    $animal mysql_fetch_array($animals))
    {
      echo 
    "<a href=info.php?animal=$animal[animal_name]>$animal[animal_name]</a> ";
    }
    echo 
    "
    <br><br>
    <h1>
    $animal_info[animal_name]</h1>
    Dental formula: 
    $animal_info[dental_formula]<br>
    Scientific name: 
    $animal_info[scientific_name]<br>
    etc...
    </body>
    </html>
    "
    ;
    ?>

  9. #9
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $_GET[animal] is the variable in the URL.. info.php?animal=bear
    So in that case, $_GET[animal] would be set to bear

    And you wouldnt have to manually write each link (though you could) if you have the list in the database. Just use a while loop as I have shown above to list each entry in animal names table.

    Once you get that down, you can make the URLs more search engine friendly using mod_rewrite.

    You could even combine the list of animals and the info for each animal into a single table. The table would have the animal name along with its dental formula, origin, average weight, average height, etc. So to make a list of all the names, you would query that whole table for just the animal names and use a while loop to list each of them. And then a query to retrieve all the information for a single animal.

  10. #10
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, I'm beginning to get it. I'll probably have to wrestle with this some more, but this is the closest I've to what I've come to regard as the Holy Grail - understanding how people can display multiple pages on a single template page.

    Thanks!

  11. #11
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by geosite
    Ah, I'm beginning to get it. I'll probably have to wrestle with this some more, but this is the closest I've to what I've come to regard as the Holy Grail - understanding how people can display multiple pages on a single template page.

    Thanks!
    No problem. I made an edit to my last post and added a bit more information. To explain this concept with just a keyboard has proven to be difficult. I cannot suggest any good tutorials or guides as I never used any.. I suppose trial and error mixed with some experimentation got me to where I am with PHP.

  12. #12
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can anyone tell me what part I'm not getting? I adapted my database tables to the script I was given, and I think it's working - except that I still haven't figured out how to display information.

    Let me explain with a very brief overview, followed by the code, with some inserted comments. I'm using two tables here - gzmammals1 and gzmammalsfamily. I want to use gzmammals1's field "Name" - gzmammals1.Name - to give each page its identify. Examples of entries in this field include Mammalia, Carnivora and Canidae.

    I'm using gzmammalsfamily as an example of a table that will hold information about each species, family, etc. In this case, I simply want to display the name of each "Name's" parent (field Parent).

    PHP Code:
    <?php
    [DATABASE CONNECTION]

    // This opens the doors for the information...I'm querying everything from my informational table, gzmammalsfamily, which lists the names of all the mammal families - e.g. Canidae, Felidae, etc. I'm still confused about $_GET, but more about that later.

    $animal_info mysql_query ("SELECT * FROM gzmammalsfamily AS GZMF WHERE Name='$_GET[Name]'")
    ?>

    <html>
    <head>
    <title><?php $animal_info['Name'?> Information</title>

    </head>

    <body>
    <b>Animals:</b>
    <?php

    // These are the links visitors will click to fetch information about a mammal family. "WHERE Parent = 'Carnivora'" limits it to mammal families that belong to the order Carnivora. Therefore, it displays Canidae, Felidae, etc.

    $animals mysql_query("select * from gzmammals1 WHERE Parent = 'Carnivora'");
    while(
    $animal mysql_fetch_array($animals))
    {

    // I can use either of the links below. In the second example, my base URL is http://geozoo/practice/cms.php If I click the linked word "Canidae," the link changes to http://geozoo/practice/cms.php?animal=Canidae

    //  echo "<a href=info.php?animal=$animal[Name]>$animal[Name]</a> ";
      
    echo "<a href=cms.php?animal=$animal[Name]>$animal[Name]</a> ";
    }
    ?>

    <br><br>

    // I think everything is working OK up to this point. But I'm not displaying any information. I think the following scripts are written correctly. (I should mention that both tables have a field named Name.) So I THINK I'm tripping up on $_GET[Name], near the very beginning.

    <h1><?php $animal_info['Name']; ?></h1>
    Parent:<?php $animal_info['Parent']; ?><br>
    etc...
    </body>
    </html>
    ?>
    Now that you know what my tables look like...

    1) Names used to give each page an identity drawn from gzmammals1.Name

    2) Information about each animal drawn from gzmammalsfamily, which shares a field named Name (In other words, gzmamammals1.Name[Canidae] corresponds with gzmammalsfamily.Name[Canidae]

    ...it would be a tremendous help if someone could fix whever I broke or fill in the blanks I missed. I must be getting close, but I seem to have some sort of mental block regarding $_GET.

    Thanks.

  13. #13
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its hard to explain the concept but the GET variable (as opposed to POST) gives you the ability to transfer variables between pages by including it in the URL.

    Okay.. now I am confused. You want a template system that will display information about a genus or species or both?

    If you have MSN, send me your email via PM so we can talk easier and faster.

  14. #14
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shockt
    Its hard to explain the concept but the GET variable (as opposed to POST) gives you the ability to transfer variables between pages by including it in the URL.
    OK, is GET_ a FUNCTION then? I thought you were using it as some sort of variable, similar to my original example - $mycode. But is GET_ designed to transfer variables in a wide variety of situations? If so, that still doesn't explain why it isn't working for me, but I probably did several things wrong.

    Okay.. now I am confused. You want a template system that will display information about a genus or species or both?
    I want to display information about EVERYTHING.

    My table gzmammals1 has a list of names of species AND genera AND families, orders and classes. It looks like this:

    NAME | PARENT
    Mammalia | Animalia
    Carnivora | Mammalia
    Canidae | Carnivora
    Canis | Canidae
    lupus | Canis

    Name['Mammalia'] would fetch information about mammals. Name['lupus'] would display information about the wolf, Canis lupus.

    But in this particular example I just listed the names of families belonging to the order Carnivora - Canidae, Felidae, etc. Eventually, I'd like to learn how to plug this into a search engine, where visitors can type in any name.

    If you have MSN, send me your email via PM so we can talk easier and faster.
    I'll send you a PM. Thanks.

  15. #15
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GET is a type of superglobal variable.
    http://us3.php.net/manual/en/reserve....variables.get

    So in terms of pages in your website:

    Index - Page with list of families
    -Family - Page with that family's information and genera
    --Genus - Page with that genus' information and species
    ---Species - Page with that species' information

    Correct?

  16. #16
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shockt
    GET is a type of superglobal variable.
    http://us3.php.net/manual/en/reserve....variables.get

    So in terms of pages in your website:

    Index - Page with list of families
    -Family - Page with that family's information and genera
    --Genus - Page with that genus' information and species
    ---Species - Page with that species' information

    Correct?
    I'm not sure exactly what you mean. For the purpose of this exercise, there's just one static, or physical, page, which I can preview at http://geozoo/practice/cms.php.

    The field Name in table gzmammals1 - gzmammals1.Name - lists EVERY name of every taxonomic order, from Mammalia down to sapiens (humans). If Name = Canidae, the page should display information about the family Canidae. If Name = lupus, it should display information about the wolf, Canis lupus.

    On second thought, I'm not certain that I implemented GET incorrectly, because I really don't know how it's supposed to work. It's possible I made a stupid mistake elsewhere in the script. But I suspect there are just one or two minor things that need to be changed before it will work. I just can't see where my mistakes are.

    Thanks.

  17. #17
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is difficult to explain.. let me make few example files for you to look at.

  18. #18
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shockt
    This is difficult to explain.. let me make few example files for you to look at.
    Sorry; I had hoped that my example would only require a few fixes, but it sounds like I must have missed something major.

  19. #19
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $_GET is a way to move values from one page to another through PHP.

    See the following example:
    http://www.premonitionstudios.com/geosite/

    There is an array (in your case it will be a database) with names of car brands. It will output all those brands with a formatted string of HTML as you can see in the code. When you click on one, you are taken to the brand_info.php page. Now the code for the page does not change yet the content on the page does because $_GET[brand] is set to a car brand when you click the link on the previous page.
    When you view the page without a brand set, you recieve an error:
    http://www.premonitionstudios.com/ge...brand_info.php

    In your case, they would be families, genera, and species.

    Do you understand how $_GET is used to transfer information from one page to another?

  20. #20
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for going to all that trouble. I had to run an errand and just checked out your example briefly, but I think all the pieces should fall into place now.

  21. #21
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem. If I could understand exactly what you needed, I could try to point you in the right direction. Using $_GET and $_POST variables are pretty important in PHP so you should fully understand those concepts before programming your own CMS

  22. #22
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shockt
    No problem. If I could understand exactly what you needed, I could try to point you in the right direction. Using $_GET and $_POST variables are pretty important in PHP so you should fully understand those concepts before programming your own CMS
    I've seen them in JavaScript, but I don't think I recall using them in PHP.

    And if anyone is still watching this thread, I do have another question.

    First, I modified the last script I was given, adapting it to mammals, and put it online at http://www.geozoo.org/cms/SitePointA.php I also changed it so that EVERYTHING's on one page. In other words, if you click a link, you'll still be at http://www.geozoo.org/cms/SitePointA.php

    (I discovered that when you search for a name on the Animal Diversity Web, it takes you to a Search page. When you click a link on the Search page, it takes you back to an Account page. But I'm not ready for that yet.)

    Anyway, this is my script:

    PHP Code:
    <?
    [DATABASE CONNECTION]
    $taxons = array("Carnivora","Canidae","Canis","Canis_lupus");

    echo 
    "<h1>Mammals</h1>
    <ul>"
    ;

    foreach(
    $taxons as $taxon)
    {
      echo 
    "<li><a href=SitePointA.php?taxon=$taxon>$taxon</a></li>";
    }

    echo 
    "</ul>"
    ?>

    <?
    if(!isset($_GET[taxon]))
    {
      echo 
    "<h1>Mammals</h1>No taxon selected";
    }
    else
    {
      echo 
    "
    <h1>Families</h1>
    <h2>
    $_GET[taxon]</h2>
    Information about 
    $_GET[taxon] species (or genera, families, etc.) goes here.
      "
    ;
    }
    ?>
    So now I need to do two more things:

    1) Replace this array...

    $taxons = array("Carnivora","Canidae","Canis","Canis_lupus");

    ...with a database table query. So instead of limiting my query to Carnivora, Canidae, Canis and Canis lupus, I can query any name that's stored in my database table.

    These names are stored in gzmammals1.Name

    2) Display some information from a second table, gzmammalfamily - say, the parent of whatever linked name a visitor clicks on. The parents are stored in gzmammalsfamily.Parent, and it also has a field named Name, shared with the other table.

    And I could simply display the information with something like this:

    <?php $animal_info['Parent'] ?>

    (I forgot if I need an echo in there...<?php echo $animal_info['Parent'] ?>

    * * * * * * * * * *

    I should be able to figure this out with the sample script I was given earlier, but I think my experiments will only confuse you. Thanks.

  23. #23
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Experimentation is a good thing. I am still experimenting and still learning concepts of PHP that I have never needed before up until now. I am currently trying to figure out how to make an automated script to download zip files via FTP and read/unpack them.. all in PHP. Its a slow process but I seem to remember things easier when I figure things out for myself with a few pushes in the right direction than if I were to be told how its done.

  24. #24
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shockt
    Experimentation is a good thing. I am still experimenting and still learning concepts of PHP that I have never needed before up until now. I am currently trying to figure out how to make an automated script to download zip files via FTP and read/unpack them.. all in PHP. Its a slow process but I seem to remember things easier when I figure things out for myself with a few pushes in the right direction than if I were to be told how its done.
    Actually, that was poorly worded. What I meant to say is I DID experiment with it. But I didn't bother posting any of my experiments, because I felt they were pointless.

  25. #25
    SitePoint Addict Shockt's Avatar
    Join Date
    Jan 2005
    Location
    California
    Posts
    360
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well the two points you listed above sound like you are moving in the right direction. You know where to come for help when you need it. Good luck with your CMS!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •