Jump to content

Recommended Posts

Hey Guys,

 

  Blog functionality is fairly simple. Here's where I am having a problem though. I built the blog originally with 50 pictures and picture blurbs, just recently I was asked to change this number to 100, so I did on the "blog add" page, but the edit section is a monster. I have a page called edit-picture4.php for the form, then edit-picture4-handler.php to handle the mysql and php. and I have basically these two pages for each entry, (50 of them >.>) is there an easier way to do this? Any direction would be much apreciated.

 

Thanks all!

-T

What are these files actually used for? Are they for a gallery? Are they a part of the layout? Are they images in the blog post?

 

In either way, you could probably store all of these files in the one file and systematically get them. For example (and this is based off the assumption that these 50 files are for a gallery):

 

<?php
    
    $file[0]["src"] = "File1.jpg";
    $file[0]["blurb"] = "Description for File one";
    $file[1]["src"] = "File2.jpg";
    $file[1]["blurb"] = "Description for File two";
// ....
    $file[49]["src"] = "File50.jpg";
    $file[49]["blurb"] = "Description for File fifty";

    for($i = 0; $i <= $numOfFiles; $i++) {
        echo "<img src='" . $file[$i]["src"] . "'>" . $file[$i]["blurb"] . "<br />";
    }
?>

 

But that's a horrible way of doing it. My suggestion would be create a table on your database called 'tblGallery' or something, store the image locations in there then use a simple PHP function to get the src and blurb. That way, you can programatically maintain the list meaning you can have fifty, one hundred or even a million image locations in your database

 

But until you can tell us more about your application, this is the best I can offer ;)

Hey,

 

I fixed the problem I was having. Thanks for the help though, really appreciate your post :]

 

Best,

-T

 

Would you mind sharing for future references?

 

Also, please mark as solved, bottom left right above "quick reply".

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.