php-general Digest 16 Oct 2011 21:32:41 -0000 Issue 7523
Topics (messages 315319 through 315327):
starting php by asking basic questions
315319 by: saeed ahmed
315320 by: Lars Nielsen
315321 by: Govinda
315322 by: tamouse mailing lists
Re: Seeking strategy/algorithm for maintaining order of records
315323 by: tamouse mailing lists
315324 by: Jim Giner
315325 by: Tedd Sperling
315326 by: Jim Giner
315327 by: Stephen
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 ---
i want to learn php and i do not know much and my english is also
limited.isthere anyone who can explain me php by most simple
example,like explainig to
a child,something like this:if you put "this" symbol or writing, in your php
script,when someone open this page,will see this message"long time not see"
.
at the moment ,i am scared of terms used by professionals.
thnks,for many this could a stupid but this is what i am facing.
thanks.
--- End Message ---
--- Begin Message ---
søn, 16 10 2011 kl. 11:40 +0200, skrev saeed ahmed:
> i want to learn php and i do not know much and my english is also
> limited.isthere anyone who can explain me php by most simple
> example,like explainig to
> a child,something like this:if you put "this" symbol or writing, in your php
> script,when someone open this page,will see this message"long time not see"
> .
> at the moment ,i am scared of terms used by professionals.
> thnks,for many this could a stupid but this is what i am facing.
> thanks.
You could start at http://php.net/manual/en/getting-started.php which
gives a basic introduction to php-concepts.
What is you preferred spoken language? Try to google for "php basic
tutorial" or "php getting started". Try somthing similar in you own
language.
Regards Lars
www.lfweb.dk
--- End Message ---
--- Begin Message ---
> i want to learn php and i do not know much and my english is also
> limited.isthere anyone who can explain me php by most simple
> example,like explainig to
> a child,something like this:if you put "this" symbol or writing, in your php
> script,when someone open this page,will see this message"long time not see"
> .
> at the moment ,i am scared of terms used by professionals.
> thnks,for many this could a stupid but this is what i am facing.
> thanks.
saeed
PHP is so widely used that by now there are tutorials that speak to every level
of understanding and in so many possible tones, in many languages too. When
you ask someone to "explain PHP to you", in english anyway, that is too broad a
request to get much specific help. You are just going to have start at the
beginning and learn the basics first. Try to find a tutorial that teaches the
basics, as Lars said. I am just adding here encouragement because when I
looked for them, then I have found what I think you want - really gentle PHP
tutorials that make it so easy to digest and learn from. If you still felt
overwhelmed, then perhaps another approach that might work for you is to
somehow serve/give to someone who would take you on as a personal student, and
teach you, step by step. You can get that kind of help here, but to solicit
that, you have to *break your requests down to very small and specific things*
that you want to know. No one can answer "explain PHP to you" in less than
consecutive days/weeks/months.
Here is my starter tutorial for you, based on what you asked:
PHP is software that runs on a server computer.
When someone goes to a webpage then their browser (like Internet Explorer, of
Firefox, etc.) effectively asks the server to hand over a webpage to the
browser. But if the designer of that webpage used PHP to build the webpage,
then before the server hands over the webpage to the browser, it first sends
the page to the PHP software. PHP looks in the code of the page for things it
is supposed to do. There are so so many things you can make PHP do with the
PHP code you (as the designer) write and put in the webpage. One thing you
will do often is use PHP code to make values appear in the page that are
"dynamic", meaning things that change, depending on variables. Like maybe you
want to show the date to the end user (the browser). Well you can't just put
the date in your webpage with only text/HTML, because then you would have to
change the webpage code every day for it to be accurate. And even then that
would not work because depending on the time zone of the user it might already
be a different day. So you just use one of the many many hundreds of PHP
constructs (bits/lines of PHP code that you can write) which will give the
date.
Like this in the webpage code:
date_default_timezone_set('America/New_York');
echo date('r');
...will output this on the page in the browser:
"Sun, 16 Oct 2011 11:28:31 -0400"
Good luck,
-Govinda
--- End Message ---
--- Begin Message ---
On Sun, Oct 16, 2011 at 10:34 AM, Govinda <govinda.webdnat...@gmail.com> wrote:
>> i want to learn php and i do not know much and my english is also
>> limited.isthere anyone who can explain me php by most simple
>> example,like explainig to
>> a child,something like this:if you put "this" symbol or writing, in your php
>> script,when someone open this page,will see this message"long time not see"
>> .
>> at the moment ,i am scared of terms used by professionals.
>> thnks,for many this could a stupid but this is what i am facing.
>> thanks.
First of all, php is a programming language. If you are not familiar
with any sort of programming, don't despair, php is pretty easy to
use. However, I would strongly recommend getting some basic books on
programming and software development so you don't go off the rails
(npi).
For a quick start though, you could do a lot worse than the webmonkey
intro tutorial:
http://www.webmonkey.com/2010/02/php_tutorial_for_beginners/ that was
updated last year.
Also, lifehacker ran a series of articles on beginning programming
which you may find helpful:
http://lifehacker.com/5401954/programmer-101-teach-yourself-how-to-code
This mailing list is not set up to teach people how to program in php.
It is pretty much expected that you already know the basics and then
we are here when you've exhausted your manuals, books, web sites, etc.
--- End Message ---
--- Begin Message ---
In Sat, Oct 15, 2011 at 7:57 PM, Stephen <stephe...@rogers.com> wrote:
> I am building a site for my photography.
Cool!
> The photographs are displayed by category.
>
> The category table has a field for "order"
>
> In my control panel I want to be able to change the order of the categories
> by changing the values in the category field.
>
> I can dynamically build a form of all categories and have a field for new
> order number, Then loop through the POST and update the values.
>
> The field is not unique, so I am not worried about DB errors.
>
> But I wonder if there is a better way.
>
> Thoughts please?
I'm not 100% sure I understand what you're trying to do here, but it
seems like a custom sort based on the list of categories is the order
of the day?
What is sounds like you're attempting to do is what is similar to the
netflix queue ordering, if you're famliar with that -- basically
something like this in your form page for each category:
<label for="category_one">Category One</label>
<input type="text" name="category_one" value="(current sort order for
category one)" id="category_one" />
Then the user sets the category sort order by via the input boxes.
That seems pretty straight forward.
The advanced class will do this with drag-and-drop interactive widget.
The hairy part come when you snag the photo info from the database
getting the ordering right there. I don't know if there's a way to do
that in a single query or not, I'm guessing resorting to a stored
procedure may be your best bet here, perhaps with generating a
temporary table on the fly.
--- End Message ---
--- Begin Message ---
"tamouse mailing lists" <tamouse.li...@gmail.com> wrote in message
news:cahuc_t8icx4y4mca05rrgzopv4ze7hwsndaiyjjmdvbambv...@mail.gmail.com...
In Sat, Oct 15, 2011 at 7:57 PM, Stephen <stephe...@rogers.com> wrote:
\<label for="category_one">Category One</label>
<input type="text" name="category_one" value="(current sort order for
category one)" id="category_one" />
I would capture the input fields by using an array name ("category[]")
instead of specific names (ie, "category_one". That way you don't have to
modify your input procesing if/when you add a new category.
--- End Message ---
--- Begin Message ---
On Oct 15, 2011, at 8:57 PM, Stephen wrote:
> I am building a site for my photography.
>
> The photographs are displayed by category.
>
> The category table has a field for "order"
>
> In my control panel I want to be able to change the order of the categories
> by changing the values in the category field.
>
> I can dynamically build a form of all categories and have a field for new
> order number, Then loop through the POST and update the values.
>
> The field is not unique, so I am not worried about DB errors.
>
> But I wonder if there is a better way.
>
> Thoughts please?
>
> Thank you
> Stephen
>
Stephen:
What you describe is a multistep problem. There are many ways to show pictures
(images) in any order you want.
I commonly store images in a database with their associated data, such as id,
image name, size, type, category, and other such data.
Then when I want to display any image(s), I simply pull the images from the
database in the order and/or category as I want them displayed. If I want to
sort them in some fashion, I can use any field by using a MySQL query string,
such as "SELECT * FROM image_db WHERE what=whatfield ASC ORDER BY whatever".
From there it's a simple process to display the data obtained from the database
by using a pagination scheme of some type, like this:
http://php1.net/b/pagination-images/
or this:
http://webbytedd.com/bbb/paging/
In some instances, I even have a content management system where I can set the
order of the pictures I want to appear in what order by assigning them a sort
order number/category.
For example, if I have 20 pictures (numbers 1-20) each having a sort number,
they will be shown in that order. If I want to change the order of the
presentation, such as insert image 16 into position 3, I simply change the
order number of picture 16 to 2.5 and resort the categories on integer. Bingo,
the images are resorted as I want.
There are many ways to do this -- you just need to define what you specifically
want to do and break it down into manageable parts.
Cheers,
tedd
_____________________
t...@sperling.com
http://sperling.com
--- End Message ---
--- Begin Message ---
"Tedd Sperling" <tedd.sperl...@gmail.com> wrote in message
news:4c4ff11f-24ea-48cc-a367-48803df58...@gmail.com...
Stephen:
What you describe is a multistep problem. There are many ways to show
pictures (images) in any order you want.
*****
So far, the OP has only asked how to keep his "categories" in order.
Curious, yes, but he hasn't even asked how to display the images in order -
maybe he doesn't care about that..
--- End Message ---
--- Begin Message ---
On 11-10-16 04:10 PM, Jim Giner wrote:
Stephen:
What you describe is a multistep problem. There are many ways to show
pictures (images) in any order you want.
*****
So far, the OP has only asked how to keep his "categories" in order.
Curious, yes, but he hasn't even asked how to display the images in order -
maybe he doesn't care about that..
Well, I want to deal with one part of the design at a time :)
Thanks to all who replied. This is a collective response.
Displaying in an order is easy when you have a field called "order".
SELECT descriptions FROM categories ORDER by order;
My issue is, say I have three records:
ID Category Order
1 B&W 1
2 Landscapes 2
3 Nudes 3
I am looking for the best way to be able to change the values to
ID Category Order
1 B&W 3
2 Landscapes 2
3 Nudes 1
Dynamically building a form, entering the new order value, and then
looping through the post, with a SQL UPDATE is the best I can come up with.
A future issue will be doing the same to the table category-photograph
ID Category_id photo_id order
This table is needed to allow a photograph to be in more than one category.
Cheers
Stephen
--- End Message ---