Re: switch, if, or something to choose queries and echo formatting--PLEASE help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Actually, there was a case statment...originally.  I deleted that code and
was simply putting back together what I'd done and trashed.  And I ended up
leaving it out in the e-mail (I thought maybe that HAD been part of the
problem and checked, but the case statements are there in my current
version).

To summarize ...in more detail...
I have a 'personal portfolio site' that contains a variety of creative
endeavors, written and visual.  It has 6 major sections.

@VR (Which contains 'about the site', 'copyrights and credits', 'updates',
'donate', etc.)
Design (Which contains 'animation', 'photographs', 'drawings', 'computer',
and 'web')
Compose (Which contains 'poetry', 'prose', 'essays', 'fanfiction', and
'tutorials')
Memoir (Which contains 'biography', 'resume', 'pictures', 'weblog', 'web
journal', 'album')
Unleash (Which contains 'downloads', 'layouts', 'graphics', 'tutorials',
'features', and 'forum')
Connect (Which contains various ways to contact me and a bunch of links)

In my head these are separate.  Most likely I will make most of the pages in
@VR, some in Connect, and one or two in Memoir simply with HTML, because
they don't change.

However, the Design pages, Compose pages, Unleash pages, and Connect > Links
pages have become far too cumbersome to keep up with by manually updating.
I haven't changed my layout in about two years because the idea of making
another 100 HTML files makes me shudder.

If I can manage, with my tests, to figure out how to get the whole concept
to work, I will make the full database.  As of now I only have a few test
tables set up.  But my idea is to basically make each page that needs a
database-driven content its own table.

The layout I'm working with has a drop-down menu (not written by me), with
images as buttons for the links.  I don't think it's the sort of thing that
I can add to a table and have the database deal with, therefore I am
literally typing the link on my test page:

<a href="subsections.php?section=design">image</a>
OR
<a href="subsections.php?page=animation">image</a>
OR
<a href="subsections.php?section=design?page=animation">image</a>

(Only the pages are links, the sections are just for organization and do not
need pages.)

To reitarate, I've currently got a link that reads:

<a href="subsections.php?section=design?page=animation">image</a>

and subsections.php says (and this is all it says):

<?php

//section cases
switch($_GET[section]){
   case "design":
       include("design.php");
       break;

   default:
       print("Error");
}
 ?>


then, design.php says (and this is imbedded in where I want the content to
go):
<?php

//page cases
switch($_GET[page]){
   case "animation":
       $page=thumbs;
       break;

   default:
       print("Error");
}

$count=1;

$table = mysql_query("SELECT * FROM $page",$db);

echo("<table border='0' cellspacing='1' cellpadding='1' width='300'
align='center'><tr>");

while ( $r = mysql_fetch_array($table) ) :

if ($count==4){
   echo ("</tr><tr><td span='4'><img src='images/spacer.gif' height='10'
width='1'></td></tr><tr>");
   $count=1;
  }else{
$id=$r["id"];
$pic=$r["pic"];
$thumb=$r["thumb"];
$pname=$r["pname"];
$pcom=$r["pcom"];
echo("<td align='left' valign='top' width='100'><a href='$pic'
target='blank'><img src='$thumb' border='0' align='left'></a><br
clear='all'><b>$pname</b><br><i>$pcom</i></td>");
   $count++;
  }
endwhile;

echo ("</tr></table>");

 ?>

If I could get it to work like I wanted, I would set the 'section'
designation based on what sort of format I wanted the table's results to be
in.  For any page using thumbnails in an image-gallery-like table, I would
set the case to include 'design.php', for any lists of stories or poems, I
would use 'compose.php'.

Then design.php would find out what *particular* page needs to display and
substitute the appropriate table name.

Seems pretty simple to me.

Like I said, though, I'm not too smart about this, and this may be totally
NOT the way to achieve it...however, if someone knows how to achieve it, I
would appreciate the input.

- (R)hy
   http://www.virtualrevolution.net
            .switch.it.on.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 9/17/2004

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux