Jump to content

Logically stumped


futrose

Recommended Posts

I'll preface by saying this is my first DB driven site and I'm teaching myself php with the help of fine folks like yourselves.  (this is not a shopping site, more informative than anything)

 

I can't wrap my brain around how to set something up and am hoping for some insight.

 

I have created a nav system using the "id's" from my CATEGORIES table.  When a user clicks my link the page is populated with the descriptive paragraph corresponding with the "id".  There is additional information that will be required on each page but not all information will be displayed in the same format across every page.  The way I have it set up so far is 2 tables:

 

categories -  all nav information and descriptive paragraph for page

 

jci - holds information about an uploaded file with a link to the file stored in /uploads/ (the files are only uploaded by admin)

 

then I have an includes directory with a jci.inc.php file which is the code and template to display the jci table information.

 

How do I set it up so that the jci.inc.php file is displayed only when the "jci" category is clicked?  how do I make other include files with different layouts and have them displayed with other info when other categories are clicked?

 

I can see this turning into a lot of "if" statements.

 

Thanks for any insight.

 

Link to comment
Share on other sites

Code examples and/or screenshots would be really helpful. But, based on your descriptions, you're grappling with the fundamental issues of web application architecture.

 

It's good that you recognize that a lot of conditionals - "if" statements - is not the way to go. Understanding abstraction and polymorphism are your keys to dealing with runaway control structures.

 

About the only concrete thing I can recommend is study. There are many books and online  references available, and it's hard to know where to start. "PHP and MySQL Web Development" by Welling and Thomson - covers most of the things you're trying to learn. There's lots of good software engineering discussion and practical examples.

 

Take your time and heed that voice that tells you there's got to be a better way. There almost always is.

Link to comment
Share on other sites

you are correct in the assumption that I'm struggling with "the fundamental issues of web application architecture".  I taught myself html and built our first static company website (www.keystonecandle.com if anyone is interested) a few years ago.  Now trying to get my brain to re-think and re-learn how to set up a site using php and mysql is tough.  Especially since I'm teaching myself php with no real programming background.  I did buy a book called "Build your own database driven website using php & mysql" by kevin yank.  It is a good book and has taught me a lot so far but there isn't much in it about setting up templates and using them. 

 

I'll keep researching till I can get the thought process straight on this.  Thanks for your reply.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.