PDA

View Full Version : Help modifying script.


Kenneth K
10-19-2004, 02:17 PM
Hello again :D

I would to see the first picture of the day when I enter the site and select a day from the calender. How do I do that? As it is now I get the last posted picture from the day when I enter the blog. That's not very convenient when you post many pictures on the same day. I've already changed the imagelink so it links to the next picture instead of the previous picture.

Plz help :?

/Kenneth

pixelpunk
10-19-2004, 03:16 PM
Oh, I had no idea it behaved like that, I'll will fix that, tomorrow.

// punK

Kenneth K
10-19-2004, 04:45 PM
Ok, cool.

/Kenneth

pixelpunk
10-20-2004, 07:35 AM
I thought about fixing this now, but immediately noticed I must have misunderstood you.

If you post 5 pictures today, the last picture you upload will be the first you see, and this is not anything you want? You want the first picture posted to show up first?

Kind of chronological in days, and reversed chronological within the day (hours/minutes)? Is that it?

// punK

Kenneth K
10-20-2004, 11:34 AM
If you post 5 pictures today, the last picture you upload will be the first you see, and this is not anything you want?
No.

You want the first picture posted to show up first?
Yes.

So when I pick a day from the calender I get the first posted picture from that day.

/Kenneth

pixelpunk
10-20-2004, 12:28 PM
Let's try something. This is not tested at all.
Backup your index.php :)

Anyway, open up the main script, index.php.
Find the following (should be around line 67):
// Get Current Image.
if($_GET['showimage'] == "") {
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost order by datetime ASC limit 0,1");
} else {
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where id='".$_GET['showimage']."'");
}

Replace that with the following:
// Get Current Image.
if($_GET['showimage'] == "") {
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost order by datetime ASC limit 0,1");
} else {
if($_GET['curr_month'] == "") {
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where id='".$_GET['showimage']."'");
} else {
$find_images_this_date = $_GET['curr_year']."-".$_GET['curr_month']."-".$_GET['curr_day'];
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where datetime like '$find_images_this_date%' order by datetime asc");
}
}

I hope it works, it might not.

// pixel

Kenneth K
10-20-2004, 01:13 PM
Nope that didn't do any good. When selecting a day from the calender the same day poped up. I could scroll the images with the thumbnails tho.

/Kenneth

blinking8s
10-20-2004, 01:41 PM
just edit the image id's in the mysql for now...hehe

i noticed this last night and was a little confused for a few...

another admin addition, display order by date ;) lol

pixelpunk
10-20-2004, 01:55 PM
It do display images by date (and time). Linear.
Chronological postdate.
Not id.
Take another quick look at the query.
order by datetime

image.jpg, posted at 2004-10-20 14:54:00 is posted earlier than
image2.jpg, posted at 2004-10-20 16:22:00 for example.

Therefor, when browsing to a date the last image posted, image2.jpg, is displayed first. You start at the end of the line and moves backwards, both date and time.

So, if you enter a date, say 2004-10-20 and want the first image posted on that date, which is image.jpg posted 14:54:00, then you need to reverse the order somehow. Which will mess up the regular timeline.

blinking8s
10-22-2004, 03:12 AM
bah that gave me a headache trying to figure that one out...haha...ok, but in theory, we want it to display the NEWEST image first right? would setting the display from the newest id work? errr...

def gonna have to add a display order to the admin...haha *smacks self*

pixelpunk
10-22-2004, 07:57 AM
The newest image is shown...

// punK

blinking8s
10-22-2004, 09:29 AM
haha...but its not the REAL newest...lol

pixelpunk
10-22-2004, 09:37 AM
It is.

Read again, try to understand this time.

// punk

blinking8s
10-22-2004, 02:22 PM
i think we're mixed up, cause my image 1 displays first, and image 2 which i posted later in the day displays 2nd

haha...i think :?:

Kenneth K
10-22-2004, 10:34 PM
i think we're mixed up, cause my image 1 displays first, and image 2 which i posted later in the day displays 2nd

haha...i think :?:

blinking8s, try browsing my blog and you'll see what I'm talking about. The order is screwed up :?

/Kenneth,
http://pinx.dk/photoblog/