#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    88
    Rep Power
    3

    Lost on how to ask google this question


    I am trying to ask google on how to create a script that will display images by a group and limit how many pictures will be displayed. While only showing the thumbs of the pictures while linking to the full size image. I have a script that works the way I want it to except the part where it is separated by groups, but it is way out of my league, meaning outside of my understanding. I am trying to find a less complex version of the script that I have to where I can edit enough to where it will give the results that I am looking for.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1015
    Hi,

    why don't you write your own code instead of “stealing” it from random websites? What you're trying to do isn't exactly rocket science. If you know the basics (loops, if statements etc.), you should be able to do it yourself.
    The 6 worst sins of securityHow to (properly) access a MySQL database with PHP

    Why can’t I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,056
    Rep Power
    535
    try this

    Comments on this post

    • sir_drinxalot agrees : nice
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    88
    Rep Power
    3
    Jaques,

    That is the thing I am lost on how to do it, but you raise a very good point about stealing because you learn more by hard coding yourself or creating yourself. I know foreach and while, but that is the extent of it. I think you would use a for loop on limiting how much images can be displayed, which that kind of alludes me. I don't know how to properly set up a for loop. I completely understand if statements. Basically I need the basic components first before I can even begin writing my own code.
    Last edited by natturefrk; January 10th, 2014 at 11:05 AM.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    189
    Rep Power
    0
    Originally Posted by natturefrk
    Jaques,

    That is the thing I am lost on how to do it, but you raise a very good point about stealing because you learn more by hard coding yourself or creating yourself. I know foreach and while, but that is the extent of it. I think you would use a for loop on limiting how much images can be displayed, which that kind of alludes me. I don't know how to properly set up a for loop. I completely understand if statements. Basically I need the basic components first before I can even begin writing my own code.
    And that's why people ahead of you who have already learned php have written that thing called The Manual. Try looking those things up in it and you too can learn.
  10. #6
  11. hiding my <b> from ur <strong>
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2004
    Posts
    959
    Rep Power
    182
    Originally Posted by jimmyg999
    And that's why people ahead of you who have already learned php have written that thing called The Manual. Try looking those things up in it and you too can learn.
    No reason to be snarky jimmy. Some people will just have to use PHP for one specific problem and never have to look at it again. If you don't have anything truly helpful to add, please just move on to another post. We try to keep things positive here at DevShed.
    ****
    Enjoy my post? Drop some props by hitting the scales button up top. JBL

    Website Design in Los Angeles and Washington, DC by PoweredPages.com
  12. #7
  13. Confused badger
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2009
    Location
    West Yorkshire
    Posts
    1,200
    Rep Power
    493
    Originally Posted by natturefrk
    I know foreach and while, but that is the extent of it. I think you would use a for loop on limiting how much images can be displayed, which that kind of alludes me. I don't know how to properly set up a for loop. I completely understand if statements. Basically I need the basic components first before I can even begin writing my own code.
    A simple "for" loop would look like this ...

    PHP Code:
    for ( $x 1$x 10$x++ ) {
      echo 
    "X: " $x "<br>";

    Breaking that up ..

    for ( <-- start/declare this is a for loop
    $x = 1; <-- set an initial value and assign it to the variable $x
    $x < 10; <-- do the loop WHILE this statement remains TRUE (so it'll show on-screen 1 to 9 because when $x becomes 10, the check then becomes FALSE
    $x++ <-- each loop, do this (in this case, add 1 to the value of $x
    ) {

    echo "X: " . $x . "<br>"; <-- do something, in this case, write the value of $x to screen

    } <-- go back and repeat the loop unless the "WHILE" thing defined above is FALSE

    You can do a table with "dynamic" columns with a loop such as this:

    PHP Code:
    echo "<table>"                   // Declare the open table HTML *outside* of the loop (we only need to do this once you see)
    echo "<tr>";                      // We're only doing one ROW for this example so again, write this HTML *outside* of the loop
    $number_of_columns 5;    // Set how many columns to write (will be used later on)
    for ( $x 0$x $number_of_columns$x++ ) {    // Start the main loop
        
    echo "<td>This is column number $x</td>";       // This is the column/cell (TD) HTML
    //  end of code to perform each iteration
    echo "</tr>";                    // Neatly close the row
    echo "</table>";                // Neatly close the table 
    Now, that should give you the basics to get a better understanding for the FOR loop and its structure.
    There's a ton of information out there on that there internet to go along which can probably explain/teach better then I can.

    For what it's worth, I've modified the above to display mutiple ROWS so you can see how that would be done too ...
    PHP Code:
    echo "<table>"                   // Declare the open table HTML *outside* of the loop (we only need to do this once you see)
    $number_of_rows 5;    // Set how many columns to write (will be used later on)
    for ( $x 0$x $number_of_rows$x++ ) {    // Start the main loop
      
    echo "<tr>";                      // Write this HTML *inside* of the loop
        
    echo "<td>This is row number $x</td>";       // This is the column/cell (TD) HTML
        
    echo "<td>This is row number $x</td>";       // This is the column/cell (TD) HTML
        
    echo "<td>This is row number $x</td>";       // This is the column/cell (TD) HTML
        
    echo "<td>This is row number $x</td>";       // This is the column/cell (TD) HTML
        
    echo "<td>This is row number $x</td>";       // This is the column/cell (TD) HTML
    echo "</tr>";                    // Neatly close the row
    //  end of code to perform each iteration
    echo "</table>";                // Neatly close the table 
    These days I understand it's frowned upon to use tables but I still use them all the time lol, what you gonna do? "Haters gonna hate" as my daughter would probably say.
    "For if leisure and security were enjoyed by all alike, the great mass of human beings who are normally stupefied by poverty would become literate and would learn to think for themselves; and when once they had done this, they would sooner or later realise that the privileged minority had no function and they would sweep it away"
    - George Orwell, 1984

IMN logo majestic logo threadwatch logo seochat tools logo