SitePoint Sponsor

User Tag List

Page 3 of 31 FirstFirst 123456713 ... LastLast
Results 51 to 75 of 767
  1. #51
    SitePoint Enthusiast mayank's Avatar
    Join Date
    Jul 2003
    Location
    India
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, when I was writing this tutorial ... (meant for beginners in gallery and php concept) I didn't wanted it to be too much in one go becuase that sometimes makes people a little apprehensive about its application ...

    though i totally agree with you that admin section is as important as the gallery itself ...

    well if you are getting a blank page, just for now upload your admin.php (the name i gave it, you can change it to anything else) in your gallery directory .... and then if you wish to move it later to someother location ... then simply change the path of config.inc.php (relative) ...
    its possible ...

    < S-Point Articles :: Albinator :: mgZhome :: Beyond illusions />

  2. #52
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright Mayank,
    admin.php is loaded to my gallery directory. It contains the code as you have it above. I connect to my database a bit differently than your example, but it is the exact same code and linkage as the other PHP files that do connect, so that is not the issue as to why a blank page is returned.

    I have changed your code in one place,
    your example:
    PHP Code:
    $result mysql_query(
       SELECT photo_filename 
       FROM gallery_photo 
       WHERE photo_category='" 
    addslashes($category_id) . "'" ); 
    to what it should be:
    PHP Code:
    $result mysql_query(
       SELECT photo_filename 
       FROM gallery_photos
       WHERE photo_category='" 
    addslashes($category_id) . "'" ); 
    gallery_photo should be gallery_photos

    Also, in my day spent dissecting your suggestion I bounced back to your tutorial several times. I noticed the functions in the tutorial and the ones here are slightly different. Which is good because it made me take a good hard look at what I'm doing.

    Still the only way I see anything in my browser is when I remove all the PHP and just have the HTML forms in my document. Add the PHP code and nothing appears.

    It's late where I am, but I'm staying up until I see something. I am determined that this day will not die without desired results!

  3. #53
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem with the code is in here Mayank, do you see it?

    Code:
    $category_list .=<<<__HTML_END 
        <option value="$row[0]">$row[1]</option>\n
    __HTML_END; 
        } 
        mysql_free_result( $result );     
    
        $category_list = '<select name="categoryid">'.$category_list.'</select>';

    and how it relates with this line in the forms
    PHP Code:
    <?php echo($category_list); ?>


    this line is clever idea, but I don't think it works...
    PHP Code:
    $category_list '<select name="categoryid">'.$category_list.'</select>'
    Last edited by chroni; Sep 4, 2003 at 01:02.

  4. #54
    SitePoint Enthusiast mayank's Avatar
    Join Date
    Jul 2003
    Location
    India
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no it will work ... i have attached the screenshot of the display ...

    Attached Images Attached Images
    its possible ...

    < S-Point Articles :: Albinator :: mgZhome :: Beyond illusions />

  5. #55
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mayank
    well if you are getting a blank page, just for now upload your admin.php (the name i gave it, you can change it to anything else) in your gallery directory .... and then if you wish to move it later to someother location ... then simply change the path of config.inc.php (relative) ...
    He's getting a blank page because things are missing. Ex:

    Code:
    <html>
    <head>
    <title>Gallery Admin</title>
    </head>
    <body>
    
    <? php code here ?>
    
    </body>
    </html>
    I got the page to display, but the photo category fields do not display.

    BTW, you need to delete the thumbnails also in your delete category function
    Code:
    unlink($images_dir . '/tb_' . $row[0]);
    It also threw me for a loop that you used "gallery_photo" for the functions on page 8, but "gallery_photos" in the tutorial.
    Last edited by animal777; Sep 4, 2003 at 03:34.

  6. #56
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chroni
    Animal777,
    I'm interested in your table-less CSS approach which you mentioned in another post. I'm designing most everything with the goal of using only CSS and I think you would have much to teach with your example. Are you designing the forms too?
    I am not doing any css on the upload and admin pages because I have a private gallery. I do not care what those pages look like because they are in a password protected directory.

    The approach I used was pretty simple. Here is the style tag:
    Code:
    <style type="text/css">
    	div.float {
      		padding: 5px;		
    		float: left;
      		}
      
    	div.float p {
       		text-align: center;
       		}
    </style>
    here is the important part of the code
    Code:
    while( $row = mysql_fetch_array( $result ) )
    {
    $result_array[] = "
    <div class='float'><a href='test.php?cid=$cid&amp;pid=".$row[0]."'>
    <img src='".$images_dir."/tb_".$row[2]."' border='0' alt='".$row[1]."' />
    </a>
    </div>";
    }
    mysql_free_result( $result );
    I removed the table references from my code. The only thing that goes in is a single div tag. I had to edit my upload.php to not resize the width of the thumbnails, only the height or they would not wrap right. I created a page that you can view the effect.

    http://www.anglersforchrist.com/test/test.php

    As you can see, this is fully liquid. resize the screen and watch it wrap around.

    one other thing to notice is the &amp characters in the A tag. This will allow the page to validate as XHTML 1.0

  7. #57
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Animal777,

    Your posts are greatly appreciated, thank you. I looked at your gallery and see how you're wrapping the images. I'll get to that when I can, but for now I am obsessed with this "marathon dev cycle" on what should be a simple, simple beginner lesson. I'm humble ...beyond humble, my name is mud.

    Below is my code (one version anyway) but it does NOT produce... and I have tried EVERY <html><?php ?></html> combination, both logical and not logical. Orginally I had expected the heredoc syntax Mayank introduced in his tutorial to output the html with the //Final Output section as it does with the viewgallery.php for example. But that doesn't produce for me either.


    Mayank,

    I also appreciate your screen grabs, though they teach nor prove nothing. However, to show the WHOLE DOCUMENT with html and all, that DOES return the page you speak of, now THAT would be studying material.

    PHP Code:
    <html>
    <head>
        <title>Admin Page</title>
        <link rel="stylesheet" href="css/ckstyle.css" />
    </head>
    <body>


    <?php 
        
    include("config.inc.php");
        
    dbConnect("assets");
        include 
    'design.inc.php';

        if( empty(
    $_POST['action']) ) 
        { 


    // Build the Category List
        
    $result mysql_query"SELECT category_id,category_name FROM gallery_category" );
        while( 
    $row mysql_fetch_array$result ) ) 
        { 
    $category_list .=<<<__HTML_END 
        
    <option value="$row[0]">$row[1]</option>\
    __HTML_END

        } 
        
    mysql_free_result$result );     

        
    $category_list '<select name="categoryid">'$category_list .'</select>'

    ?>




    <form name="add_category" action="admin.php" method="post"> 

    <b>Add Category:</b><br /> 
    Name: <input type="text" name="cname" /> 
    <input type="submit" value="add" name="action" /> 

    </form> 

    <br /><br /> 

    <form name="edit_category" action="admin.php" method="post"> 

    <b>Edit Category:</b><br /> 
    New Name: <input type="text" name="cname" /> 
    <?php echo($category_list); ?> 
    <input type="submit" value="edit" name="action" /> 

    </form> 

    <br /><br /> 

    <form name="delete_category" action="admin.php" method="post"> 

    <b>Delete Category:</b><br /> 
    <?php echo($category_list); ?> 
    <input type="submit" value="delete" name="action" /> 

    </form> 



    <?php 
        

        else 
        { 
            if( 
    strcasecmp($_POST['action'], "add" )==&& !empty( $_POST['cname'] ) ) 
            { 
                
    add_category($_POST['cname']); 
            } 
            else if( 
    strcasecmp($_POST['action'], "edit" )==&& !empty( $_POST['cname'] ) && !empty( $_POST['categoryid'] ) ) 
            { 
                
    edit_category($_POST['categoryid'], $_POST['cname']); 
            } 
            else if( 
    strcasecmp($_POST['action'], "delete" )==&& !empty( $_POST['categoryid'] ) ) 
            { 
                
    delete_category($_POST['categoryid']); 
            } 
            else 
            { 
                echo(
    "Action not understood" ); exit; 
            } 

            echo(
    "Process completed!" ); 
        } 


    // the functions here 

    function edit_category($category_id$new_name

    mysql_query(
       UPDATE gallery_category SET 
         category_name = '" 
    addslashes($new_name) . "' 
       WHERE category_id = '" 
    addslashes($category_id) . "'" ); 

    function 
    add_category($category_name

    mysql_query(
       INSERT INTO gallery_category ( 
        category_name 
       ) VALUES ( 
         '" 
    addslashes($category_name) . "' 
       )" 
    ); 


    function 
    delete_category($category_id

    global 
    $images_dir

    $result mysql_query(
       SELECT photo_filename 
       FROM gallery_photos 
       WHERE photo_category='" 
    addslashes($category_id) . "'" );    
    while (
    $row = @mysql_fetch_array($result)) { 
       
    unlink($images_dir '/' $row[0]); 


    mysql_query(
       DELETE FROM gallery_photos 
       WHERE photo_category='" 
    addslashes($category_id) . "'" ); 

    mysql_query(
       DELETE FROM gallery_category 
       WHERE category_id='" 
    addslashes($category_id) . "'" ); 


    // if I were using the final output (heredoc syntax) it would go here

    ?>

    </body>
    </html>

  8. #58
    SitePoint Enthusiast mayank's Avatar
    Join Date
    Jul 2003
    Location
    India
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does it produce title and other starting tags ? ... try turning on your error reporting to ALL
    its possible ...

    < S-Point Articles :: Albinator :: mgZhome :: Beyond illusions />

  9. #59
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it does return a basic blank HTML page ...this is the source code;
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
    <BODY></BODY></HTML>
    Also, I've added error reporting for all which doesn't report a single thing.
    PHP Code:
    <html> 
    <head> 
        <title>Admin Page</title> 
        <link rel="stylesheet" href="css/ckstyle.css" /> 
    </head> 
    <body> 

    <?php 
        error_reporting 
    (E_ALL);
        include(
    "config.inc.php" ); 
        
    dbConnect("assets" ); 
        include 
    'design.inc.php'

        if( empty(
    $_POST['action']) ) 
        {

    // etc., etc., as shown above with the rest of the document
    Last edited by chroni; Sep 4, 2003 at 13:53. Reason: added error reporting...

  10. #60
    SitePoint Enthusiast mayank's Avatar
    Join Date
    Jul 2003
    Location
    India
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well make sure this:

    PHP Code:
    $category_list .=<<<__HTML_END
          <option value="$row[0]">$row[1]</option>\n
    __HTML_END; 
    the __HTML_END; line does not have any whitespace at the ending of the line ... and similarly for the line $category_list .=<<<__HTML_END

    or you can just replace the whole thing with this:

    PHP Code:
    $category_list .= "<option value='".$row[0]."'>$row[1]</option>\n"
    its possible ...

    < S-Point Articles :: Albinator :: mgZhome :: Beyond illusions />

  11. #61
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YOU HAVE GOT TO BE KIDDING ME!!!

    Mayank, I'm in tears because this thing finally WORKS! I mean ...I picked and picked over this code for two days straight ...did TONS of research and ...it was the white space.

    The eFFFFing WHITE space dude, white space.

    But I've learned quite bit during my research ...such as error_reporting and overriding my host's php.ini with .htaccess and now...

    I have to say huge THANKS for sticking with me and proving to be a great instructor.

    I'm weak in the knees. What a ride!

  12. #62
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Man ...this is too cool. Mayank it works!!!

  13. #63
    SitePoint Enthusiast mayank's Avatar
    Join Date
    Jul 2003
    Location
    India
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pleasure is all mine ...

    do post your url if its public ...
    its possible ...

    < S-Point Articles :: Albinator :: mgZhome :: Beyond illusions />

  14. #64
    SitePoint Enthusiast drewf's Avatar
    Join Date
    Mar 2002
    Location
    Calgary, AB
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Quote Originally Posted by Anonymous
    I know..I know...I'm a newbie, but I am unable to figure out what __HTML_END is all about. Is this a funtion, or a comment? Any links to an explaination. Thank you SOOOO much...excellant article btw!!!
    Hey Anon., I too am a little lost with this type of header and footer function stuff. I think it is a function but I have never seen one called like this before in any coding I have ever seen in PHP.

    Could someone please further discuss this way of doing things? Even looking at Kev's book for examples like this __HTML_END and echo <<<__HTML_END stuff doesn't help me at all. It is all new territory for me. Am I missing something completely obvious here...

    I do know that removing this code breaks the page and it doesn't work. It must be impt. but nowhere in the gallery tutorial does it really explain this to me properly, there is a brief section but not the kind of info I needed...I am just curious too. Please shed some light on this...I really really enjoy this tutorial though. It is fantastic and has tought me a lot! Thank you for your hard work Mayank!

  15. #65
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    drewf,
    Heredoc
    Another way to delimit strings is by using heredoc syntax ("<<<"). One should provide an identifier after <<<, then the string, and then the same identifier to close the quotation.

    check out
    http://www.php.net/manual/en/language.types.string.php

  16. #66
    SitePoint Enthusiast drewf's Avatar
    Join Date
    Mar 2002
    Location
    Calgary, AB
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    drewf,
    Heredoc
    Another way to delimit strings is by using heredoc syntax ("<<<" ). One should provide an identifier after <<<, then the string, and then the same identifier to close the quotation.

    check out
    http://www.php.net/manual/en/language.types.string.php
    Thanks Chroni! You have put me on the path to clarity. I appreciate your reply. Cheers!
    Last edited by drewf; Sep 15, 2003 at 05:30.
    Drew

    "The town where I grew up has a zip code of E-I-E-I-O."

  17. #67
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Morristown, TN
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chroni
    Man ...this is too cool. Mayank it works!!!
    Yeah, I love it. Now for some javascript....

    Code:
    <script LANGUAGE="JavaScript">
    <!--
    function confirmSubmit()
    {
    var agree=confirm("Are you sure you wish to delete?");
    if (agree)
    	return true ;
    else
    	return false ;
    }
    // -->
    </script>
    Then the delete form....
    Code:
    <form name="delete_category" action="admin.php" method="post"> 
    <b>Delete Category:</b><br /> 
    <?php echo($category_list); ?> 
    <input type="submit" value="delete" name="action" onClick="return confirmSubmit()" />

  18. #68
    SitePoint Member
    Join Date
    Sep 2003
    Location
    Bonn
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Following the script the pictures are stored, but when I choose a .gif to be uploaded I got the following error:
    ---
    Fatal error: Call to undefined function: imagecreatefromgif() in upload.php on line 72
    ---
    Any idea what to do?

    Thank you!

  19. #69
    SitePoint Zealot
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mart,
    Put your code up here, the section relating to line 72 ...or just check it against his tutorial. Also, check your php version and your GD version, because Mayank shows two different methods, one for GD 1.x.x and one for GD 2.x.x

    But to be clear, you do get a page with your gif displayed right? And a thumbnail produced?

  20. #70
    SitePoint Member
    Join Date
    Sep 2003
    Location
    Bonn
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chroni
    But to be clear, you do get a page with your gif displayed right? And a thumbnail produced?
    I've checked the code again - there's everything like in the tutorial. BUT - the gifs are stored, but they are not displayed and a thumbnail is not produced. I think that should be at least until next year when the license expires. Until then I think it is best to delete the gif from the $gd_function_suffix array.
    Thank you.

    Mart

  21. #71
    Non-Member
    Join Date
    Apr 2003
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok now where does this go?

    Code:
    $photo_types = array(  
     'image/pjpeg' => 'jpg', 
     'image/jpeg' => 'jpg', 
     'image/gif' => 'gif', 
     'image/bmp' => 'bmp', 
     'image/x-png' => 'png' 
    );

  22. #72
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by nexon
    Ok now where does this go?
    Code:
    $photo_types = array( 
    'image/pjpeg' => 'jpg', 
    'image/jpeg' => 'jpg', 
    'image/gif' => 'gif', 
    'image/bmp' => 'bmp', 
    'image/x-png' => 'png' 
    );
    put it at the top

  23. #73
    SitePoint Member
    Join Date
    Sep 2003
    Location
    Bonn
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry - but it does not change anything. :-(

    Mart

  24. #74
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just put mine at the top coz it didnt seem to work but yeah it shouldnt matter I agree

  25. #75
    Non-Member
    Join Date
    Apr 2003
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    of what file?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •