Re: Am I on the right track here?



On Thu, 19 Feb 2009 10:18:59 -0800 (PST), in comp.lang.php Mike Silva
<snarflemike@xxxxxxxxx>
<67a8bd1d-e341-4092-9845-0449f8223d7d@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

| On Feb 19, 12:09 pm, "Álvaro G. Vicario"
| <alvaro.NOSPAMTH...@xxxxxxxxxxxxxx> wrote:
| > Mike Silva escribió:
| >
| >
| >
| >
| >
| > > So I'm trying to understand what's involved in displaying a dynamic
| > > webpage based on data from a database query, e.g. a list of books
| > > based on an author search.  This is my understanding of what has to
| > > happen.
| >
| > > 1) The query is constructed and passed to the database server, which
| > > returns the results.  Let's say it returns 45 records.
| >
| > > 2) Regular HTML displays the non-dynamic sections of the results page
| > > (s)
| >
| > > 3) PHP code (see, this is a PHP question ;) loops through the records
| > > to
| > >    a) set adjusted x,y coordinates for the current record
| > >    b) display the specified text from the record - title, description,
| > > ISBN, etc
| > >    c) display one or more pictures - would these typically be living
| > > in some giant \image directory, and be accessed by filenames stored in
| > > the record?
| > >    d) generate specified buttons, quantity boxes, etc for this record
| > >    e) repeat a-d until all records displayed, or max number of records
| > > per page is reached
| > >    f) generate navigation links (e.g. First  << < 1  2...5 > >> Last)
| > > based on current display page
| >
| > > Comments on my understanding of what's involved?
| >
| > 1) PHP code starts running
| > 2) PHP sends a query to the database server and fetches 45 records
| > 3) PHP generates output, that happens to be HTML
| > 4) HTML is sent to the browser
|
| Yep, all makes sense.
|
| > 5) Browser renders HTML, doing all that fancy stuff involving x,y
| > coordinates
|
| That's the part I still need to comprehend. For example, on youtube
| they show a list of 8 recommended videos in a 4x2 layout. Presumably
| the server code (for sake of relevance, the PHP code) determines a
| display rectangle for each video in that 4x2 layout, and generates the
| display HTML relative to each rectangle. And I don't quite understand
| what that code would look like. That is, I understand calculating the
| rectangle based on the displayed record 1-8, but I still need to
| figure out what the code would look like to put images and text in
| different parts of that rectangle. I probably just need to search out
| some code to look at, because I'm sure it can't be difficult. OTOH, I
| tried looking at the youtube code and started whimpering...
|
| So I probably need to find some simple examples to look at.
|
| Mike

The '8 recommended videos' are called thumbnails. These thumbnails
usually have a fixed size. You use CSS for the HTML layout (spacing,
border etc).

You need to keep in mind that when working with dynamic web pages you
are dealing with several areas.

The dynamic part uses server-side languages to 'talk' to the database
(retrieving and formatting the data). The formatting may involve
wrapping the returned data in HTML statements. This code produces the
web page. Once the server hands the page to the browser, the server,
forgets what it sent.

The HTML side is where the browser takes control of your markup
instructions. Not only do you have the HTML markup for the content but
you also have CSS for the styling /layout. You can also have
javascript for user interactions within the page.

HTH
.


Loading