php-general Digest 9 Apr 2012 00:54:28 -0000 Issue 7766

Topics (messages 317484 through 317488):

Re: image inventoryer
        317484 by: tamouse mailing lists
        317486 by: Kirk Bailey
        317487 by: Tedd Sperling

Re: Watch out for automatic type casting
        317485 by: tamouse mailing lists

php books
        317488 by: Kirk Bailey

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Sat, Apr 7, 2012 at 10:35 PM, Kirk Bailey <kbai...@howlermonkey.net> wrote:
> <html>
> <head>
> <title>Image inventory of this directory</title>
> <style TYPE="text/css">
> body { margin-left: 10; margin-right: 10%; }
> body {background-attachment:fixed;}
> A:link, A:visited,  A:active { text-decoration:none; }
> A:hover { text-decoration:underline; }
> .justify{text-align:justify;}
> .center{text-align:center;}
> </style>
> </head>
> <body bgcolor="#A0A0A0" TEXT="BLACK" LINKS="BLUE">
> <CENTER>This page inventories the contents of this directory and lists all
> image files in order- as
> the computer determines such matters. Here is the full inventory.
> <hr align="center">
> <P>
> <?php
> foreach (glob("*.*") as $filename) {
>    echo '<img src="'.$filename.'">'."<br>\n$filename\n<P>\n";
> }
> ?>
> </body></html>
>
>
> This works nicely. copied code from online manual, chainsaw editing to fit,
> superglue in the spare parts needed and it lists them all and composes
> proper img links to display on the inventory page. NOW I have the tool i
> needed; can someone else put this to good work?

Well, congrats on a first somewhat useful program. All I have to say
now is: you have a long way to go.

--- End Message ---
--- Begin Message ---
Thank you!
Not QUITE the first; I have used snippets and small routines for a while; however I did not know how to do this in php.

Turns out there are at least 2 methods: glob, and an iteration of the directory with readdir() to build up an array, then one by one print the elements in the array. In python this is not hard. Iteration in python is somewhat different- not to mention getting used to do blocks. Being so used to snake charming, learning a new way means getting used to different procedures.

On 4/8/2012 2:18 AM, tamouse mailing lists wrote:
On Sat, Apr 7, 2012 at 10:35 PM, Kirk Bailey<kbai...@howlermonkey.net>  wrote:
<html>
<head>
<title>Image inventory of this directory</title>
<style TYPE="text/css">
body { margin-left: 10; margin-right: 10%; }
body {background-attachment:fixed;}
A:link, A:visited,  A:active { text-decoration:none; }
A:hover { text-decoration:underline; }
.justify{text-align:justify;}
.center{text-align:center;}
</style>
</head>
<body bgcolor="#A0A0A0" TEXT="BLACK" LINKS="BLUE">
<CENTER>This page inventories the contents of this directory and lists all
image files in order- as
the computer determines such matters. Here is the full inventory.
<hr align="center">
<P>
<?php
foreach (glob("*.*") as $filename) {
    echo '<img src="'.$filename.'">'."<br>\n$filename\n<P>\n";
}
?>
</body></html>


This works nicely. copied code from online manual, chainsaw editing to fit,
superglue in the spare parts needed and it lists them all and composes
proper img links to display on the inventory page. NOW I have the tool i
needed; can someone else put this to good work?
Well, congrats on a first somewhat useful program. All I have to say
now is: you have a long way to go.


--- End Message ---
--- Begin Message ---
Kirk:

Okay, you took the first step. Now please review this:

<?php
foreach (glob("images/*.jpg") as $filename)
{
   echo("<img src=\"$filename\"><br>$filename <br><br>");
}
?>

Note:

1. This example does not put in all the embedded formatting shown in your 
example. What you did was simply bad form -- you should learn css as well. 
Also, you don't need to place the code within a bunch of html -- it will work 
"as-is".

2. I always want my students to place images in an image directory -- the above 
conforms to that.

3. The example also shows how to separate the jpg's from other files in the 
directory.


So, where do you want to go now?

Cheers,

tedd


_____________________
tedd.sperl...@gmail.com
http://sperling.com






--- End Message ---
--- Begin Message ---
On Sat, Apr 7, 2012 at 1:55 PM, Maciek Sokolewicz
<maciek.sokolew...@gmail.com> wrote:
> On 07-04-2012 16:37, Bogdan Ribic wrote:
[snip]
>
> Bogdan,
> you are reviving a thread over a week old, and repeating what 4 other people
> have already stated. Please don't do that, it just results in
> mailinglist-noise.
>
> - Tul

plus, you top-posted </piling-on>

--- End Message ---
--- Begin Message --- Revisiting said dead horse, it's interesting there is no clear consensus of opinion about what is the best book to use to learn php. Generally, you get several people chiming in talking about the website. Now the website is the bomb indeed, BUT IT'S NOT A BOUND BOOK! So that's a terrific answer to a totally different question.

It's interesting really; it suggests there is a wide range of perspectives and mindsets about wha is the best way to come to understand php. Possibly this suggests something about the general mindset of the php community- wide ranging individualism?

--
end

Very Truly yours,
                 - Kirk Bailey,
                   Largo Florida

                       kniht
                      +-----+
                      | BOX |
                      +-----+
                       think


--- End Message ---

Reply via email to